Module: MangoApi::Mandates
- Extended by:
- UriProvider
- Defined in:
- lib/mangopay/api/service/mandates.rb
Overview
Provides API method delegates concerning the Mandate
entity
Class Method Summary collapse
-
.all {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves mandate entity pages.
-
.cancel(id) ⇒ Mandate
Cancels a mandate.
-
.create(mandate, id_key = nil) ⇒ Mandate
Creates a new mandate entity.
-
.get(id) ⇒ Mandate
Retrieves a mandate entity.
-
.of_bank_account(user_id, account_id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of mandate entities belonging to a certain bank account.
-
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of mandate entities belonging to a certain user.
Methods included from UriProvider
Class Method Details
.all {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves mandate entity pages. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
to provided filters
63 64 65 66 67 68 69 |
# File 'lib/mangopay/api/service/mandates.rb', line 63 def all uri = provide_uri(:get_mandates) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end |
.cancel(id) ⇒ Mandate
Cancels a mandate.
43 44 45 46 47 |
# File 'lib/mangopay/api/service/mandates.rb', line 43 def cancel(id) uri = provide_uri(:cancel_mandate, id) response = HttpClient.put(uri) parse response end |
.create(mandate, id_key = nil) ⇒ Mandate
Creates a new mandate entity.
Mandate
properties:
-
Required
-
bank_account_id
-
culture
-
return_url
-
-
Optional
-
tag
-
23 24 25 26 27 |
# File 'lib/mangopay/api/service/mandates.rb', line 23 def create(mandate, id_key = nil) uri = provide_uri(:create_mandate) response = HttpClient.post(uri, mandate, id_key) parse response end |
.get(id) ⇒ Mandate
Retrieves a mandate entity.
33 34 35 36 37 |
# File 'lib/mangopay/api/service/mandates.rb', line 33 def get(id) uri = provide_uri(:get_mandate, id) response = HttpClient.get(uri) parse response end |
.of_bank_account(user_id, account_id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of mandate entities belonging to a certain bank account. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
to retrieve to provided filters
111 112 113 114 115 116 117 |
# File 'lib/mangopay/api/service/mandates.rb', line 111 def of_bank_account(user_id, account_id) uri = provide_uri(:get_accounts_mandates, user_id, account_id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end |
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of mandate entities belonging to a certain user. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
to provided filters
86 87 88 89 90 91 92 |
# File 'lib/mangopay/api/service/mandates.rb', line 86 def of_user(id) uri = provide_uri(:get_users_mandates, id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end |