Class: Trolley::RecipientAccountGateway
- Inherits:
-
Object
- Object
- Trolley::RecipientAccountGateway
- Defined in:
- lib/trolley/gateways/RecipientAccountGateway.rb
Instance Method Summary collapse
- #all(recipient_id) ⇒ Object
- #create(recipient_id, body) ⇒ Object
- #delete(recipient_id, recipient_account_id) ⇒ Object
- #find(recipient_id, recipient_account_id) ⇒ Object
-
#initialize(client) ⇒ RecipientAccountGateway
constructor
A new instance of RecipientAccountGateway.
- #recipient_account_builder(response) ⇒ Object
- #recipient_account_list_builder(response) ⇒ Object
- #update(recipient_id, recipient_account_id, body) ⇒ Object
Constructor Details
#initialize(client) ⇒ RecipientAccountGateway
Returns a new instance of RecipientAccountGateway.
5 6 7 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#all(recipient_id) ⇒ Object
14 15 16 17 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 14 def all(recipient_id) response = @client.get("/v1/recipients/#{recipient_id}/accounts/") recipient_account_list_builder(response) end |
#create(recipient_id, body) ⇒ Object
19 20 21 22 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 19 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) ⇒ Object
29 30 31 32 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 29 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) ⇒ Object
9 10 11 12 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 9 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) ⇒ Object
34 35 36 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 34 def recipient_account_builder(response) Utils::ResponseMapper.build(response, RecipientAccount) end |
#recipient_account_list_builder(response) ⇒ Object
38 39 40 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 38 def recipient_account_list_builder(response) Utils::PaginatedArray.from_response(response, RecipientAccount) end |
#update(recipient_id, recipient_account_id, body) ⇒ Object
24 25 26 27 |
# File 'lib/trolley/gateways/RecipientAccountGateway.rb', line 24 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 |