Class: AbstractApiWrapper::Response::Collection
- Inherits:
-
Array
- Object
- Array
- AbstractApiWrapper::Response::Collection
- 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
Constructor Details
#initialize(*options) ⇒ Collection
Returns a new instance of Collection.
149 150 151 152 |
# File 'lib/abstract_api_wrapper.rb', line 149 def initialize(*) @request = [1] if [1] super([0]) end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
147 148 149 |
# File 'lib/abstract_api_wrapper.rb', line 147 def request @request end |
Instance Method Details
#headers ⇒ Object
154 155 156 |
# File 'lib/abstract_api_wrapper.rb', line 154 def headers @headers ||= Hashie::Mash.new(@request.headers) end |
#pagination ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/abstract_api_wrapper.rb', line 158 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 |