Class: Charging::Configuration
- Inherits:
-
Object
- Object
- Charging::Configuration
- Defined in:
- lib/charging/configuration.rb
Instance Attribute Summary collapse
-
#application_token ⇒ Object
Returns the value of attribute application_token.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #credentials_for(token = application_token) ⇒ Object
-
#initialize(application_token = nil) ⇒ Configuration
constructor
A new instance of Configuration.
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_token ⇒ Object
Returns the value of attribute application_token.
6 7 8 |
# File 'lib/charging/configuration.rb', line 6 def application_token @application_token end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/charging/configuration.rb', line 6 def url @url end |
#user_agent ⇒ Object
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 |