Class: MercadoPago::Core::Client
- Inherits:
-
Object
- Object
- MercadoPago::Core::Client
- Defined in:
- lib/mercadopago/core/client.rb
Constant Summary collapse
- API_VERSION =
"v1".freeze
Instance Attribute Summary collapse
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #call(resource, action, data = {}) ⇒ Object
-
#initialize(public_key = nil, access_token = nil) ⇒ Client
constructor
Creates an instance to make calls to the MercadoPago CustomCheckout API.
Constructor Details
#initialize(public_key = nil, access_token = nil) ⇒ Client
Creates an instance to make calls to the MercadoPago CustomCheckout API.
8 9 10 11 12 13 14 15 |
# File 'lib/mercadopago/core/client.rb', line 8 def initialize(public_key = nil, access_token = nil) check_credentials!(public_key, access_token) @access_token = access_token if access_token @public_key = public_key if public_key @gateway = MercadoPago::Core::Gateway @version = API_VERSION end |
Instance Attribute Details
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
4 5 6 |
# File 'lib/mercadopago/core/client.rb', line 4 def public_key @public_key end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/mercadopago/core/client.rb', line 4 def version @version end |
Instance Method Details
#call(resource, action, data = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/mercadopago/core/client.rb', line 17 def call(resource, action, data = {}) request = request_for!(resource.to_sym, action.to_sym) endpoint_path, payload = build_endpoint_path(request, data) @gateway.send(request[:method], endpoint_path, payload) end |