Class: Solidgate::Configuration
- Inherits:
-
Object
- Object
- Solidgate::Configuration
- Defined in:
- lib/solidgate/configuration.rb
Overview
Configuration class for the Solidgate SDK
Constant Summary collapse
- PRODUCTION_URL =
Production API URL
"https://subscriptions.solidgate.com"- SANDBOX_URL =
Sandbox API URL
"https://subscriptions.solidgate.com"
Instance Attribute Summary collapse
-
#api_url ⇒ String
Get the appropriate API URL based on sandbox setting.
-
#open_timeout ⇒ Integer
Connection timeout in seconds.
-
#private_key ⇒ String
Solidgate private key.
-
#public_key ⇒ String
Solidgate public key.
-
#sandbox ⇒ Boolean
Whether to use sandbox environment.
-
#timeout ⇒ Integer
Request timeout in seconds.
-
#user_agent ⇒ String
Custom user agent.
-
#webhook_private_key ⇒ String
Webhook private key.
-
#webhook_public_key ⇒ String
Webhook public key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#sandbox? ⇒ Boolean
Check if sandbox mode is enabled.
-
#validate! ⇒ Object
Validate that required configuration is present.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
48 49 50 51 52 53 |
# File 'lib/solidgate/configuration.rb', line 48 def initialize @sandbox = false @timeout = 30 @open_timeout = 10 @user_agent = "Solidgate Ruby SDK/#{VERSION}" end |
Instance Attribute Details
#api_url ⇒ String
Get the appropriate API URL based on sandbox setting
20 21 22 |
# File 'lib/solidgate/configuration.rb', line 20 def api_url @api_url end |
#open_timeout ⇒ Integer
Returns connection timeout in seconds.
28 29 30 |
# File 'lib/solidgate/configuration.rb', line 28 def open_timeout @open_timeout end |
#private_key ⇒ String
Returns Solidgate private key.
12 13 14 |
# File 'lib/solidgate/configuration.rb', line 12 def private_key @private_key end |
#public_key ⇒ String
Returns Solidgate public key.
8 9 10 |
# File 'lib/solidgate/configuration.rb', line 8 def public_key @public_key end |
#sandbox ⇒ Boolean
Returns whether to use sandbox environment.
16 17 18 |
# File 'lib/solidgate/configuration.rb', line 16 def sandbox @sandbox end |
#timeout ⇒ Integer
Returns request timeout in seconds.
24 25 26 |
# File 'lib/solidgate/configuration.rb', line 24 def timeout @timeout end |
#user_agent ⇒ String
Returns custom user agent.
32 33 34 |
# File 'lib/solidgate/configuration.rb', line 32 def user_agent @user_agent end |
#webhook_private_key ⇒ String
Returns Webhook private key.
40 41 42 |
# File 'lib/solidgate/configuration.rb', line 40 def webhook_private_key @webhook_private_key end |
#webhook_public_key ⇒ String
Returns Webhook public key.
36 37 38 |
# File 'lib/solidgate/configuration.rb', line 36 def webhook_public_key @webhook_public_key end |
Instance Method Details
#sandbox? ⇒ Boolean
Check if sandbox mode is enabled
65 66 67 |
# File 'lib/solidgate/configuration.rb', line 65 def sandbox? @sandbox end |
#validate! ⇒ Object
Validate that required configuration is present
72 73 74 75 |
# File 'lib/solidgate/configuration.rb', line 72 def validate! raise ConfigurationError, "public_key is required" unless public_key raise ConfigurationError, "private_key is required" unless private_key end |