Sha256: 85d8b16c76bd1d579389693fb31863d9a1f8f5ba0043623c28e513ed1d15d155
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module MangoPay class BankAccount < Resource include MangoPay::HTTPCalls::Fetch class << self def create(user_id, params) type = params.fetch(:Type) { |no_symbol_key| params.fetch('Type') } MangoPay.request(:post, "#{url(user_id)}/#{type}", params) end # Fetches: # - list of bank accounts belonging to the given +user_id+ # - or single bank account belonging to the given +user_id+ with the given +bank_account_id+. # # In case of list query, optional +filters+ is a hash accepting pagination params # (+page+, +per_page+; see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch) # def fetch(user_id, bank_account_id_or_filters={}) bank_account_id, filters = MangoPay::HTTPCalls::Fetch.parse_id_or_filters(bank_account_id_or_filters) MangoPay.request(:get, url(user_id, bank_account_id), {}, filters) end def url(user_id, bank_account_id = nil) if bank_account_id "/v2/#{MangoPay.configuration.client_id}/users/#{CGI.escape(user_id.to_s)}/bankaccounts/#{CGI.escape(bank_account_id.to_s)}" else "/v2/#{MangoPay.configuration.client_id}/users/#{CGI.escape(user_id.to_s)}/bankaccounts" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mangopay-3.0.11 | lib/mangopay/bank_account.rb |
mangopay-3.0.10 | lib/mangopay/bank_account.rb |