class Revolut::Configuration
A class responsible for all configurations.
Constants
- AVAILABLE_ENVIRONMENTS
- DEFAULT_ENVIRONMENT
- PRODUCTION_API_ENDPOINT
- SANDBOX_API_ENDPOINT
- USER_AGENT
Attributes
api_key[RW]
url[W]
user_agent[W]
Public Instance Methods
environment()
click to toggle source
Takes environment from configuration or uses default one. It will be used to set url automatically.
@return [Symbol] Environment which will be used to set url.
# File lib/revolut/configuration.rb, line 40 def environment @environment || DEFAULT_ENVIRONMENT end
environment=(environment)
click to toggle source
Sets environment which will be used for url.
@return [Symbol] Environment which will be used to set url.
# File lib/revolut/configuration.rb, line 47 def environment=(environment) env_sym = environment.is_a?(String) ? environment.to_sym : environment raise Revolut::Error, 'Invalid environment provided.' unless AVAILABLE_ENVIRONMENTS.include?(env_sym) @environment = env_sym end
url()
click to toggle source
Takes url provided from configuration or uses default one.
@return [String] An API Endpoint url which will be used for connection.
# File lib/revolut/configuration.rb, line 18 def url return @url if @url case environment when :production PRODUCTION_API_ENDPOINT when :sandbox SANDBOX_API_ENDPOINT end end
user_agent()
click to toggle source
Takes user agent from configuration or uses default one.
@return [String] User agent which will be used for connection headers.
# File lib/revolut/configuration.rb, line 32 def user_agent @user_agent || USER_AGENT end