Class: MercadoPago::CustomCheckout::Customer
- Inherits:
-
Object
- Object
- MercadoPago::CustomCheckout::Customer
- Defined in:
- lib/mercadopago/custom_checkout/customer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#create_customer(payload = {}) ⇒ Object
Create a customer.
-
#create_customer_card(customer_id, payload = {}) ⇒ Object
Create a customer card.
-
#delete_customer(customer_id) ⇒ Object
Delete a customer.
-
#retrieve_customer(customer_id) ⇒ Object
Retrieve a customer.
-
#retrieve_customer_cards(customer_id) ⇒ Object
Retrieves all customer cards.
-
#update_customer(customer_id, payload = {}) ⇒ Object
Update a customer.
Class Method Details
.search(payload = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 5 def self.search(payload = {}) payload = payload.merge(access_token: @access_token) MercadoPago::Core::Request.get_request( "/v1/customers/search", payload ) end |
Instance Method Details
#create_customer(payload = {}) ⇒ Object
Create a customer.
-
payload: Contains the data required to create the customer.
17 18 19 20 21 22 23 24 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 17 def create_customer(payload = {}) payload = MultiJson.dump(payload) MercadoPago::Core::Request.post_request( "/v1/customers?access_token=#{@access_token}", payload ) end |
#create_customer_card(customer_id, payload = {}) ⇒ Object
Create a customer card.
-
customer_id: The ID of the customer to retrieve the cards.
74 75 76 77 78 79 80 81 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 74 def create_customer_card(customer_id, payload = {}) payload = MultiJson.dump(payload) MercadoPago::Core::Request.post_request( "/v1/customers/#{customer_id}/cards?access_token=#{@access_token}", payload ) end |
#delete_customer(customer_id) ⇒ Object
Delete a customer.
-
customer_id: The ID of the customer to be deleted.
52 53 54 55 56 57 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 52 def delete_customer(customer_id) MercadoPago::Core::Request.delete_request( "/v1/customers/#{customer_id}", { access_token: @access_token } ) end |
#retrieve_customer(customer_id) ⇒ Object
Retrieve a customer.
-
customer_id: The ID of the customer to be retrieved.
29 30 31 32 33 34 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 29 def retrieve_customer(customer_id) MercadoPago::Core::Request.get_request( "/v1/customers/#{customer_id}", { access_token: @access_token } ) end |
#retrieve_customer_cards(customer_id) ⇒ Object
Retrieves all customer cards.
-
customer_id: The ID of the customer to retrieve the cards.
64 65 66 67 68 69 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 64 def retrieve_customer_cards(customer_id) MercadoPago::Core::Request.get_request( "/v1/customers/#{customer_id}/cards", { access_token: @access_token } ) end |
#update_customer(customer_id, payload = {}) ⇒ Object
Update a customer.
-
customer_id: The ID of the customer to be updated.
-
payload: Contains the data required to update the customer.
40 41 42 43 44 45 46 47 |
# File 'lib/mercadopago/custom_checkout/customer.rb', line 40 def update_customer(customer_id, payload = {}) payload = MultiJson.dump(payload) MercadoPago::Core::Request.put_request( "/v1/customers/#{customer_id}?access_token=#{@access_token}", payload ) end |