Class: OpenpayApi
- Inherits:
-
Object
- Object
- OpenpayApi
- Defined in:
- lib/openpay/openpay_api.rb
Constant Summary collapse
- API_DEV =
API Endpoints
'https://sandbox-api.openpay.mx/v1/'- API_PROD =
'https://api.openpay.mx/v1/'
Class Method Summary collapse
Instance Method Summary collapse
- #create(resource) ⇒ Object
- #env ⇒ Object
-
#initialize(merchant_id, private_key, production = false, timeout = 90) ⇒ OpenpayApi
constructor
by default testing environment is used.
Constructor Details
#initialize(merchant_id, private_key, production = false, timeout = 90) ⇒ OpenpayApi
by default testing environment is used
20 21 22 23 24 25 |
# File 'lib/openpay/openpay_api.rb', line 20 def initialize(merchant_id, private_key, production=false, timeout=90) @merchant_id=merchant_id @private_key=private_key @production=production @timeout=timeout end |
Class Method Details
.base_url(production) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/openpay/openpay_api.rb', line 33 def OpenpayApi::base_url(production) if production API_PROD else API_DEV end end |
Instance Method Details
#create(resource) ⇒ Object
27 28 29 30 31 |
# File 'lib/openpay/openpay_api.rb', line 27 def create(resource) klass=OpenPayResourceFactory::create(resource, @merchant_id, @private_key, @production, @timeout) klass.api_hook=self klass end |
#env ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/openpay/openpay_api.rb', line 41 def env if @production :production else :test end end |