Class: Twitch::Response
- Inherits:
-
Object
- Object
- Twitch::Response
- Extended by:
- Forwardable
- Defined in:
- lib/twitch/response.rb
Overview
A compiled response from the API.
Instance Attribute Summary collapse
-
#clip_rate_limit ⇒ Object
readonly
The total amount of clips that can be created in the clip rate limit period (currently unknown).
-
#clip_rate_limit_remaining ⇒ Object
readonly
The remaining amount of clips that can be created in the clip rate limit period.
-
#data ⇒ Object
readonly
The requested data.
-
#date_range ⇒ Object
readonly
A range of dates in which data is effective.
-
#pagination ⇒ Object
readonly
A hash containing a pagination token.
-
#rate_limit ⇒ Object
readonly
The total amount of calls that can be used in the rate limit period (one minute by default).
-
#rate_limit_remaining ⇒ Object
readonly
The remaining amount of calls for the rate limit period.
-
#rate_limit_resets_at ⇒ Object
readonly
The date at which the rate limit is reset.
-
#raw ⇒ Object
readonly
The HTTP raw response.
-
#total ⇒ Object
readonly
A total amount of entities.
Instance Method Summary collapse
-
#initialize(data_class, http_response:) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(data_class, http_response:) ⇒ Response
Returns a new instance of Response.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/twitch/response.rb', line 39 def initialize(data_class, http_response:) @http_response = http_response @raw = @http_response @data = parse_data data_class parse_rate_limits @pagination = body['pagination'] @total = body['total'] @date_range = body['date_range'] end |
Instance Attribute Details
#clip_rate_limit ⇒ Object (readonly)
The total amount of clips that can be created in the clip rate limit period (currently unknown).
32 33 34 |
# File 'lib/twitch/response.rb', line 32 def clip_rate_limit @clip_rate_limit end |
#clip_rate_limit_remaining ⇒ Object (readonly)
The remaining amount of clips that can be created in the clip rate limit period.
35 36 37 |
# File 'lib/twitch/response.rb', line 35 def clip_rate_limit_remaining @clip_rate_limit_remaining end |
#data ⇒ Object (readonly)
The requested data.
10 11 12 |
# File 'lib/twitch/response.rb', line 10 def data @data end |
#date_range ⇒ Object (readonly)
A range of dates in which data is effective. Usually contains the keys start_date and end_date. Applies to select endpoints.
17 18 19 |
# File 'lib/twitch/response.rb', line 17 def date_range @date_range end |
#pagination ⇒ Object (readonly)
A hash containing a pagination token. Access it with
pagination['cursor']
Applies to select endpoints.
22 23 24 |
# File 'lib/twitch/response.rb', line 22 def pagination @pagination end |
#rate_limit ⇒ Object (readonly)
The total amount of calls that can be used in the rate limit period (one minute by default).
25 26 27 |
# File 'lib/twitch/response.rb', line 25 def rate_limit @rate_limit end |
#rate_limit_remaining ⇒ Object (readonly)
The remaining amount of calls for the rate limit period.
27 28 29 |
# File 'lib/twitch/response.rb', line 27 def rate_limit_remaining @rate_limit_remaining end |
#rate_limit_resets_at ⇒ Object (readonly)
The date at which the rate limit is reset.
29 30 31 |
# File 'lib/twitch/response.rb', line 29 def rate_limit_resets_at @rate_limit_resets_at end |
#raw ⇒ Object (readonly)
The HTTP raw response
37 38 39 |
# File 'lib/twitch/response.rb', line 37 def raw @raw end |
#total ⇒ Object (readonly)
A total amount of entities. Applies to select endpoints.
13 14 15 |
# File 'lib/twitch/response.rb', line 13 def total @total end |