Class: Quintype::API::StoriesRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/quintype/api/story.rb

Instance Method Summary collapse

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_requestObject



13
14
15
# File 'lib/quintype/api/story.rb', line 13

def to_bulk_request
  @params.merge(_type: "stories")
end