Class: AbacatePay::Configuration
- Inherits:
-
Object
- Object
- AbacatePay::Configuration
- Defined in:
- lib/abacate_pay/configuration.rb
Overview
Configuration class for the AbacatePay SDK
This class handles all configuration options for the SDK, including API credentials and request behaviour.
Constant Summary collapse
- API_BASE_URL =
The only base URL AbacatePay serves. The v1 prefix was retired and now answers
{"error":"Not found"}for every path, so there is nothing to negotiate between. "https://api.abacatepay.com/v2"
Instance Attribute Summary collapse
-
#api_token ⇒ String
API token for authentication.
-
#environment ⇒ nil
deprecated
Deprecated.
The environment is determined by the API key itself — keys created in Dev mode produce simulated transactions, production keys produce real ones. This setting has never had any effect and is kept only so existing initializers keep loading.
-
#timeout ⇒ Integer
Request timeout in seconds.
Instance Method Summary collapse
-
#api_url ⇒ String
Gets the base API URL.
-
#initialize ⇒ Configuration
constructor
Initialize a new configuration with default values.
-
#validate! ⇒ void
Validates the configuration.
Constructor Details
#initialize ⇒ Configuration
Initialize a new configuration with default values
25 26 27 28 |
# File 'lib/abacate_pay/configuration.rb', line 25 def initialize @timeout = 30 @api_token = nil end |
Instance Attribute Details
#api_token ⇒ String
Returns API token for authentication.
17 18 19 |
# File 'lib/abacate_pay/configuration.rb', line 17 def api_token @api_token end |
#environment ⇒ nil
The environment is determined by the API key itself — keys created in Dev mode produce simulated transactions, production keys produce real ones. This setting has never had any effect and is kept only so existing initializers keep loading.
35 36 37 |
# File 'lib/abacate_pay/configuration.rb', line 35 def environment @environment end |
#timeout ⇒ Integer
Returns Request timeout in seconds.
20 21 22 |
# File 'lib/abacate_pay/configuration.rb', line 20 def timeout @timeout end |
Instance Method Details
#api_url ⇒ String
Gets the base API URL
63 64 65 |
# File 'lib/abacate_pay/configuration.rb', line 63 def api_url API_BASE_URL end |
#validate! ⇒ void
This method returns an undefined value.
Validates the configuration
53 54 55 56 |
# File 'lib/abacate_pay/configuration.rb', line 53 def validate! raise ConfigurationError, "API token is required" if api_token.nil? raise ConfigurationError, "API token must not be empty" if api_token.to_s.strip.empty? end |