Class: Dayman::Request
- Inherits:
-
Object
- Object
- Dayman::Request
- Defined in:
- lib/dayman/request.rb,
lib/dayman/request/fields.rb,
lib/dayman/request/filters.rb,
lib/dayman/request/sorting.rb,
lib/dayman/request/includes.rb
Defined Under Namespace
Modules: Fields, Filters, Includes, Sorting
Constant Summary
Constants included from Sorting
Instance Attribute Summary collapse
-
#fieldsets ⇒ Object
readonly
Returns the value of attribute fieldsets.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#included_resources ⇒ Object
readonly
Returns the value of attribute included_resources.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#sort_fields ⇒ Object
readonly
Returns the value of attribute sort_fields.
Instance Method Summary collapse
- #all ⇒ Object
- #find(id) ⇒ Object
-
#initialize(resource) ⇒ Request
constructor
A new instance of Request.
Methods included from Sorting
Methods included from Includes
Methods included from Filters
Methods included from Fields
Constructor Details
#initialize(resource) ⇒ Request
Returns a new instance of Request.
21 22 23 24 25 26 27 28 |
# File 'lib/dayman/request.rb', line 21 def initialize(resource) @resource = resource @fieldsets = {} @filters = {} @included_resources = [] @sort_fields = [] end |
Instance Attribute Details
#fieldsets ⇒ Object (readonly)
Returns the value of attribute fieldsets.
15 16 17 |
# File 'lib/dayman/request.rb', line 15 def fieldsets @fieldsets end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
15 16 17 |
# File 'lib/dayman/request.rb', line 15 def filters @filters end |
#included_resources ⇒ Object (readonly)
Returns the value of attribute included_resources.
15 16 17 |
# File 'lib/dayman/request.rb', line 15 def included_resources @included_resources end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
15 16 17 |
# File 'lib/dayman/request.rb', line 15 def resource @resource end |
#sort_fields ⇒ Object (readonly)
Returns the value of attribute sort_fields.
15 16 17 |
# File 'lib/dayman/request.rb', line 15 def sort_fields @sort_fields end |
Instance Method Details
#all ⇒ Object
31 32 33 34 |
# File 'lib/dayman/request.rb', line 31 def all response = connection.get(resource.path, query_parameters) Parsers::CollectionParser.new(resource: resource, response: response.body).parse end |
#find(id) ⇒ Object
37 38 39 40 |
# File 'lib/dayman/request.rb', line 37 def find(id) response = connection.get([resource.path, id].join('/')) Parsers::MemberParser.new(resource: resource, response: response.body).parse end |