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, oauth_scopes: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: nil) ⇒ ThingspaceOauthCredentials

Returns a new instance of ThingspaceOauthCredentials.

Raises:

  • (ArgumentError)


104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 104

def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil,
               oauth_scopes: nil, oauth_token_provider: nil,
               oauth_on_token_update: nil, oauth_clock_skew: 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
  @oauth_scopes = oauth_scopes
  @oauth_token_provider = oauth_token_provider
  @oauth_on_token_update = oauth_on_token_update
  @oauth_clock_skew = oauth_clock_skew
end

Instance Attribute Details

#oauth_client_idObject (readonly)

Returns the value of attribute oauth_client_id.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_client_id
  @oauth_client_id
end

#oauth_client_secretObject (readonly)

Returns the value of attribute oauth_client_secret.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_client_secret
  @oauth_client_secret
end

#oauth_clock_skewObject (readonly)

Returns the value of attribute oauth_clock_skew.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_clock_skew
  @oauth_clock_skew
end

#oauth_on_token_updateObject (readonly)

Returns the value of attribute oauth_on_token_update.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_on_token_update
  @oauth_on_token_update
end

#oauth_scopesObject (readonly)

Returns the value of attribute oauth_scopes.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_scopes
  @oauth_scopes
end

#oauth_tokenObject (readonly)

Returns the value of attribute oauth_token.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_token
  @oauth_token
end

#oauth_token_providerObject (readonly)

Returns the value of attribute oauth_token_provider.



100
101
102
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 100

def oauth_token_provider
  @oauth_token_provider
end

Instance Method Details

#clone_with(oauth_client_id: nil, oauth_client_secret: nil, oauth_token: nil, oauth_scopes: nil, oauth_token_provider: nil, oauth_on_token_update: nil, oauth_clock_skew: nil) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/verizon/http/auth/thingspace_oauth.rb', line 119

def clone_with(oauth_client_id: nil, oauth_client_secret: nil,
               oauth_token: nil, oauth_scopes: nil,
               oauth_token_provider: nil, oauth_on_token_update: nil,
               oauth_clock_skew: nil)
  oauth_client_id ||= self.oauth_client_id
  oauth_client_secret ||= self.oauth_client_secret
  oauth_token ||= self.oauth_token
  oauth_scopes ||= self.oauth_scopes
  oauth_token_provider ||= self.oauth_token_provider
  oauth_on_token_update ||= self.oauth_on_token_update
  oauth_clock_skew ||= self.oauth_clock_skew

  ThingspaceOauthCredentials.new(
    oauth_client_id: oauth_client_id,
    oauth_client_secret: oauth_client_secret, oauth_token: oauth_token,
    oauth_scopes: oauth_scopes, oauth_token_provider: oauth_token_provider,
    oauth_on_token_update: oauth_on_token_update,
    oauth_clock_skew: oauth_clock_skew
  )
end