Module: MangoApi::Wallets
- Extended by:
- UriProvider
- Defined in:
- lib/mangopay/api/service/wallets.rb
Overview
Provides API method delegates concerning the Wallet
entity.
Class Method Summary collapse
-
.create(wallet, id_key = nil) ⇒ Wallet
Creates a new wallet entity.
-
.get(id) ⇒ Wallet
Retrieves a wallet entity.
-
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of wallet entities belonging to a certain user entity.
-
.update(wallet) ⇒ Wallet
Updates the wallet entity identifiable by the provided wallet object’s ID.
Methods included from UriProvider
Class Method Details
.create(wallet, id_key = nil) ⇒ Wallet
Creates a new wallet entity.
Wallet
properties:
-
Required
-
owners
-
description
-
currency
-
-
Optional
-
tag
-
24 25 26 27 28 |
# File 'lib/mangopay/api/service/wallets.rb', line 24 def create(wallet, id_key = nil) uri = provide_uri(:create_wallet) response = HttpClient.post(uri, wallet, id_key) parse response end |
.get(id) ⇒ Wallet
Retrieves a wallet entity.
50 51 52 53 54 |
# File 'lib/mangopay/api/service/wallets.rb', line 50 def get(id) uri = provide_uri(:get_wallet, id) response = HttpClient.get(uri) parse response end |
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of wallet entities belonging to a certain user entity. 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
68 69 70 71 72 73 74 |
# File 'lib/mangopay/api/service/wallets.rb', line 68 def of_user(id) uri = provide_uri(:get_users_wallets, id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end |
.update(wallet) ⇒ Wallet
Updates the wallet entity identifiable by the provided wallet object’s ID.
Wallet
optional properties:
-
tag
-
description
and updated data
40 41 42 43 44 |
# File 'lib/mangopay/api/service/wallets.rb', line 40 def update(wallet) uri = provide_uri(:update_wallet, wallet) response = HttpClient.put(uri, wallet) parse response end |