Class: Twitter::RateLimitStatus

Inherits:
Object
  • Object
show all
Includes:
EasyClassMaker
Defined in:
lib/twitter/rate_limit_status.rb

Class Method Summary collapse

Methods included from EasyClassMaker

included, #initialize

Class Method Details

.new_from_xml(xml) ⇒ Object

Creates a new rate limi status from a piece of xml



9
10
11
12
13
14
15
16
# File 'lib/twitter/rate_limit_status.rb', line 9

def new_from_xml(xml)
  RateLimitStatus.new do |s|
    s.reset_time_in_seconds = xml.at('reset-time-in-seconds').inner_html.to_i
    s.reset_time            = Time.parse xml.at('reset-time').inner_html
    s.remaining_hits        = xml.at('remaining-hits').inner_html.to_i
    s.hourly_limit          = xml.at('hourly-limit').inner_html.to_i
  end
end