Class: Otter::Response
- Inherits:
-
Object
- Object
- Otter::Response
- Defined in:
- lib/otter/response.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(headers, response) ⇒ Response
constructor
:nodoc:.
-
#page ⇒ Object
Current page.
-
#perpage ⇒ Object
Number of results per page.
-
#rate_limit ⇒ Object
Total credits that can be allocated.
-
#rate_remaining ⇒ Object
Total credits available.
-
#rate_reset ⇒ Object
Time when the credits will be reset.
-
#total ⇒ Object
Total number of results.
- #window ⇒ Object
Constructor Details
#initialize(headers, response) ⇒ Response
:nodoc:
7 8 9 10 |
# File 'lib/otter/response.rb', line 7 def initialize(headers, response) # :nodoc: @headers = headers @response = response end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/otter/response.rb', line 4 def headers @headers end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/otter/response.rb', line 4 def response @response end |
Instance Method Details
#page ⇒ Object
Current page
33 34 35 |
# File 'lib/otter/response.rb', line 33 def page Integer(self.response['total']) end |
#perpage ⇒ Object
Number of results per page
38 39 40 |
# File 'lib/otter/response.rb', line 38 def perpage Integer(self.response['perpage']) end |
#rate_limit ⇒ Object
Total credits that can be allocated.
13 14 15 |
# File 'lib/otter/response.rb', line 13 def rate_limit Integer(self.headers['X_RATELIMIT_LIMIT']) end |
#rate_remaining ⇒ Object
Total credits available.
18 19 20 |
# File 'lib/otter/response.rb', line 18 def rate_remaining Integer(self.headers['X_RATELIMIT_REMAINING']) end |
#rate_reset ⇒ Object
Time when the credits will be reset.
23 24 25 |
# File 'lib/otter/response.rb', line 23 def rate_reset Time.at(Integer(self.headers['X_RATELIMIT_RESET'])) end |
#total ⇒ Object
Total number of results
28 29 30 |
# File 'lib/otter/response.rb', line 28 def total Integer(self.response['page']) end |
#window ⇒ Object
42 43 44 |
# File 'lib/otter/response.rb', line 42 def window self.response['window'] end |