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.
13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 |
# File 'lib/models/porcelain.rb', line 13252 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.
13243 13244 13245 |
# File 'lib/models/porcelain.rb', line 13243 def bucket @bucket end |
#limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
13246 13247 13248 |
# File 'lib/models/porcelain.rb', line 13246 def limit @limit end |
#remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
13248 13249 13250 |
# File 'lib/models/porcelain.rb', line 13248 def remaining @remaining end |
#reset_at ⇒ Object
The time when remaining will be reset to limit.
13250 13251 13252 |
# File 'lib/models/porcelain.rb', line 13250 def reset_at @reset_at end |
Instance Method Details
#to_json(options = {}) ⇒ Object
13264 13265 13266 13267 13268 13269 13270 |
# File 'lib/models/porcelain.rb', line 13264 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 |