Class: SwaggerPetstore::ApiKeyCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_petstore/http/auth/api_key.rb

Overview

Data class for ApiKeyCredentials. Data class for ApiKeyCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:) ⇒ ApiKeyCredentials

Returns a new instance of ApiKeyCredentials.

Raises:

  • (ArgumentError)


30
31
32
33
34
# File 'lib/swagger_petstore/http/auth/api_key.rb', line 30

def initialize(api_key:)
  raise ArgumentError, 'api_key cannot be nil' if api_key.nil?

  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



28
29
30
# File 'lib/swagger_petstore/http/auth/api_key.rb', line 28

def api_key
  @api_key
end

Instance Method Details

#clone_with(api_key: nil) ⇒ Object



36
37
38
39
40
# File 'lib/swagger_petstore/http/auth/api_key.rb', line 36

def clone_with(api_key: nil)
  api_key ||= self.api_key

  ApiKeyCredentials.new(api_key: api_key)
end