Class: Charging::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/charging/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application_token = nil) ⇒ Configuration

Returns a new instance of Configuration.



8
9
10
11
12
# File 'lib/charging/configuration.rb', line 8

def initialize(application_token = nil)
  @application_token = application_token
  @url = 'https://charging.financeconnect.com.br'
  @user_agent = "Charging Ruby Client v#{Charging::VERSION}"
end

Instance Attribute Details

#application_tokenObject

Returns the value of attribute application_token.



6
7
8
# File 'lib/charging/configuration.rb', line 6

def application_token
  @application_token
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/charging/configuration.rb', line 6

def url
  @url
end

#user_agentObject

Returns the value of attribute user_agent.



6
7
8
# File 'lib/charging/configuration.rb', line 6

def user_agent
  @user_agent
end

Instance Method Details

#credentials_for(token = application_token) ⇒ Object



14
15
16
17
18
# File 'lib/charging/configuration.rb', line 14

def credentials_for(token = application_token)
  check_valid_token!(token)
  encrypted_token = ::Base64.strict_encode64(":#{token}")
  "Basic #{encrypted_token}"
end