Class: ShellDataReportingApIs::BearerTokenCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb

Overview

Data class for BearerTokenCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil) ⇒ BearerTokenCredentials

Returns a new instance of BearerTokenCredentials.

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
76
# File 'lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb', line 69

def initialize(o_auth_client_id:, o_auth_client_secret:, 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?

  @o_auth_client_id = o_auth_client_id
  @o_auth_client_secret = o_auth_client_secret
  @o_auth_token = o_auth_token
end

Instance Attribute Details

#o_auth_client_idObject (readonly)

Returns the value of attribute o_auth_client_id.



67
68
69
# File 'lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb', line 67

def o_auth_client_id
  @o_auth_client_id
end

#o_auth_client_secretObject (readonly)

Returns the value of attribute o_auth_client_secret.



67
68
69
# File 'lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb', line 67

def o_auth_client_secret
  @o_auth_client_secret
end

#o_auth_tokenObject (readonly)

Returns the value of attribute o_auth_token.



67
68
69
# File 'lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb', line 67

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_token: nil) ⇒ Object



78
79
80
81
82
83
84
85
86
87
# File 'lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb', line 78

def clone_with(o_auth_client_id: nil, o_auth_client_secret: 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_token ||= self.o_auth_token

  BearerTokenCredentials.new(o_auth_client_id: o_auth_client_id,
                             o_auth_client_secret: o_auth_client_secret,
                             o_auth_token: o_auth_token)
end