Class: Twitter::RateLimit

### Home Classes Methods

### In Files

- lib/twitter/rate_limit.rb

### Parent

Object

### Methods

- ::new
- #limit
- #remaining
- #reset_at
- #reset_in
- #retry_after
- #update

### Class/Module Index

Quicksearch

- Twitter
- Twitter::API
- Twitter::API::Arguments
- Twitter::API::DirectMessages
- Twitter::API::Favorites
- Twitter::API::FriendsAndFollowers
- Twitter::API::Help
- Twitter::API::Lists
- Twitter::API::PlacesAndGeo
- Twitter::API::SavedSearches
- Twitter::API::Search
- Twitter::API::SpamReporting
- Twitter::API::SuggestedUsers
- Twitter::API::Timelines
- Twitter::API::Trends
- Twitter::API::Tweets
- Twitter::API::Undocumented
- Twitter::API::Users
- Twitter::API::Utils
- Twitter::Action
- Twitter::Action::Favorite
- Twitter::Action::Follow
- Twitter::Action::ListMemberAdded
- Twitter::Action::Mention
- Twitter::Action::Reply
- Twitter::Action::Retweet
- Twitter::Action::Status
- Twitter::Action::Tweet
- Twitter::ActionFactory
- Twitter::Base
- Twitter::BasicUser
- Twitter::Client
- Twitter::Configurable
- Twitter::Configuration
- Twitter::Creatable
- Twitter::Cursor
- Twitter::Default
- Twitter::DirectMessage
- Twitter::Entity
- Twitter::Entity::Hashtag
- Twitter::Entity::Url
- Twitter::Entity::UserMention
- Twitter::Error
- Twitter::Error::AlreadyFavorited
- Twitter::Error::AlreadyRetweeted
- Twitter::Error::BadGateway
- Twitter::Error::BadRequest
- Twitter::Error::ClientError
- Twitter::Error::ConfigurationError
- Twitter::Error::DecodeError
- Twitter::Error::EnhanceYourCalm
- Twitter::Error::Forbidden
- Twitter::Error::GatewayTimeout
- Twitter::Error::IdentityMapKeyError
- Twitter::Error::InternalServerError
- Twitter::Error::NotAcceptable
- Twitter::Error::NotFound
- Twitter::Error::RateLimited
- Twitter::Error::ServerError
- Twitter::Error::ServiceUnavailable
- Twitter::Error::TooManyRequests
- Twitter::Error::Unauthorized
- Twitter::Error::UnprocessableEntity
- Twitter::Exceptable
- Twitter::Factory
- Twitter::Geo
- Twitter::Geo::Point
- Twitter::Geo::Polygon
- Twitter::GeoFactory
- Twitter::Identity
- Twitter::IdentityMap
- Twitter::Language
- Twitter::List
- Twitter::Media
- Twitter::Media::Photo
- Twitter::MediaFactory
- Twitter::Metadata
- Twitter::OEmbed
- Twitter::Place
- Twitter::ProfileBanner
- Twitter::RateLimit
- Twitter::Relationship
- Twitter::Request
- Twitter::Request::MultipartWithFile
- Twitter::Response
- Twitter::Response::ParseJson
- Twitter::Response::RaiseError
- Twitter::SavedSearch
- Twitter::SearchResults
- Twitter::Settings
- Twitter::Size
- Twitter::SourceUser
- Twitter::Status
- Twitter::Suggestion
- Twitter::TargetUser
- Twitter::Trend
- Twitter::Tweet
- Twitter::User
- Twitter::Version
- Enumerable
- Kernel

No matching classes.

# Twitter::RateLimit

### Attributes

attrs[R]
to_hash[R]

### Public Class Methods

new(attrs={}) click to toggle source

@return [Twitter::RateLimit]

    # File lib/twitter/rate_limit.rb, line 7
    def initialize(attrs={})
      @attrs = attrs
    end

### Public Instance Methods

limit() click to toggle source

@return [Integer]

    # File lib/twitter/rate_limit.rb, line 12
    def limit
      limit = @attrs['x-rate-limit-limit']
      limit.to_i if limit
    end

remaining() click to toggle source

@return [Integer]

    # File lib/twitter/rate_limit.rb, line 18
    def remaining
      remaining = @attrs['x-rate-limit-remaining']
      remaining.to_i if remaining
    end

reset_at() click to toggle source

@return [Time]

    # File lib/twitter/rate_limit.rb, line 24
    def reset_at
      reset = @attrs['x-rate-limit-reset']
      Time.at(reset.to_i) if reset
    end

reset_in() click to toggle source

@return [Integer]

    # File lib/twitter/rate_limit.rb, line 30
    def reset_in
      [(reset_at - Time.now).ceil, 0].max if reset_at
    end

Also aliased as: retry_after
retry_after() click to toggle source
Alias for: reset_in
update(attrs) click to toggle source

Update the attributes of a RateLimit

@param attrs [Hash] @return [Twitter::RateLimit]

    # File lib/twitter/rate_limit.rb, line 39
    def update(attrs)
      @attrs.update(attrs)
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.