Class: AbstractApiWrapper::Response::Collection
- Inherits:
-
Array
- Object
- Array
- AbstractApiWrapper::Response::Collection
- Includes:
- AbstractApiWrapper::ResponseStatus
- Defined in:
- lib/abstract_api_wrapper.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(*options) ⇒ Collection
constructor
A new instance of Collection.
- #pagination ⇒ Object
Methods included from AbstractApiWrapper::ResponseStatus
Constructor Details
#initialize(*options) ⇒ Collection
Returns a new instance of Collection.
162 163 164 165 |
# File 'lib/abstract_api_wrapper.rb', line 162 def initialize(*) @request = [1] if [1] super([0]) end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
160 161 162 |
# File 'lib/abstract_api_wrapper.rb', line 160 def request @request end |
Instance Method Details
#headers ⇒ Object
167 168 169 |
# File 'lib/abstract_api_wrapper.rb', line 167 def headers @headers ||= Hashie::Mash.new(@request.headers) end |
#pagination ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/abstract_api_wrapper.rb', line 171 def pagination @pagination ||= Hashie::Mash.new( next_page: headers['x-next-page'].to_i, offset: headers['x-offset'].to_i, page: headers['x-page'].to_i, per_page: headers['x-per-page'].to_i, prev_page: headers['prev_page'].to_i, total: headers['x-total'].to_i, total_pages: headers['x-total-pages'].to_i ) end |