Sha256: 9a28595ae77a82ffddfd3d81002ce5195599acdbcfe7bfc793ec1437005a8b08

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

module Twitter
  class RateLimitStatus
    include EasyClassMaker
    
    attributes :reset_time_in_seconds, :reset_time, :remaining_hits, :hourly_limit
    
    class << self
      # Creates a new rate limi status from a piece of xml
      def new_from_xml(xml)
        RateLimitStatus.new do |s|
          s.reset_time_in_seconds = xml.at('reset-time-in-seconds').text.to_i
          s.reset_time            = Time.parse xml.at('reset-time').text
          s.remaining_hits        = xml.at('remaining-hits').text.to_i
          s.hourly_limit          = xml.at('hourly-limit').text.to_i
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
handcrafted-twitter-0.4.0 lib/twitter/rate_limit_status.rb