Class: Quintype::API::StoriesRequest
- Inherits:
-
Object
- Object
- Quintype::API::StoriesRequest
- Defined in:
- lib/quintype/api/story.rb
Instance Method Summary collapse
- #add_params(params) ⇒ Object
- #from_bulk_response(response) ⇒ Object
-
#initialize(klazz, story_group) ⇒ StoriesRequest
constructor
A new instance of StoriesRequest.
- #to_bulk_request ⇒ Object
Constructor Details
#initialize(klazz, story_group) ⇒ StoriesRequest
Returns a new instance of StoriesRequest.
3 4 5 6 |
# File 'lib/quintype/api/story.rb', line 3 def initialize(klazz, story_group) @klazz = klazz @params = {"story-group" => story_group} end |
Instance Method Details
#add_params(params) ⇒ Object
8 9 10 11 |
# File 'lib/quintype/api/story.rb', line 8 def add_params(params) @params.merge!(params) self end |
#from_bulk_response(response) ⇒ Object
17 18 19 |
# File 'lib/quintype/api/story.rb', line 17 def from_bulk_response(response) response["stories"].map {|i| @klazz.from_hash(i) } end |
#to_bulk_request ⇒ Object
13 14 15 |
# File 'lib/quintype/api/story.rb', line 13 def to_bulk_request @params.merge(_type: "stories") end |