Class: ModernTreasury::LedgerAccountPayoutApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/modern_treasury/apis/ledger_account_payout_api.rb

Overview

LedgerAccountPayoutApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from ModernTreasury::BaseApi

Instance Method Details

#create_ledger_account_payout(idempotency_key: nil, body: nil) ⇒ ApiResponse

Create a ledger account payout. something unique, preferably something like an UUID. type description here

Parameters:

  • idempotency_key (String) (defaults to: nil)

    Optional parameter: This key should be

  • body (LedgerAccountPayoutCreateRequest) (defaults to: nil)

    Optional parameter: TODO:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
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/apis/ledger_account_payout_api.rb', line 15

def (idempotency_key: nil,
                                 body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/ledger_account_payouts',
                                 Server::DEFAULT)
               .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(LedgerAccountPayout.method(:from_hash))
                .is_api_response(true)
                .local_error('403',
                             'forbidden',
                             ErrorMessageException)
                .local_error('422',
                             'unsuccessful',
                             ErrorMessageException))
    .execute
end

#get_ledger_account_payout(id) ⇒ ApiResponse

Get details on a single ledger account payout.

Parameters:

  • id (String)

    Required parameter: id

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/modern_treasury/apis/ledger_account_payout_api.rb', line 77

def (id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/ledger_account_payouts/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .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(LedgerAccountPayout.method(:from_hash))
                .is_api_response(true)
                .local_error('404',
                             'not found',
                             ErrorMessageException))
    .execute
end

#list_ledger_account_payouts(after_cursor: nil, per_page: nil, metadata: nil, payout_ledger_account_id: nil) ⇒ ApiResponse

Get a list of ledger account payouts. here here you want to query for records with metadata key ‘Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters. description here

Parameters:

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

  • metadata (Hash[String, String]) (defaults to: nil)

    Optional parameter: For example, if

  • payout_ledger_account_id (String) (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/modern_treasury/apis/ledger_account_payout_api.rb', line 52

def (after_cursor: nil,
                                per_page: nil,
                                metadata: nil,
                                payout_ledger_account_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/ledger_account_payouts',
                                 Server::DEFAULT)
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .query_param(new_parameter(per_page, key: 'per_page'))
               .query_param(new_parameter(, key: 'metadata'))
               .query_param(new_parameter(, key: 'payout_ledger_account_id'))
               .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(LedgerAccountPayout.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true))
    .execute
end

#update_ledger_account_payout(id, body: nil) ⇒ ApiResponse

Update the details of a ledger account payout. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/modern_treasury/apis/ledger_account_payout_api.rb', line 102

def (id,
                                 body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/api/ledger_account_payouts/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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(LedgerAccountPayout.method(:from_hash))
                .is_api_response(true)
                .local_error('403',
                             'forbidden',
                             ErrorMessageException)
                .local_error('404',
                             'not found',
                             ErrorMessageException)
                .local_error('422',
                             'unsuccessful',
                             ErrorMessageException))
    .execute
end