Sha256: cbb8e56789201e945cefd5160edab09e5e864907a9397c02c811b1d3fa74a477

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module Feedlr
  # Rate limiting object associated with responses
  class RateLimit
    attr_reader :count, :limit, :remaining
    # Initializes a new object
    #
    # @param attrs [Hash]
    # @option attrs [String] :x-ratelimit-count
    # @option attrs [String] :x-ratelimit-limit
    # @option attrs [String] :x-ratelimit-remaining
    # @return [Feedlr::RateLimit]
    def initialize(attrs =  {})
      @count =
        attrs['x-ratelimit-count'].to_i if attrs['x-ratelimit-count']
      @limit =
        attrs['x-ratelimit-limit'].to_i if attrs['x-ratelimit-limit']
      @remaining =
        attrs['x-ratelimit-remaining'].to_i if attrs['x-ratelimit-remaining']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feedlr-0.1.0 lib/feedlr/rate_limit.rb