Class: TimeTree::BaseClient
- Inherits:
-
Object
- Object
- TimeTree::BaseClient
show all
- Defined in:
- lib/timetree/base_client.rb
Constant Summary
collapse
- API_HOST =
'https://timetreeapis.com'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#ratelimit_limit ⇒ Integer
7
8
9
|
# File 'lib/timetree/base_client.rb', line 7
def ratelimit_limit
@ratelimit_limit
end
|
#ratelimit_remaining ⇒ Integer
9
10
11
|
# File 'lib/timetree/base_client.rb', line 9
def ratelimit_remaining
@ratelimit_remaining
end
|
#ratelimit_reset_at ⇒ Time
11
12
13
|
# File 'lib/timetree/base_client.rb', line 11
def ratelimit_reset_at
@ratelimit_reset_at
end
|
Instance Method Details
#update_ratelimit(res) ⇒ Object
update ratelimit properties
apis http response.
18
19
20
21
22
23
24
25
|
# File 'lib/timetree/base_client.rb', line 18
def update_ratelimit(res)
limit = res.['x-ratelimit-limit']
remaining = res.['x-ratelimit-remaining']
reset = res.['x-ratelimit-reset']
@ratelimit_limit = limit.to_i if limit
@ratelimit_remaining = remaining.to_i if remaining
@ratelimit_reset_at = Time.at reset.to_i if reset
end
|