Class: Mercadopago::Preference

Inherits:
MPBase
  • Object
show all
Defined in:
lib/mercadopago/resources/preference.rb

Overview

This class will allow you to charge your customers through our web form from any device in a simple, fast and secure way. [Click here for more infos](www.mercadopago.com.br/developers/en/guides/online-payments/checkout-pro/introduction)

Instance Method Summary collapse

Methods inherited from MPBase

#_check_headers, #_check_request_options, #_delete, #_get, #_post, #_put, #initialize

Constructor Details

This class inherits a constructor from Mercadopago::MPBase

Instance Method Details

#create(preference_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


14
15
16
17
18
# File 'lib/mercadopago/resources/preference.rb', line 14

def create(preference_data, request_options: nil)
  raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash)

  _post(uri: '/checkout/preferences', data: preference_data, request_options: request_options)
end

#get(preference_id, request_options: nil) ⇒ Object



10
11
12
# File 'lib/mercadopago/resources/preference.rb', line 10

def get(preference_id, request_options: nil)
  _get(uri: "/checkout/preferences/#{preference_id}", request_options: request_options)
end

#update(preference_id, preference_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


20
21
22
23
24
# File 'lib/mercadopago/resources/preference.rb', line 20

def update(preference_id, preference_data, request_options: nil)
  raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash)

  _put(uri: "/checkout/preferences/#{preference_id}", data: preference_data, request_options: request_options)
end