Class: Mercadopago::Preapproval

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

Overview

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

Raises:

  • (TypeError)


24
25
26
27
28
# File 'lib/mercadopago/resources/preapproval.rb', line 24

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

  _post(uri: '/preapproval/', data: preapproval_data, request_options: request_options)
end

#get(preapproval_id, request_options: nil) ⇒ Object



20
21
22
# File 'lib/mercadopago/resources/preapproval.rb', line 20

def get(preapproval_id, request_options: nil)
  _get(uri: "/preapproval/#{preapproval_id}", request_options: request_options)
end

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

Raises:

  • (TypeError)


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

def search(filters: nil, request_options: nil)
  raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)

  _get(uri: '/preapproval/search', filters: filters, request_options: request_options)
end

#update(preapproval_id, preapproval_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


30
31
32
33
34
# File 'lib/mercadopago/resources/preapproval.rb', line 30

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

  _put(uri: "/preapproval/#{preapproval_id}", data: preapproval_data, request_options: request_options)
end