Class: GoogleMapsPlatform::CustomQueryAuthenticationCredentials

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:) ⇒ CustomQueryAuthenticationCredentials

Returns a new instance of CustomQueryAuthenticationCredentials.

Raises:

  • (ArgumentError)


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

#keyObject (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_envObject



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