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.
5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 |
# File 'lib/models/porcelain.rb', line 5723 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.
5714 5715 5716 |
# File 'lib/models/porcelain.rb', line 5714 def bucket @bucket end |
#limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
5717 5718 5719 |
# File 'lib/models/porcelain.rb', line 5717 def limit @limit end |
#remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
5719 5720 5721 |
# File 'lib/models/porcelain.rb', line 5719 def remaining @remaining end |
#reset_at ⇒ Object
The time when remaining will be reset to limit.
5721 5722 5723 |
# File 'lib/models/porcelain.rb', line 5721 def reset_at @reset_at end |
Instance Method Details
#to_json(options = {}) ⇒ Object
5743 5744 5745 5746 5747 5748 5749 |
# File 'lib/models/porcelain.rb', line 5743 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 |