Class: Square::BearerAuthCredentials

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

Overview

Data class for BearerAuthCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:) ⇒ BearerAuthCredentials

Returns a new instance of BearerAuthCredentials.

Raises:

  • (ArgumentError)


26
27
28
29
30
# File 'lib/square/http/auth/o_auth2.rb', line 26

def initialize(access_token:)
  raise ArgumentError, 'access_token cannot be nil' if access_token.nil?

  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



24
25
26
# File 'lib/square/http/auth/o_auth2.rb', line 24

def access_token
  @access_token
end

Instance Method Details

#clone_with(access_token: nil) ⇒ Object



32
33
34
35
36
# File 'lib/square/http/auth/o_auth2.rb', line 32

def clone_with(access_token: nil)
  access_token ||= self.access_token

  BearerAuthCredentials.new(access_token: access_token)
end