Class: MultiAuthSample::OAuthROPCGCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_auth_sample/http/auth/o_auth_ropcg.rb

Overview

Data class for OAuthROPCGCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_username:, o_auth_password:, o_auth_token: nil) ⇒ OAuthROPCGCredentials

Returns a new instance of OAuthROPCGCredentials.

Raises:

  • (ArgumentError)


90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 90

def initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_username:,
               o_auth_password:, o_auth_token: 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?
  raise ArgumentError, 'o_auth_username cannot be nil' if o_auth_username.nil?
  raise ArgumentError, 'o_auth_password cannot be nil' if o_auth_password.nil?

  @o_auth_client_id = o_auth_client_id
  @o_auth_client_secret = o_auth_client_secret
  @o_auth_username = o_auth_username
  @o_auth_password = o_auth_password
  @o_auth_token = o_auth_token
end

Instance Attribute Details

#o_auth_client_idObject (readonly)

Returns the value of attribute o_auth_client_id.



87
88
89
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 87

def o_auth_client_id
  @o_auth_client_id
end

#o_auth_client_secretObject (readonly)

Returns the value of attribute o_auth_client_secret.



87
88
89
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 87

def o_auth_client_secret
  @o_auth_client_secret
end

#o_auth_passwordObject (readonly)

Returns the value of attribute o_auth_password.



87
88
89
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 87

def o_auth_password
  @o_auth_password
end

#o_auth_tokenObject (readonly)

Returns the value of attribute o_auth_token.



87
88
89
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 87

def o_auth_token
  @o_auth_token
end

#o_auth_usernameObject (readonly)

Returns the value of attribute o_auth_username.



87
88
89
# File 'lib/multi_auth_sample/http/auth/o_auth_ropcg.rb', line 87

def o_auth_username
  @o_auth_username
end

Instance Method Details

#clone_with(o_auth_client_id: nil, o_auth_client_secret: nil, o_auth_username: nil, o_auth_password: nil, o_auth_token: nil) ⇒ Object



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

def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
               o_auth_username: nil, o_auth_password: nil,
               o_auth_token: nil)
  o_auth_client_id ||= self.o_auth_client_id
  o_auth_client_secret ||= self.o_auth_client_secret
  o_auth_username ||= self.o_auth_username
  o_auth_password ||= self.o_auth_password
  o_auth_token ||= self.o_auth_token

  OAuthROPCGCredentials.new(o_auth_client_id: o_auth_client_id,
                            o_auth_client_secret: o_auth_client_secret,
                            o_auth_username: o_auth_username,
                            o_auth_password: o_auth_password,
                            o_auth_token: o_auth_token)
end