Class: GoogleMapsPlatform::CustomQueryAuthenticationCredentials
- Inherits:
-
Object
- Object
- GoogleMapsPlatform::CustomQueryAuthenticationCredentials
- Defined in:
- lib/google_maps_platform/http/auth/custom_query_authentication.rb
Overview
Data class for CustomQueryAuthenticationCredentials. Data class for CustomQueryAuthenticationCredentials.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(key: nil) ⇒ Object
-
#initialize(key:) ⇒ CustomQueryAuthenticationCredentials
constructor
A new instance of CustomQueryAuthenticationCredentials.
Constructor Details
#initialize(key:) ⇒ CustomQueryAuthenticationCredentials
Returns a new instance of CustomQueryAuthenticationCredentials.
30 31 32 33 34 |
# File 'lib/google_maps_platform/http/auth/custom_query_authentication.rb', line 30 def initialize(key:) raise ArgumentError, 'key cannot be nil' if key.nil? @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
28 29 30 |
# File 'lib/google_maps_platform/http/auth/custom_query_authentication.rb', line 28 def key @key end |
Class Method Details
.from_env ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/google_maps_platform/http/auth/custom_query_authentication.rb', line 36 def self.from_env key = ENV['KEY'] all_nil = [ key ].all?(&:nil?) return nil if all_nil new(key: key) end |
Instance Method Details
#clone_with(key: nil) ⇒ Object
46 47 48 49 50 |
# File 'lib/google_maps_platform/http/auth/custom_query_authentication.rb', line 46 def clone_with(key: nil) key ||= self.key CustomQueryAuthenticationCredentials.new(key: key) end |