-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Add query helpers. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -0,0 +1,13 @@ | |||
require 'jsonapi/client' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing frozen string literal comment.
|
||
module JSONAPI | ||
class Client | ||
class Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
@@ -0,0 +1,25 @@ | |||
require 'jsonapi/client/document' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing frozen string literal comment.
|
||
private | ||
|
||
def request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method has too many lines. [17/10]
|
||
module JSONAPI | ||
class Client | ||
class Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class has too many lines. [123/100]
Missing top-level class documentation comment.
@@ -0,0 +1,157 @@ | |||
require 'net/http' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing frozen string literal comment.
@@ -1,5 +1,10 @@ | |||
require 'jsonapi/client/resource' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing frozen string literal comment.
@base_url = base_url | ||
@headers = { | ||
:'Content-Type' => 'application/vnd.api+json', | ||
:Accept => 'application/vnd.api+json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
def initialize(base_url: nil, headers: {}) | ||
@base_url = base_url | ||
@headers = { | ||
:'Content-Type' => 'application/vnd.api+json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
require 'jsonapi/client/response' | ||
|
||
module JSONAPI | ||
class Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
|
||
module JSONAPI | ||
class Client | ||
class Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class has too many lines. [124/100]
Missing top-level class documentation comment.
response = | ||
Net::HTTP.start(uri.host, use_ssl: uri.scheme == 'https') do |http| | ||
http.request request | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end at 21, 8 is not aligned with Net::HTTP.start(uri.host, use_ssl: uri.scheme == 'https') do |http| at 19, 10.
|
||
module JSONAPI | ||
class Client | ||
class Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class has too many lines. [125/100]
Missing top-level class documentation comment.
|
||
private | ||
|
||
def request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method has too many lines. [21/10]
|
||
module JSONAPI | ||
class Client | ||
class Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class has too many lines. [129/100]
Missing top-level class documentation comment.
@beauby Is this gem still maintained? :) |
Example:
The following generates a query
http://api.example.com/users/2?include=posts.author,posts.comments.author&fields[posts]=title,content&fields[users]=name,email&page=3
and parses the response (wrapped inside a.JSONAPI::Client::Response
object, that exposesstatus
,headers
andbody
,body
being aJSONAPI::Client::Document
instance ornil
)