lib/currency_cloud/session.rb in currency_cloud-0.5 vs lib/currency_cloud/session.rb in currency_cloud-0.7
- old
+ new
@@ -5,15 +5,15 @@
Environments = { :production => 'https://api.thecurrencycloud.com',
:demonstration => 'https://devapi.thecurrencycloud.com',
:uat => 'https://api-uat1.ccycloud.com'}
attr_reader :environment, :login_id, :api_key
- attr_accessor :token
+ attr_accessor :token, :on_behalf_of
def self.validate_environment(environment)
unless Environments.keys.include?(environment)
- raise CurrencyCloud::ConfigError, "'#{environment}' is not a valid environment, must be one of: #{Environments.keys.join(", ")}"
+ raise CurrencyCloud::GeneralError, "'#{environment}' is not a valid environment, must be one of: #{Environments.keys.join(", ")}"
end
end
def initialize(environment, login_id, api_key, token)
@environment = environment
@@ -49,11 +49,11 @@
end
private
def validate
self.class.validate_environment(environment)
- raise CurrencyCloud::ConfigError, "login_id must be set using CurrencyCloud.login_id=" unless login_id
- raise CurrencyCloud::ConfigError, "api_key must be set using CurrencyCloud.api_key=" unless api_key
+ raise CurrencyCloud::GeneralError, "login_id must be set using CurrencyCloud.login_id=" unless login_id
+ raise CurrencyCloud::GeneralError, "api_key must be set using CurrencyCloud.api_key=" unless api_key
end
def request
RequestHandler.new(self)
end
\ No newline at end of file