class PaymentRails::RecipientAccountGateway
Public Class Methods
new(client)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 8 def initialize(client) @client = client end
Public Instance Methods
all(recipient_id)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 17 def all(recipient_id) response = @client.get('/v1/recipients/' + recipient_id + '/accounts/') recipient_account_list_builder(response) end
create(recipient_id, body)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 22 def create(recipient_id, body) response = @client.post('/v1/recipients/' + recipient_id + '/accounts', body) recipient_account_builder(response) end
delete(recipient_id, recipient_account_id)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 32 def delete(recipient_id, recipient_account_id) @client.delete('/v1/recipients/' + recipient_id + '/accounts/' + recipient_account_id) true end
find(recipient_id, recipient_account_id)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 12 def find(recipient_id, recipient_account_id) response = @client.get('/v1/recipients/' + recipient_id + '/accounts/' + recipient_account_id) recipient_account_builder(response) end
recipient_account_builder(response)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 37 def recipient_account_builder(response) recipient_account = RecipientAccount.new data = JSON.parse(response) data.each do |key, value| next unless key === 'account' loosely_hydrate_model(recipient_account, value) end recipient_account end
recipient_account_list_builder(response)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 47 def recipient_account_list_builder(response) recipient_accounts = [] data = JSON.parse(response) data.each do |key, value| next unless key === 'accounts' value.each do |newKey, _newValue| recipient_account = loosely_hydrate_model(RecipientAccount.new, newKey) recipient_accounts.push(recipient_account) end end recipient_accounts end
update(recipient_id, recipient_account_id, body)
click to toggle source
# File lib/paymentrails/gateways/RecipientAccountGateway.rb, line 27 def update(recipient_id, recipient_account_id, body) response = @client.patch('/v1/recipients/' + recipient_id + '/accounts/' + recipient_account_id, body) recipient_account_builder(response) end