Class: ShellEv::ClientCredentialsAuthCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/shell_ev/http/auth/o_auth2.rb

Overview

Data class for ClientCredentialsAuthCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil, o_auth_token_provider: nil, o_auth_on_token_update: nil, o_auth_clock_skew: nil) ⇒ ClientCredentialsAuthCredentials

Returns a new instance of ClientCredentialsAuthCredentials.

Raises:

  • (ArgumentError)


101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 101

def initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil,
               o_auth_token_provider: nil, o_auth_on_token_update: nil,
               o_auth_clock_skew: nil)
  raise ArgumentError, 'o_auth_client_id cannot be nil' if o_auth_client_id.nil?
  raise ArgumentError, 'o_auth_client_secret cannot be nil' if o_auth_client_secret.nil?

  @o_auth_client_id = o_auth_client_id
  @o_auth_client_secret = o_auth_client_secret
  @o_auth_token = o_auth_token
  @o_auth_token_provider = o_auth_token_provider
  @o_auth_on_token_update = o_auth_on_token_update
  @o_auth_clock_skew = o_auth_clock_skew
end

Instance Attribute Details

#o_auth_client_idObject (readonly)

Returns the value of attribute o_auth_client_id.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_client_id
  @o_auth_client_id
end

#o_auth_client_secretObject (readonly)

Returns the value of attribute o_auth_client_secret.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_client_secret
  @o_auth_client_secret
end

#o_auth_clock_skewObject (readonly)

Returns the value of attribute o_auth_clock_skew.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_clock_skew
  @o_auth_clock_skew
end

#o_auth_on_token_updateObject (readonly)

Returns the value of attribute o_auth_on_token_update.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_on_token_update
  @o_auth_on_token_update
end

#o_auth_tokenObject (readonly)

Returns the value of attribute o_auth_token.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_token
  @o_auth_token
end

#o_auth_token_providerObject (readonly)

Returns the value of attribute o_auth_token_provider.



97
98
99
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 97

def o_auth_token_provider
  @o_auth_token_provider
end

Instance Method Details

#clone_with(o_auth_client_id: nil, o_auth_client_secret: nil, o_auth_token: nil, o_auth_token_provider: nil, o_auth_on_token_update: nil, o_auth_clock_skew: nil) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/shell_ev/http/auth/o_auth2.rb', line 115

def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
               o_auth_token: nil, o_auth_token_provider: nil,
               o_auth_on_token_update: nil, o_auth_clock_skew: nil)
  o_auth_client_id ||= self.o_auth_client_id
  o_auth_client_secret ||= self.o_auth_client_secret
  o_auth_token ||= self.o_auth_token
  o_auth_token_provider ||= self.o_auth_token_provider
  o_auth_on_token_update ||= self.o_auth_on_token_update
  o_auth_clock_skew ||= self.o_auth_clock_skew

  ClientCredentialsAuthCredentials.new(
    o_auth_client_id: o_auth_client_id,
    o_auth_client_secret: o_auth_client_secret, o_auth_token: o_auth_token,
    o_auth_token_provider: o_auth_token_provider,
    o_auth_on_token_update: o_auth_on_token_update,
    o_auth_clock_skew: o_auth_clock_skew
  )
end