module MangoApi::ClientWallets
Provides API method delegates concerning the ClientWallet
entity
Public Class Methods
Retrieves client wallet entities. 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
@return [Array] array of hashed client wallet entities corresponding to provided filters
# File lib/mangopay/api/service/client_wallets.rb, line 35 def all uri = provide_uri(:get_client_wallets) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end
Retrieves a client wallet entity. Client wallet entity of provided funds' type and currency will be created if it does not yet exist.
@param funds_type
[FundsType] funds' type of the wallet to retrieve @param currency
[CurrencyIso] currency of the wallet to retrieve @return [ClientWallet] the corresponding ClientWallet entity object
# File lib/mangopay/api/service/client_wallets.rb, line 17 def get(funds_type, currency) uri = provide_uri(:get_client_wallet, funds_type, currency) response = HttpClient.get(uri) parse response end
Retrieves client wallet entities of a certain funds type. 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
@param funds_type
[FundsType] funds' type of the client wallets to retrieve @return [Array] array of hashed client wallet entities corresponding to provided filters
# File lib/mangopay/api/service/client_wallets.rb, line 58 def of_funds_type(funds_type) uri = provide_uri(:get_client_wallets_funds_type, funds_type) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end
Private Class Methods
Parses a JSON-originating hash into the corresponding ClientWallet entity object.
@param response
[Hash] JSON-originating data hash @return [ClientWallet] corresponding ClientWallet entity object
# File lib/mangopay/api/service/client_wallets.rb, line 84 def parse(response) MangoModel::ClientWallet.new.dejsonify response end
Parses an array of JSON-originating hashes into the corresponding ClientWallet entity objects.
@param results
[Array] JSON-originating data hashes @return [Array] parsed ClientWallet entity objects
# File lib/mangopay/api/service/client_wallets.rb, line 73 def parse_results(results) results.collect do |entity| parse entity end end