Class: Mercadopago::Customer

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

Overview

This will allow your customer to complete their purchases much faster and easily when used in conjunction with the Cards class. [Click here for more infos](mercadopago.com.br/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards)

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(customer_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


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

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

  _post(uri: '/v1/customers', data: customer_data, request_options: request_options)
end

#delete(customer_id, request_options: nil) ⇒ Object



32
33
34
# File 'lib/mercadopago/resources/customer.rb', line 32

def delete(customer_id, request_options: nil)
  _delete(uri: "/v1/customers/#{customer_id}", request_options: request_options)
end

#get(customer_id, request_options: nil) ⇒ Object



16
17
18
# File 'lib/mercadopago/resources/customer.rb', line 16

def get(customer_id, request_options: nil)
  _get(uri: "/v1/customers/#{customer_id}", request_options: request_options)
end

#search(filters: nil, request_options: nil) ⇒ Object



12
13
14
# File 'lib/mercadopago/resources/customer.rb', line 12

def search(filters: nil, request_options: nil)
  _get(uri: '/v1/customers/search', filters: filters, request_options: request_options)
end

#update(customer_id, customer_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


26
27
28
29
30
# File 'lib/mercadopago/resources/customer.rb', line 26

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

  _put(uri: "/v1/customers/#{customer_id}", data: customer_data, request_options: request_options)
end