Class: Bkblz::V1::PaginatedResponse
- Defined in:
- lib/bkblz/v1/response.rb
Direct Known Subclasses
Constant Summary collapse
Constants inherited from Response
Response::MissingResponseError
Class Attribute Summary collapse
-
.pagination_fields ⇒ Object
readonly
Returns the value of attribute pagination_fields.
Attributes inherited from Response
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Response
#[], #initialize, #parse, response_accessor, response_accessors, response_model, #to_model
Constructor Details
This class inherits a constructor from Bkblz::V1::Response
Class Attribute Details
.pagination_fields ⇒ Object (readonly)
Returns the value of attribute pagination_fields.
90 91 92 |
# File 'lib/bkblz/v1/response.rb', line 90 def pagination_fields @pagination_fields end |
Class Method Details
.pagination_accessors(*pagination_fields) ⇒ Object
91 92 93 94 95 96 |
# File 'lib/bkblz/v1/response.rb', line 91 def pagination_accessors(*pagination_fields) response_accessors *pagination_fields @pagination_fields ||= [] @pagination_fields.concat pagination_fields end |
Instance Method Details
#has_more? ⇒ Boolean
99 100 101 |
# File 'lib/bkblz/v1/response.rb', line 99 def has_more? self.class.pagination_fields.any? { |f| !self[f].nil? } end |
#next_request(limit = nil) ⇒ Object
103 104 105 106 |
# File 'lib/bkblz/v1/response.rb', line 103 def next_request(limit=nil) raise NoMorePagesError unless has_more? build_next_request(limit) end |