Class: Tuiter::RateLimit
- Inherits:
-
Object
- Object
- Tuiter::RateLimit
- Defined in:
- lib/tuiter/data/rate_limit.rb
Instance Attribute Summary collapse
-
#hourly_limit ⇒ Object
Returns the value of attribute hourly_limit.
-
#remaining_hits ⇒ Object
Returns the value of attribute remaining_hits.
-
#reset_time ⇒ Object
Returns the value of attribute reset_time.
-
#reset_time_in_seconds ⇒ Object
Returns the value of attribute reset_time_in_seconds.
-
#reset_window ⇒ Object
Returns the value of attribute reset_window.
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ RateLimit
constructor
A new instance of RateLimit.
Constructor Details
#initialize(data = nil) ⇒ RateLimit
Returns a new instance of RateLimit.
10 11 12 13 14 15 16 17 18 |
# File 'lib/tuiter/data/rate_limit.rb', line 10 def initialize(data = nil) unless data.nil? @reset_time_in_seconds = Time.at(data["reset_time_in_seconds"].to_i) @reset_time = Time.parse(data["reset_time"]) if data["reset_time"] @reset_window = @reset_time - Time.now if @reset_time @remaining_hits = data["remaining_hits"].to_i @hourly_limit = data["hourly_limit"].to_i end end |
Instance Attribute Details
#hourly_limit ⇒ Object
Returns the value of attribute hourly_limit.
8 9 10 |
# File 'lib/tuiter/data/rate_limit.rb', line 8 def hourly_limit @hourly_limit end |
#remaining_hits ⇒ Object
Returns the value of attribute remaining_hits.
7 8 9 |
# File 'lib/tuiter/data/rate_limit.rb', line 7 def remaining_hits @remaining_hits end |
#reset_time ⇒ Object
Returns the value of attribute reset_time.
4 5 6 |
# File 'lib/tuiter/data/rate_limit.rb', line 4 def reset_time @reset_time end |
#reset_time_in_seconds ⇒ Object
Returns the value of attribute reset_time_in_seconds.
5 6 7 |
# File 'lib/tuiter/data/rate_limit.rb', line 5 def reset_time_in_seconds @reset_time_in_seconds end |
#reset_window ⇒ Object
Returns the value of attribute reset_window.
6 7 8 |
# File 'lib/tuiter/data/rate_limit.rb', line 6 def reset_window @reset_window end |