Class: ModernTreasury::RoutingDetailController
- Inherits:
-
BaseController
- Object
- BaseController
- ModernTreasury::RoutingDetailController
- Defined in:
- lib/modern_treasury/controllers/routing_detail_controller.rb
Overview
RoutingDetailController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_routing_detail(accounts_type, account_id, idempotency_key: nil, body: nil) ⇒ RoutingDetail
Create a routing detail for a single external account.
-
#delete_routing_detail(accounts_type, account_id, id) ⇒ void
Delete a routing detail for a single external account.
-
#get_routing_detail(accounts_type, account_id, id) ⇒ RoutingDetail
Get a single routing detail for a single internal or external account.
-
#list_routing_details(accounts_type, account_id, after_cursor: nil, per_page: nil) ⇒ Array[RoutingDetail]
Get a list of routing details for a single internal or external account.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from ModernTreasury::BaseController
Instance Method Details
#create_routing_detail(accounts_type, account_id, idempotency_key: nil, body: nil) ⇒ RoutingDetail
Create a routing detail for a single external account. something unique, preferably something like an UUID. description here
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/modern_treasury/controllers/routing_detail_controller.rb', line 48 def create_routing_detail(accounts_type, account_id, idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/{accounts_type}/{account_id}/routing_details', Server::DEFAULT) .template_param(new_parameter(accounts_type, key: 'accounts_type') .should_encode(true)) .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(RoutingDetail.method(:from_hash)) .local_error('404', 'unsuccessful', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#delete_routing_detail(accounts_type, account_id, id) ⇒ void
This method returns an undefined value.
Delete a routing detail for a single external account.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/modern_treasury/controllers/routing_detail_controller.rb', line 112 def delete_routing_detail(accounts_type, account_id, id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/{accounts_type}/{account_id}/routing_details/{id}', Server::DEFAULT) .template_param(new_parameter(accounts_type, key: 'accounts_type') .should_encode(true)) .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true)) .execute end |
#get_routing_detail(accounts_type, account_id, id) ⇒ RoutingDetail
Get a single routing detail for a single internal or external account.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/modern_treasury/controllers/routing_detail_controller.rb', line 83 def get_routing_detail(accounts_type, account_id, id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/{accounts_type}/{account_id}/routing_details/{id}', Server::DEFAULT) .template_param(new_parameter(accounts_type, key: 'accounts_type') .should_encode(true)) .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(RoutingDetail.method(:from_hash)) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_routing_details(accounts_type, account_id, after_cursor: nil, per_page: nil) ⇒ Array[RoutingDetail]
Get a list of routing details for a single internal or external account. here here
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/modern_treasury/controllers/routing_detail_controller.rb', line 17 def list_routing_details(accounts_type, account_id, after_cursor: nil, per_page: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/{accounts_type}/{account_id}/routing_details', Server::DEFAULT) .template_param(new_parameter(accounts_type, key: 'accounts_type') .should_encode(true)) .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(RoutingDetail.method(:from_hash)) .is_response_array(true)) .execute end |