class SDM::RateLimitMetadata

RateLimitMetadata contains information about remaining requests avaialable to the user over some timeframe.

Attributes

bucket[RW]

The bucket this user/token is associated with, which may be shared between multiple users/tokens.

limit[RW]

How many total requests the user/token is authorized to make before being rate limited.

remaining[RW]

How many remaining requests out of the limit are still avaialable.

reset_at[RW]

The time when remaining will be reset to limit.

Public Class Methods

new( limit: nil, remaining: nil, reset_at: nil, bucket: nil ) click to toggle source
# File lib/models/porcelain.rb, line 89
def initialize(
  limit: nil,
  remaining: nil,
  reset_at: nil,
  bucket: nil
)
  if limit != nil
    @limit = limit
  end
  if remaining != nil
    @remaining = remaining
  end
  if reset_at != nil
    @reset_at = reset_at
  end
  if bucket != nil
    @bucket = bucket
  end
end

Public Instance Methods

to_json(options = {}) click to toggle source
# File lib/models/porcelain.rb, line 109
def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end