Class: SpotifyWebApi::AuthorizationCodeAuthCredentials

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

Overview

Data class for AuthorizationCodeAuthCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_redirect_uri:, o_auth_token: nil, o_auth_scopes: nil) ⇒ AuthorizationCodeAuthCredentials

Returns a new instance of AuthorizationCodeAuthCredentials.

Raises:

  • (ArgumentError)


116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 116

def initialize(o_auth_client_id:, o_auth_client_secret:,
               o_auth_redirect_uri:, o_auth_token: nil, o_auth_scopes: 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_redirect_uri cannot be nil' if o_auth_redirect_uri.nil?

  @o_auth_client_id = o_auth_client_id
  @o_auth_client_secret = o_auth_client_secret
  @o_auth_redirect_uri = o_auth_redirect_uri
  @o_auth_token = o_auth_token
  @o_auth_scopes = o_auth_scopes
end

Instance Attribute Details

#o_auth_client_idObject (readonly)

Returns the value of attribute o_auth_client_id.



113
114
115
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 113

def o_auth_client_id
  @o_auth_client_id
end

#o_auth_client_secretObject (readonly)

Returns the value of attribute o_auth_client_secret.



113
114
115
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 113

def o_auth_client_secret
  @o_auth_client_secret
end

#o_auth_redirect_uriObject (readonly)

Returns the value of attribute o_auth_redirect_uri.



113
114
115
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 113

def o_auth_redirect_uri
  @o_auth_redirect_uri
end

#o_auth_scopesObject (readonly)

Returns the value of attribute o_auth_scopes.



113
114
115
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 113

def o_auth_scopes
  @o_auth_scopes
end

#o_auth_tokenObject (readonly)

Returns the value of attribute o_auth_token.



113
114
115
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 113

def o_auth_token
  @o_auth_token
end

Instance Method Details

#clone_with(o_auth_client_id: nil, o_auth_client_secret: nil, o_auth_redirect_uri: nil, o_auth_token: nil, o_auth_scopes: nil) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/spotify_web_api/http/auth/o_auth2.rb', line 129

def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
               o_auth_redirect_uri: nil, o_auth_token: nil,
               o_auth_scopes: nil)
  o_auth_client_id ||= self.o_auth_client_id
  o_auth_client_secret ||= self.o_auth_client_secret
  o_auth_redirect_uri ||= self.o_auth_redirect_uri
  o_auth_token ||= self.o_auth_token
  o_auth_scopes ||= self.o_auth_scopes

  AuthorizationCodeAuthCredentials.new(
    o_auth_client_id: o_auth_client_id,
    o_auth_client_secret: o_auth_client_secret,
    o_auth_redirect_uri: o_auth_redirect_uri, o_auth_token: o_auth_token,
    o_auth_scopes: o_auth_scopes
  )
end