Class: Feedlr::RateLimit

Inherits:
Object
  • Object
show all
Defined in:
lib/feedlr/rate_limit.rb

Overview

Rate limiting object associated with responses

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Feedlr::RateLimit

Initializes a new object

Parameters:

  • attrs (Hash) (defaults to: {})

Options Hash (attrs):

  • :x-ratelimit-count (String)
  • :x-ratelimit-limit (String)
  • :x-ratelimit-remaining (String)

12
13
14
15
16
17
18
19
# File 'lib/feedlr/rate_limit.rb', line 12

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

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count


4
5
6
# File 'lib/feedlr/rate_limit.rb', line 4

def count
  @count
end

#limitObject (readonly)

Returns the value of attribute limit


4
5
6
# File 'lib/feedlr/rate_limit.rb', line 4

def limit
  @limit
end

#remainingObject (readonly)

Returns the value of attribute remaining


4
5
6
# File 'lib/feedlr/rate_limit.rb', line 4

def remaining
  @remaining
end