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
permalink #initialize(bucket: nil, limit: nil, remaining: nil, reset_at: nil) ⇒ RateLimitMetadata
Returns a new instance of RateLimitMetadata.
10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 |
# File 'lib/models/porcelain.rb', line 10280 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
permalink #bucket ⇒ Object
The bucket this user/token is associated with, which may be shared between multiple users/tokens.
10271 10272 10273 |
# File 'lib/models/porcelain.rb', line 10271 def bucket @bucket end |
permalink #limit ⇒ Object
How many total requests the user/token is authorized to make before being rate limited.
10274 10275 10276 |
# File 'lib/models/porcelain.rb', line 10274 def limit @limit end |
permalink #remaining ⇒ Object
How many remaining requests out of the limit are still avaialable.
10276 10277 10278 |
# File 'lib/models/porcelain.rb', line 10276 def remaining @remaining end |
permalink #reset_at ⇒ Object
The time when remaining will be reset to limit.
10278 10279 10280 |
# File 'lib/models/porcelain.rb', line 10278 def reset_at @reset_at end |
Instance Method Details
permalink #to_json(options = {}) ⇒ Object
[View source]
10292 10293 10294 10295 10296 10297 10298 |
# File 'lib/models/porcelain.rb', line 10292 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 |