Class: Pipekit::Result
- Inherits:
-
Object
- Object
- Pipekit::Result
- Defined in:
- lib/pipekit/result.rb
Class Method Summary collapse
Instance Method Summary collapse
- #+(other) ⇒ Object
- #fetch_next_request? ⇒ Boolean
-
#initialize(resource, response_data) ⇒ Result
constructor
A new instance of Result.
- #next_start ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(resource, response_data) ⇒ Result
Returns a new instance of Result.
5 6 7 8 9 |
# File 'lib/pipekit/result.rb', line 5 def initialize(resource, response_data) @response_data = response_data @resource = resource raise UnsuccessfulRequestError.new(response_data) unless success? end |
Class Method Details
.response(resource, response_data) ⇒ Object
29 30 31 |
# File 'lib/pipekit/result.rb', line 29 def self.response(resource, response_data) new(resource, response_data).response end |
Instance Method Details
#+(other) ⇒ Object
17 18 19 |
# File 'lib/pipekit/result.rb', line 17 def +(other) self.class.new(resource, other.merged_response(response_body)) end |
#fetch_next_request? ⇒ Boolean
21 22 23 |
# File 'lib/pipekit/result.rb', line 21 def fetch_next_request? Config.fetch(:request_all_pages, true) && pagination_data["more_items_in_collection"] end |
#next_start ⇒ Object
25 26 27 |
# File 'lib/pipekit/result.rb', line 25 def next_start pagination_data["next_start"] end |