Class: Verizon::ThingspaceOauthCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/verizon/http/auth/thingspace_oauth.rb

Overview

Data class for ThingspaceOauthCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil) ⇒ ThingspaceOauthCredentials

Returns a new instance of ThingspaceOauthCredentials.

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
76
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 69

def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil)
  raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil?
  raise ArgumentError, 'oauth_client_secret cannot be nil' if oauth_client_secret.nil?

  @oauth_client_id = oauth_client_id
  @oauth_client_secret = oauth_client_secret
  @oauth_token = oauth_token
end

Instance Attribute Details

#oauth_client_idObject (readonly)

Returns the value of attribute oauth_client_id.



67
68
69
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 67

def oauth_client_id
  @oauth_client_id
end

#oauth_client_secretObject (readonly)

Returns the value of attribute oauth_client_secret.



67
68
69
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 67

def oauth_client_secret
  @oauth_client_secret
end

#oauth_tokenObject (readonly)

Returns the value of attribute oauth_token.



67
68
69
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 67

def oauth_token
  @oauth_token
end

Instance Method Details

#clone_with(oauth_client_id: nil, oauth_client_secret: nil, oauth_token: nil) ⇒ Object



78
79
80
81
82
83
84
85
86
87
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 78

def clone_with(oauth_client_id: nil, oauth_client_secret: nil,
               oauth_token: nil)
  oauth_client_id ||= self.oauth_client_id
  oauth_client_secret ||= self.oauth_client_secret
  oauth_token ||= self.oauth_token

  ThingspaceOauthCredentials.new(oauth_client_id: oauth_client_id,
                                 oauth_client_secret: oauth_client_secret,
                                 oauth_token: oauth_token)
end