Class: LightrateClient::ConsumeTokensResponse
- Inherits:
-
Object
- Object
- LightrateClient::ConsumeTokensResponse
- Defined in:
- lib/lightrate_client/types.rb
Overview
Response types
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#throttles ⇒ Object
readonly
Returns the value of attribute throttles.
-
#tokens_consumed ⇒ Object
readonly
Returns the value of attribute tokens_consumed.
-
#tokens_remaining ⇒ Object
readonly
Returns the value of attribute tokens_remaining.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tokens_remaining:, tokens_consumed:, throttles: 0, rule: nil) ⇒ ConsumeTokensResponse
constructor
A new instance of ConsumeTokensResponse.
Constructor Details
#initialize(tokens_remaining:, tokens_consumed:, throttles: 0, rule: nil) ⇒ ConsumeTokensResponse
48 49 50 51 52 53 |
# File 'lib/lightrate_client/types.rb', line 48 def initialize(tokens_remaining:, tokens_consumed:, throttles: 0, rule: nil) @tokens_remaining = tokens_remaining @tokens_consumed = tokens_consumed @throttles = throttles @rule = rule end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
46 47 48 |
# File 'lib/lightrate_client/types.rb', line 46 def rule @rule end |
#throttles ⇒ Object (readonly)
Returns the value of attribute throttles.
46 47 48 |
# File 'lib/lightrate_client/types.rb', line 46 def throttles @throttles end |
#tokens_consumed ⇒ Object (readonly)
Returns the value of attribute tokens_consumed.
46 47 48 |
# File 'lib/lightrate_client/types.rb', line 46 def tokens_consumed @tokens_consumed end |
#tokens_remaining ⇒ Object (readonly)
Returns the value of attribute tokens_remaining.
46 47 48 |
# File 'lib/lightrate_client/types.rb', line 46 def tokens_remaining @tokens_remaining end |
Class Method Details
.from_hash(hash) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/lightrate_client/types.rb', line 55 def self.from_hash(hash) rule = nil if hash['rule'] || hash[:rule] rule_hash = hash['rule'] || hash[:rule] rule = Rule.from_hash(rule_hash) end new( tokens_remaining: hash['tokensRemaining'] || hash[:tokens_remaining], tokens_consumed: hash['tokensConsumed'] || hash[:tokens_consumed], throttles: hash['throttles'] || hash[:throttles] || 0, rule: rule ) end |