2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/openpay/open_pay_resource_factory.rb', line 2
def OpenPayResourceFactory::create(resource, merchant_id, private_key, production, timeout, country)
begin
resource = resource.capitalize
if country == "co"
resource = "#{resource}Co".to_sym
end
if country == "pe"
resource = "#{resource}Pe".to_sym
end
Object.const_get(resource).new(merchant_id, private_key, production, timeout, country)
rescue NameError
raise OpenpayException.new("Invalid resource name:#{resource}", false)
end
end
|