Class: SDM::RateLimitMetadata
- Inherits:
-
Object
- Object
- SDM::RateLimitMetadata
- Defined in:
- lib/models/porcelain.rb
Overview
RateLimitMetadata contains information about remaining requests avaialable to the user over some timeframe.
Instance Attribute Summary collapse
-
#bucket ⇒ Object
The bucket this user/token is associated with, which may be shared between multiple users/tokens.
-
#limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
-
#remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
-
#reset_at ⇒ Object
The time when remaining will be reset to limit.
Instance Method Summary collapse
-
#initialize(bucket: nil, limit: nil, remaining: nil, reset_at: nil) ⇒ RateLimitMetadata
constructor
A new instance of RateLimitMetadata.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(bucket: nil, limit: nil, remaining: nil, reset_at: nil) ⇒ RateLimitMetadata
7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 |
# File 'lib/models/porcelain.rb', line 7605 def initialize( bucket: nil, limit: nil, remaining: nil, reset_at: nil ) @bucket = bucket == nil ? "" : bucket @limit = limit == nil ? 0 : limit @remaining = remaining == nil ? 0 : remaining @reset_at = reset_at == nil ? nil : reset_at end |
Instance Attribute Details
#bucket ⇒ Object
The bucket this user/token is associated with, which may be shared between multiple users/tokens.
7596 7597 7598 |
# File 'lib/models/porcelain.rb', line 7596 def bucket @bucket end |
#limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
7599 7600 7601 |
# File 'lib/models/porcelain.rb', line 7599 def limit @limit end |
#remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
7601 7602 7603 |
# File 'lib/models/porcelain.rb', line 7601 def remaining @remaining end |
#reset_at ⇒ Object
The time when remaining will be reset to limit.
7603 7604 7605 |
# File 'lib/models/porcelain.rb', line 7603 def reset_at @reset_at end |
Instance Method Details
#to_json(options = {}) ⇒ Object
7617 7618 7619 7620 7621 7622 7623 |
# File 'lib/models/porcelain.rb', line 7617 def to_json( = {}) hash = {} self.instance_variables.each do |var| hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var end hash.to_json end |