Class: LightrateClient::ConsumeTokensRequest
- Inherits:
-
Object
- Object
- LightrateClient::ConsumeTokensRequest
- Defined in:
- lib/lightrate_client/types.rb
Overview
Request types
Instance Attribute Summary collapse
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#operation ⇒ Object
Returns the value of attribute operation.
-
#path ⇒ Object
Returns the value of attribute path.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#tokens_requested ⇒ Object
Returns the value of attribute tokens_requested.
-
#tokens_requested_for_default_bucket_match ⇒ Object
Returns the value of attribute tokens_requested_for_default_bucket_match.
-
#user_identifier ⇒ Object
Returns the value of attribute user_identifier.
Instance Method Summary collapse
-
#initialize(application_id:, operation: nil, path: nil, http_method: nil, user_identifier:, tokens_requested:, tokens_requested_for_default_bucket_match: nil, timestamp: nil) ⇒ ConsumeTokensRequest
constructor
A new instance of ConsumeTokensRequest.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(application_id:, operation: nil, path: nil, http_method: nil, user_identifier:, tokens_requested:, tokens_requested_for_default_bucket_match: nil, timestamp: nil) ⇒ ConsumeTokensRequest
Returns a new instance of ConsumeTokensRequest.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lightrate_client/types.rb', line 8 def initialize(application_id:, operation: nil, path: nil, http_method: nil, user_identifier:, tokens_requested:, tokens_requested_for_default_bucket_match: nil, timestamp: nil) @application_id = application_id @operation = operation @path = path @http_method = http_method @user_identifier = user_identifier @tokens_requested = tokens_requested @tokens_requested_for_default_bucket_match = tokens_requested_for_default_bucket_match = || Time.now end |
Instance Attribute Details
#application_id ⇒ Object
Returns the value of attribute application_id.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def application_id @application_id end |
#http_method ⇒ Object
Returns the value of attribute http_method.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def http_method @http_method end |
#operation ⇒ Object
Returns the value of attribute operation.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def operation @operation end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def path @path end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def end |
#tokens_requested ⇒ Object
Returns the value of attribute tokens_requested.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def tokens_requested @tokens_requested end |
#tokens_requested_for_default_bucket_match ⇒ Object
Returns the value of attribute tokens_requested_for_default_bucket_match.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def tokens_requested_for_default_bucket_match @tokens_requested_for_default_bucket_match end |
#user_identifier ⇒ Object
Returns the value of attribute user_identifier.
6 7 8 |
# File 'lib/lightrate_client/types.rb', line 6 def user_identifier @user_identifier end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lightrate_client/types.rb', line 19 def to_h { applicationId: @application_id, operation: @operation, path: @path, httpMethod: @http_method, userIdentifier: @user_identifier, tokensRequested: @tokens_requested, tokensRequestedForDefaultBucketMatch: @tokens_requested_for_default_bucket_match, timestamp: }.compact end |
#valid? ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lightrate_client/types.rb', line 32 def valid? return false if @application_id.nil? || @application_id.empty? return false if @user_identifier.nil? || @user_identifier.empty? return false if @tokens_requested.nil? || @tokens_requested <= 0 return false if @operation.nil? && @path.nil? return false if @operation && @path return false if @path && @http_method.nil? true end |