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
Returns a new instance of RateLimitMetadata.
5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 |
# File 'lib/models/porcelain.rb', line 5679 def initialize( bucket: nil, limit: nil, remaining: nil, reset_at: nil ) if bucket != nil @bucket = bucket end if limit != nil @limit = limit end if remaining != nil @remaining = remaining end if reset_at != nil @reset_at = reset_at end end |
Instance Attribute Details
#bucket ⇒ Object
The bucket this user/token is associated with, which may be shared between multiple users/tokens.
5670 5671 5672 |
# File 'lib/models/porcelain.rb', line 5670 def bucket @bucket end |
#limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
5673 5674 5675 |
# File 'lib/models/porcelain.rb', line 5673 def limit @limit end |
#remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
5675 5676 5677 |
# File 'lib/models/porcelain.rb', line 5675 def remaining @remaining end |
#reset_at ⇒ Object
The time when remaining will be reset to limit.
5677 5678 5679 |
# File 'lib/models/porcelain.rb', line 5677 def reset_at @reset_at end |
Instance Method Details
#to_json(options = {}) ⇒ Object
5699 5700 5701 5702 5703 5704 5705 |
# File 'lib/models/porcelain.rb', line 5699 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 |