modern_treasury 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +1 -1
  4. data/lib/modern_treasury/client.rb +12 -0
  5. data/lib/modern_treasury/internal/transport/base_client.rb +7 -1
  6. data/lib/modern_treasury/internal/transport/pooled_net_requester.rb +6 -2
  7. data/lib/modern_treasury/models/counterparty_create_params.rb +9 -9
  8. data/lib/modern_treasury/models/external_account_create_params.rb +9 -9
  9. data/lib/modern_treasury/models/hold_create_params.rb +74 -0
  10. data/lib/modern_treasury/models/hold_create_response.rb +143 -0
  11. data/lib/modern_treasury/models/hold_list_params.rb +89 -0
  12. data/lib/modern_treasury/models/hold_list_response.rb +143 -0
  13. data/lib/modern_treasury/models/hold_retrieve_params.rb +14 -0
  14. data/lib/modern_treasury/models/hold_retrieve_response.rb +143 -0
  15. data/lib/modern_treasury/models/hold_update_params.rb +40 -0
  16. data/lib/modern_treasury/models/hold_update_response.rb +143 -0
  17. data/lib/modern_treasury/models/internal_account_request_closure_params.rb +14 -0
  18. data/lib/modern_treasury/models/journal_entry_list_params.rb +38 -0
  19. data/lib/modern_treasury/models/journal_entry_retrieve_params.rb +14 -0
  20. data/lib/modern_treasury/models/journal_report_list_params.rb +14 -0
  21. data/lib/modern_treasury/models/journal_report_retrieve_params.rb +14 -0
  22. data/lib/modern_treasury/models/journal_report_update_params.rb +26 -0
  23. data/lib/modern_treasury/models/payment_order.rb +1 -1
  24. data/lib/modern_treasury/models/payment_reference.rb +1 -1
  25. data/lib/modern_treasury/models/return_object.rb +1 -1
  26. data/lib/modern_treasury/models/transaction.rb +1 -1
  27. data/lib/modern_treasury/models.rb +20 -0
  28. data/lib/modern_treasury/resources/counterparties.rb +14 -16
  29. data/lib/modern_treasury/resources/external_accounts.rb +16 -18
  30. data/lib/modern_treasury/resources/holds.rb +126 -0
  31. data/lib/modern_treasury/resources/internal_accounts.rb +20 -0
  32. data/lib/modern_treasury/resources/journal_entries.rb +60 -0
  33. data/lib/modern_treasury/resources/journal_reports.rb +78 -0
  34. data/lib/modern_treasury/version.rb +1 -1
  35. data/lib/modern_treasury.rb +18 -0
  36. data/manifest.yaml +1 -0
  37. data/rbi/modern_treasury/client.rbi +9 -0
  38. data/rbi/modern_treasury/internal/transport/base_client.rbi +5 -0
  39. data/rbi/modern_treasury/internal/transport/pooled_net_requester.rbi +6 -2
  40. data/rbi/modern_treasury/internal/type/base_model.rbi +8 -4
  41. data/rbi/modern_treasury/models/counterparty_create_params.rbi +8 -8
  42. data/rbi/modern_treasury/models/external_account_create_params.rbi +8 -8
  43. data/rbi/modern_treasury/models/hold_create_params.rbi +125 -0
  44. data/rbi/modern_treasury/models/hold_create_response.rbi +232 -0
  45. data/rbi/modern_treasury/models/hold_list_params.rbi +150 -0
  46. data/rbi/modern_treasury/models/hold_list_response.rbi +225 -0
  47. data/rbi/modern_treasury/models/hold_retrieve_params.rbi +32 -0
  48. data/rbi/modern_treasury/models/hold_retrieve_response.rbi +234 -0
  49. data/rbi/modern_treasury/models/hold_update_params.rbi +79 -0
  50. data/rbi/modern_treasury/models/hold_update_response.rbi +232 -0
  51. data/rbi/modern_treasury/models/internal_account_request_closure_params.rbi +32 -0
  52. data/rbi/modern_treasury/models/journal_entry_list_params.rbi +68 -0
  53. data/rbi/modern_treasury/models/journal_entry_retrieve_params.rbi +32 -0
  54. data/rbi/modern_treasury/models/journal_report_list_params.rbi +32 -0
  55. data/rbi/modern_treasury/models/journal_report_retrieve_params.rbi +32 -0
  56. data/rbi/modern_treasury/models/journal_report_update_params.rbi +52 -0
  57. data/rbi/modern_treasury/models/payment_order.rbi +2 -2
  58. data/rbi/modern_treasury/models/payment_reference.rbi +2 -2
  59. data/rbi/modern_treasury/models/return_object.rbi +2 -2
  60. data/rbi/modern_treasury/models/transaction.rbi +2 -2
  61. data/rbi/modern_treasury/models.rbi +23 -0
  62. data/rbi/modern_treasury/resources/counterparties.rbi +15 -17
  63. data/rbi/modern_treasury/resources/external_accounts.rbi +16 -22
  64. data/rbi/modern_treasury/resources/holds.rbi +108 -0
  65. data/rbi/modern_treasury/resources/internal_accounts.rbi +14 -0
  66. data/rbi/modern_treasury/resources/journal_entries.rbi +46 -0
  67. data/rbi/modern_treasury/resources/journal_reports.rbi +51 -0
  68. data/sig/modern_treasury/client.rbs +6 -0
  69. data/sig/modern_treasury/internal/transport/base_client.rbs +2 -0
  70. data/sig/modern_treasury/internal/transport/pooled_net_requester.rbs +4 -1
  71. data/sig/modern_treasury/models/counterparty_create_params.rbs +5 -5
  72. data/sig/modern_treasury/models/external_account_create_params.rbs +5 -5
  73. data/sig/modern_treasury/models/hold_create_params.rbs +66 -0
  74. data/sig/modern_treasury/models/hold_create_response.rbs +108 -0
  75. data/sig/modern_treasury/models/hold_list_params.rbs +76 -0
  76. data/sig/modern_treasury/models/hold_list_response.rbs +108 -0
  77. data/sig/modern_treasury/models/hold_retrieve_params.rbs +15 -0
  78. data/sig/modern_treasury/models/hold_retrieve_response.rbs +108 -0
  79. data/sig/modern_treasury/models/hold_update_params.rbs +41 -0
  80. data/sig/modern_treasury/models/hold_update_response.rbs +108 -0
  81. data/sig/modern_treasury/models/internal_account_request_closure_params.rbs +15 -0
  82. data/sig/modern_treasury/models/journal_entry_list_params.rbs +36 -0
  83. data/sig/modern_treasury/models/journal_entry_retrieve_params.rbs +15 -0
  84. data/sig/modern_treasury/models/journal_report_list_params.rbs +15 -0
  85. data/sig/modern_treasury/models/journal_report_retrieve_params.rbs +15 -0
  86. data/sig/modern_treasury/models/journal_report_update_params.rbs +32 -0
  87. data/sig/modern_treasury/models/payment_order.rbs +2 -2
  88. data/sig/modern_treasury/models/payment_reference.rbs +2 -2
  89. data/sig/modern_treasury/models/return_object.rbs +2 -2
  90. data/sig/modern_treasury/models/transaction.rbs +2 -2
  91. data/sig/modern_treasury/models.rbs +20 -0
  92. data/sig/modern_treasury/resources/counterparties.rbs +1 -1
  93. data/sig/modern_treasury/resources/external_accounts.rbs +1 -1
  94. data/sig/modern_treasury/resources/holds.rbs +38 -0
  95. data/sig/modern_treasury/resources/internal_accounts.rbs +5 -0
  96. data/sig/modern_treasury/resources/journal_entries.rbs +19 -0
  97. data/sig/modern_treasury/resources/journal_reports.rbs +21 -0
  98. metadata +53 -2
@@ -183,6 +183,14 @@ module ModernTreasury
183
183
 
184
184
  ForeignExchangeRate = ModernTreasury::Models::ForeignExchangeRate
185
185
 
186
+ HoldCreateParams = ModernTreasury::Models::HoldCreateParams
187
+
188
+ HoldListParams = ModernTreasury::Models::HoldListParams
189
+
190
+ HoldRetrieveParams = ModernTreasury::Models::HoldRetrieveParams
191
+
192
+ HoldUpdateParams = ModernTreasury::Models::HoldUpdateParams
193
+
186
194
  IdentificationCreateRequest = ModernTreasury::Models::IdentificationCreateRequest
187
195
 
188
196
  IncomingPaymentDetail = ModernTreasury::Models::IncomingPaymentDetail
@@ -201,6 +209,8 @@ module ModernTreasury
201
209
 
202
210
  InternalAccountListParams = ModernTreasury::Models::InternalAccountListParams
203
211
 
212
+ InternalAccountRequestClosureParams = ModernTreasury::Models::InternalAccountRequestClosureParams
213
+
204
214
  InternalAccountRetrieveParams = ModernTreasury::Models::InternalAccountRetrieveParams
205
215
 
206
216
  InternalAccounts = ModernTreasury::Models::InternalAccounts
@@ -224,6 +234,16 @@ module ModernTreasury
224
234
 
225
235
  InvoiceUpdateParams = ModernTreasury::Models::InvoiceUpdateParams
226
236
 
237
+ JournalEntryListParams = ModernTreasury::Models::JournalEntryListParams
238
+
239
+ JournalEntryRetrieveParams = ModernTreasury::Models::JournalEntryRetrieveParams
240
+
241
+ JournalReportListParams = ModernTreasury::Models::JournalReportListParams
242
+
243
+ JournalReportRetrieveParams = ModernTreasury::Models::JournalReportRetrieveParams
244
+
245
+ JournalReportUpdateParams = ModernTreasury::Models::JournalReportUpdateParams
246
+
227
247
  Ledger = ModernTreasury::Models::Ledger
228
248
 
229
249
  LedgerAccount = ModernTreasury::Models::LedgerAccount
@@ -8,31 +8,31 @@ module ModernTreasury
8
8
  #
9
9
  # Create a new counterparty.
10
10
  #
11
- # @overload create(name:, body_external_id: nil, accounting: nil, accounts: nil, email: nil, ledger_type: nil, legal_entity: nil, legal_entity_id: nil, metadata: nil, send_remittance_advice: nil, taxpayer_identifier: nil, verification_status: nil, request_options: {})
11
+ # @overload create(name:, accounting: nil, accounts: nil, email: nil, external_id: nil, ledger_type: nil, legal_entity: nil, legal_entity_id: nil, metadata: nil, send_remittance_advice: nil, taxpayer_identifier: nil, verification_status: nil, request_options: {})
12
12
  #
13
- # @param name [String, nil] Body param: A human friendly name for this counterparty.
13
+ # @param name [String, nil] A human friendly name for this counterparty.
14
14
  #
15
- # @param body_external_id [String, nil] Body param: An optional user-defined 180 character unique identifier.
15
+ # @param accounting [ModernTreasury::Models::CounterpartyCreateParams::Accounting]
16
16
  #
17
- # @param accounting [ModernTreasury::Models::CounterpartyCreateParams::Accounting] Body param:
17
+ # @param accounts [Array<ModernTreasury::Models::CounterpartyCreateParams::Account>] The accounts for this counterparty.
18
18
  #
19
- # @param accounts [Array<ModernTreasury::Models::CounterpartyCreateParams::Account>] Body param: The accounts for this counterparty.
19
+ # @param email [String, nil] The counterparty's email.
20
20
  #
21
- # @param email [String, nil] Body param: The counterparty's email.
21
+ # @param external_id [String, nil] An optional user-defined 180 character unique identifier.
22
22
  #
23
- # @param ledger_type [Symbol, ModernTreasury::Models::CounterpartyCreateParams::LedgerType] Body param: An optional type to auto-sync the counterparty to your ledger. Eithe
23
+ # @param ledger_type [Symbol, ModernTreasury::Models::CounterpartyCreateParams::LedgerType] An optional type to auto-sync the counterparty to your ledger. Either `customer`
24
24
  #
25
- # @param legal_entity [ModernTreasury::Models::CounterpartyCreateParams::LegalEntity] Body param:
25
+ # @param legal_entity [ModernTreasury::Models::CounterpartyCreateParams::LegalEntity]
26
26
  #
27
- # @param legal_entity_id [String, nil] Body param: The id of the legal entity.
27
+ # @param legal_entity_id [String, nil] The id of the legal entity.
28
28
  #
29
- # @param metadata [Hash{Symbol=>String}] Body param: Additional data represented as key-value pairs. Both the key and val
29
+ # @param metadata [Hash{Symbol=>String}] Additional data represented as key-value pairs. Both the key and value must be s
30
30
  #
31
- # @param send_remittance_advice [Boolean] Body param: Send an email to the counterparty whenever an associated payment ord
31
+ # @param send_remittance_advice [Boolean] Send an email to the counterparty whenever an associated payment order is sent t
32
32
  #
33
- # @param taxpayer_identifier [String] Body param: Either a valid SSN or EIN.
33
+ # @param taxpayer_identifier [String] Either a valid SSN or EIN.
34
34
  #
35
- # @param verification_status [String] Body param: The verification status of the counterparty.
35
+ # @param verification_status [String] The verification status of the counterparty.
36
36
  #
37
37
  # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
38
38
  #
@@ -41,12 +41,10 @@ module ModernTreasury
41
41
  # @see ModernTreasury::Models::CounterpartyCreateParams
42
42
  def create(params)
43
43
  parsed, options = ModernTreasury::CounterpartyCreateParams.dump_request(params)
44
- query_params = [:query_external_id]
45
44
  @client.request(
46
45
  method: :post,
47
46
  path: "api/counterparties",
48
- query: parsed.slice(*query_params).transform_keys(query_external_id: "external_id"),
49
- body: parsed.except(*query_params),
47
+ body: parsed,
50
48
  model: ModernTreasury::Counterparty,
51
49
  options: options
52
50
  )
@@ -8,35 +8,35 @@ module ModernTreasury
8
8
  #
9
9
  # create external account
10
10
  #
11
- # @overload create(counterparty_id:, body_external_id: nil, account_details: nil, account_type: nil, contact_details: nil, ledger_account: nil, metadata: nil, name: nil, party_address: nil, party_identifier: nil, party_name: nil, party_type: nil, plaid_processor_token: nil, routing_details: nil, request_options: {})
11
+ # @overload create(counterparty_id:, account_details: nil, account_type: nil, contact_details: nil, external_id: nil, ledger_account: nil, metadata: nil, name: nil, party_address: nil, party_identifier: nil, party_name: nil, party_type: nil, plaid_processor_token: nil, routing_details: nil, request_options: {})
12
12
  #
13
- # @param counterparty_id [String, nil] Body param:
13
+ # @param counterparty_id [String, nil]
14
14
  #
15
- # @param body_external_id [String, nil] Body param: An optional user-defined 180 character unique identifier.
15
+ # @param account_details [Array<ModernTreasury::Models::ExternalAccountCreateParams::AccountDetail>]
16
16
  #
17
- # @param account_details [Array<ModernTreasury::Models::ExternalAccountCreateParams::AccountDetail>] Body param:
17
+ # @param account_type [Symbol, ModernTreasury::Models::ExternalAccountType] Can be `checking`, `savings` or `other`.
18
18
  #
19
- # @param account_type [Symbol, ModernTreasury::Models::ExternalAccountType] Body param: Can be `checking`, `savings` or `other`.
19
+ # @param contact_details [Array<ModernTreasury::Models::ContactDetailCreateRequest>]
20
20
  #
21
- # @param contact_details [Array<ModernTreasury::Models::ContactDetailCreateRequest>] Body param:
21
+ # @param external_id [String, nil] An optional user-defined 180 character unique identifier.
22
22
  #
23
- # @param ledger_account [ModernTreasury::Models::LedgerAccountCreateRequest] Body param: Specifies a ledger account object that will be created with the exte
23
+ # @param ledger_account [ModernTreasury::Models::LedgerAccountCreateRequest] Specifies a ledger account object that will be created with the external account
24
24
  #
25
- # @param metadata [Hash{Symbol=>String}] Body param: Additional data represented as key-value pairs. Both the key and val
25
+ # @param metadata [Hash{Symbol=>String}] Additional data represented as key-value pairs. Both the key and value must be s
26
26
  #
27
- # @param name [String, nil] Body param: A nickname for the external account. This is only for internal usage
27
+ # @param name [String, nil] A nickname for the external account. This is only for internal usage and won't a
28
28
  #
29
- # @param party_address [ModernTreasury::Models::AddressRequest] Body param: Required if receiving wire payments.
29
+ # @param party_address [ModernTreasury::Models::AddressRequest] Required if receiving wire payments.
30
30
  #
31
- # @param party_identifier [String] Body param:
31
+ # @param party_identifier [String]
32
32
  #
33
- # @param party_name [String] Body param: If this value isn't provided, it will be inherited from the counterp
33
+ # @param party_name [String] If this value isn't provided, it will be inherited from the counterparty's name.
34
34
  #
35
- # @param party_type [Symbol, ModernTreasury::Models::ExternalAccountCreateParams::PartyType, nil] Body param: Either `individual` or `business`.
35
+ # @param party_type [Symbol, ModernTreasury::Models::ExternalAccountCreateParams::PartyType, nil] Either `individual` or `business`.
36
36
  #
37
- # @param plaid_processor_token [String] Body param: If you've enabled the Modern Treasury + Plaid integration in your Pl
37
+ # @param plaid_processor_token [String] If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
38
38
  #
39
- # @param routing_details [Array<ModernTreasury::Models::ExternalAccountCreateParams::RoutingDetail>] Body param:
39
+ # @param routing_details [Array<ModernTreasury::Models::ExternalAccountCreateParams::RoutingDetail>]
40
40
  #
41
41
  # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
42
42
  #
@@ -45,12 +45,10 @@ module ModernTreasury
45
45
  # @see ModernTreasury::Models::ExternalAccountCreateParams
46
46
  def create(params)
47
47
  parsed, options = ModernTreasury::ExternalAccountCreateParams.dump_request(params)
48
- query_params = [:query_external_id]
49
48
  @client.request(
50
49
  method: :post,
51
50
  path: "api/external_accounts",
52
- query: parsed.slice(*query_params).transform_keys(query_external_id: "external_id"),
53
- body: parsed.except(*query_params),
51
+ body: parsed,
54
52
  model: ModernTreasury::ExternalAccount,
55
53
  options: options
56
54
  )
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ModernTreasury
4
+ module Resources
5
+ class Holds
6
+ # Create a new hold
7
+ #
8
+ # @overload create(status:, target_id:, target_type:, metadata: nil, reason: nil, request_options: {})
9
+ #
10
+ # @param status [Symbol, ModernTreasury::Models::HoldCreateParams::Status] The status of the hold
11
+ #
12
+ # @param target_id [String] The ID of the target to hold
13
+ #
14
+ # @param target_type [Symbol, ModernTreasury::Models::HoldCreateParams::TargetType] The type of target to hold
15
+ #
16
+ # @param metadata [Hash{Symbol=>String}, nil] Additional metadata for the hold
17
+ #
18
+ # @param reason [String, nil] The reason for the hold
19
+ #
20
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
21
+ #
22
+ # @return [ModernTreasury::Models::HoldCreateResponse]
23
+ #
24
+ # @see ModernTreasury::Models::HoldCreateParams
25
+ def create(params)
26
+ parsed, options = ModernTreasury::HoldCreateParams.dump_request(params)
27
+ @client.request(
28
+ method: :post,
29
+ path: "api/holds",
30
+ body: parsed,
31
+ model: ModernTreasury::Models::HoldCreateResponse,
32
+ options: options
33
+ )
34
+ end
35
+
36
+ # Get a specific hold
37
+ #
38
+ # @overload retrieve(id, request_options: {})
39
+ #
40
+ # @param id [String] hold id
41
+ #
42
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
43
+ #
44
+ # @return [ModernTreasury::Models::HoldRetrieveResponse]
45
+ #
46
+ # @see ModernTreasury::Models::HoldRetrieveParams
47
+ def retrieve(id, params = {})
48
+ @client.request(
49
+ method: :get,
50
+ path: ["api/holds/%1$s", id],
51
+ model: ModernTreasury::Models::HoldRetrieveResponse,
52
+ options: params[:request_options]
53
+ )
54
+ end
55
+
56
+ # Update a hold
57
+ #
58
+ # @overload update(id, status:, resolution: nil, request_options: {})
59
+ #
60
+ # @param id [String] hold id
61
+ #
62
+ # @param status [Symbol, ModernTreasury::Models::HoldUpdateParams::Status] The new status of the hold
63
+ #
64
+ # @param resolution [String, nil] The resolution of the hold
65
+ #
66
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @return [ModernTreasury::Models::HoldUpdateResponse]
69
+ #
70
+ # @see ModernTreasury::Models::HoldUpdateParams
71
+ def update(id, params)
72
+ parsed, options = ModernTreasury::HoldUpdateParams.dump_request(params)
73
+ @client.request(
74
+ method: :patch,
75
+ path: ["api/holds/%1$s", id],
76
+ body: parsed,
77
+ model: ModernTreasury::Models::HoldUpdateResponse,
78
+ options: options
79
+ )
80
+ end
81
+
82
+ # Some parameter documentations has been truncated, see
83
+ # {ModernTreasury::Models::HoldListParams} for more details.
84
+ #
85
+ # Get a list of holds.
86
+ #
87
+ # @overload list(after_cursor: nil, metadata: nil, per_page: nil, status: nil, target_id: nil, target_type: nil, request_options: {})
88
+ #
89
+ # @param after_cursor [String, nil]
90
+ #
91
+ # @param metadata [Hash{Symbol=>String}] For example, if you want to query for records with metadata key `Type` and value
92
+ #
93
+ # @param per_page [Integer]
94
+ #
95
+ # @param status [Symbol, ModernTreasury::Models::HoldListParams::Status, nil] Translation missing: en.openapi.descriptions.payment_order.query_params.status
96
+ #
97
+ # @param target_id [String, nil] Translation missing: en.openapi.descriptions.payment_order.query_params.target_i
98
+ #
99
+ # @param target_type [Symbol, ModernTreasury::Models::HoldListParams::TargetType, nil] Translation missing: en.openapi.descriptions.payment_order.query_params.target_t
100
+ #
101
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
102
+ #
103
+ # @return [ModernTreasury::Internal::Page<ModernTreasury::Models::HoldListResponse>]
104
+ #
105
+ # @see ModernTreasury::Models::HoldListParams
106
+ def list(params = {})
107
+ parsed, options = ModernTreasury::HoldListParams.dump_request(params)
108
+ @client.request(
109
+ method: :get,
110
+ path: "api/holds",
111
+ query: parsed,
112
+ page: ModernTreasury::Internal::Page,
113
+ model: ModernTreasury::Models::HoldListResponse,
114
+ options: options
115
+ )
116
+ end
117
+
118
+ # @api private
119
+ #
120
+ # @param client [ModernTreasury::Client]
121
+ def initialize(client:)
122
+ @client = client
123
+ end
124
+ end
125
+ end
126
+ end
@@ -148,6 +148,26 @@ module ModernTreasury
148
148
  )
149
149
  end
150
150
 
151
+ # request closure of internal account
152
+ #
153
+ # @overload request_closure(id, request_options: {})
154
+ #
155
+ # @param id [String] Unique identifier for the account.
156
+ #
157
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
158
+ #
159
+ # @return [ModernTreasury::Models::InternalAccount]
160
+ #
161
+ # @see ModernTreasury::Models::InternalAccountRequestClosureParams
162
+ def request_closure(id, params = {})
163
+ @client.request(
164
+ method: :post,
165
+ path: ["api/internal_accounts/%1$s/request_closure", id],
166
+ model: ModernTreasury::InternalAccount,
167
+ options: params[:request_options]
168
+ )
169
+ end
170
+
151
171
  # Some parameter documentations has been truncated, see
152
172
  # {ModernTreasury::Models::InternalAccountUpdateAccountCapabilityParams} for more
153
173
  # details.
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ModernTreasury
4
+ module Resources
5
+ class JournalEntries
6
+ # Retrieve a specific journal entry
7
+ #
8
+ # @overload retrieve(id, request_options: {})
9
+ #
10
+ # @param id [String] The ID of the journal entry
11
+ #
12
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [nil]
15
+ #
16
+ # @see ModernTreasury::Models::JournalEntryRetrieveParams
17
+ def retrieve(id, params = {})
18
+ @client.request(
19
+ method: :get,
20
+ path: ["api/journal_entries/%1$s", id],
21
+ model: NilClass,
22
+ options: params[:request_options]
23
+ )
24
+ end
25
+
26
+ # Retrieve a list of journal entries
27
+ #
28
+ # @overload list(journal_report_id:, page: nil, per_page: nil, request_options: {})
29
+ #
30
+ # @param journal_report_id [String] The ID of the journal report
31
+ #
32
+ # @param page [Integer] Page number for pagination
33
+ #
34
+ # @param per_page [Integer] Number of items per page
35
+ #
36
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
37
+ #
38
+ # @return [nil]
39
+ #
40
+ # @see ModernTreasury::Models::JournalEntryListParams
41
+ def list(params)
42
+ parsed, options = ModernTreasury::JournalEntryListParams.dump_request(params)
43
+ @client.request(
44
+ method: :get,
45
+ path: "api/journal_entries",
46
+ query: parsed,
47
+ model: NilClass,
48
+ options: options
49
+ )
50
+ end
51
+
52
+ # @api private
53
+ #
54
+ # @param client [ModernTreasury::Client]
55
+ def initialize(client:)
56
+ @client = client
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ModernTreasury
4
+ module Resources
5
+ class JournalReports
6
+ # Retrieve a specific journal report
7
+ #
8
+ # @overload retrieve(id, request_options: {})
9
+ #
10
+ # @param id [String] The ID of the journal report
11
+ #
12
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [nil]
15
+ #
16
+ # @see ModernTreasury::Models::JournalReportRetrieveParams
17
+ def retrieve(id, params = {})
18
+ @client.request(
19
+ method: :get,
20
+ path: ["api/journal_reports/%1$s", id],
21
+ model: NilClass,
22
+ options: params[:request_options]
23
+ )
24
+ end
25
+
26
+ # Update a journal report
27
+ #
28
+ # @overload update(id, metadata: nil, status: nil, request_options: {})
29
+ #
30
+ # @param id [String] The ID of the journal report
31
+ #
32
+ # @param metadata [Object]
33
+ #
34
+ # @param status [String]
35
+ #
36
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
37
+ #
38
+ # @return [nil]
39
+ #
40
+ # @see ModernTreasury::Models::JournalReportUpdateParams
41
+ def update(id, params = {})
42
+ parsed, options = ModernTreasury::JournalReportUpdateParams.dump_request(params)
43
+ @client.request(
44
+ method: :patch,
45
+ path: ["api/journal_reports/%1$s", id],
46
+ body: parsed,
47
+ model: NilClass,
48
+ options: options
49
+ )
50
+ end
51
+
52
+ # Retrieve a list of journal reports
53
+ #
54
+ # @overload list(request_options: {})
55
+ #
56
+ # @param request_options [ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil]
57
+ #
58
+ # @return [nil]
59
+ #
60
+ # @see ModernTreasury::Models::JournalReportListParams
61
+ def list(params = {})
62
+ @client.request(
63
+ method: :get,
64
+ path: "api/journal_reports",
65
+ model: NilClass,
66
+ options: params[:request_options]
67
+ )
68
+ end
69
+
70
+ # @api private
71
+ #
72
+ # @param client [ModernTreasury::Client]
73
+ def initialize(client:)
74
+ @client = client
75
+ end
76
+ end
77
+ end
78
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModernTreasury
4
- VERSION = "0.9.0"
4
+ VERSION = "0.11.0"
5
5
  end
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
@@ -124,6 +125,14 @@ require_relative "modern_treasury/models/foreign_exchange_quote_create_params"
124
125
  require_relative "modern_treasury/models/foreign_exchange_quote_list_params"
125
126
  require_relative "modern_treasury/models/foreign_exchange_quote_retrieve_params"
126
127
  require_relative "modern_treasury/models/foreign_exchange_rate"
128
+ require_relative "modern_treasury/models/hold_create_params"
129
+ require_relative "modern_treasury/models/hold_create_response"
130
+ require_relative "modern_treasury/models/hold_list_params"
131
+ require_relative "modern_treasury/models/hold_list_response"
132
+ require_relative "modern_treasury/models/hold_retrieve_params"
133
+ require_relative "modern_treasury/models/hold_retrieve_response"
134
+ require_relative "modern_treasury/models/hold_update_params"
135
+ require_relative "modern_treasury/models/hold_update_response"
127
136
  require_relative "modern_treasury/models/identification_create_request"
128
137
  require_relative "modern_treasury/models/incoming_payment_detail"
129
138
  require_relative "modern_treasury/models/incoming_payment_detail_create_async_params"
@@ -133,6 +142,7 @@ require_relative "modern_treasury/models/incoming_payment_detail_update_params"
133
142
  require_relative "modern_treasury/models/internal_account"
134
143
  require_relative "modern_treasury/models/internal_account_create_params"
135
144
  require_relative "modern_treasury/models/internal_account_list_params"
145
+ require_relative "modern_treasury/models/internal_account_request_closure_params"
136
146
  require_relative "modern_treasury/models/internal_account_retrieve_params"
137
147
  require_relative "modern_treasury/models/internal_accounts/balance_report"
138
148
  require_relative "modern_treasury/models/internal_accounts/balance_report_create_params"
@@ -154,6 +164,11 @@ require_relative "modern_treasury/models/invoices/line_item_list_params"
154
164
  require_relative "modern_treasury/models/invoices/line_item_retrieve_params"
155
165
  require_relative "modern_treasury/models/invoices/line_item_update_params"
156
166
  require_relative "modern_treasury/models/invoice_update_params"
167
+ require_relative "modern_treasury/models/journal_entry_list_params"
168
+ require_relative "modern_treasury/models/journal_entry_retrieve_params"
169
+ require_relative "modern_treasury/models/journal_report_list_params"
170
+ require_relative "modern_treasury/models/journal_report_retrieve_params"
171
+ require_relative "modern_treasury/models/journal_report_update_params"
157
172
  require_relative "modern_treasury/models/ledger"
158
173
  require_relative "modern_treasury/models/ledger_account"
159
174
  require_relative "modern_treasury/models/ledger_account_balance_monitor"
@@ -299,11 +314,14 @@ require_relative "modern_treasury/resources/events"
299
314
  require_relative "modern_treasury/resources/expected_payments"
300
315
  require_relative "modern_treasury/resources/external_accounts"
301
316
  require_relative "modern_treasury/resources/foreign_exchange_quotes"
317
+ require_relative "modern_treasury/resources/holds"
302
318
  require_relative "modern_treasury/resources/incoming_payment_details"
303
319
  require_relative "modern_treasury/resources/internal_accounts"
304
320
  require_relative "modern_treasury/resources/internal_accounts/balance_reports"
305
321
  require_relative "modern_treasury/resources/invoices"
306
322
  require_relative "modern_treasury/resources/invoices/line_items"
323
+ require_relative "modern_treasury/resources/journal_entries"
324
+ require_relative "modern_treasury/resources/journal_reports"
307
325
  require_relative "modern_treasury/resources/ledger_account_balance_monitors"
308
326
  require_relative "modern_treasury/resources/ledger_account_categories"
309
327
  require_relative "modern_treasury/resources/ledger_accounts"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -121,6 +121,15 @@ module ModernTreasury
121
121
  sig { returns(ModernTreasury::Resources::PaymentActions) }
122
122
  attr_reader :payment_actions
123
123
 
124
+ sig { returns(ModernTreasury::Resources::JournalEntries) }
125
+ attr_reader :journal_entries
126
+
127
+ sig { returns(ModernTreasury::Resources::JournalReports) }
128
+ attr_reader :journal_reports
129
+
130
+ sig { returns(ModernTreasury::Resources::Holds) }
131
+ attr_reader :holds
132
+
124
133
  # A test endpoint often used to confirm credentials and headers are being passed
125
134
  # in correctly.
126
135
  sig do
@@ -182,6 +182,11 @@ module ModernTreasury
182
182
  private def auth_headers
183
183
  end
184
184
 
185
+ # @api private
186
+ sig { returns(String) }
187
+ private def user_agent
188
+ end
189
+
185
190
  # @api private
186
191
  sig { returns(String) }
187
192
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module ModernTreasury
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module ModernTreasury
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: ModernTreasury::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -282,9 +282,13 @@ module ModernTreasury
282
282
 
283
283
  # Create a new instance of a model.
284
284
  sig do
285
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
286
- T.attached_class
287
- )
285
+ params(
286
+ data:
287
+ T.any(
288
+ T::Hash[Symbol, T.anything],
289
+ ModernTreasury::Internal::Type::BaseModel
290
+ )
291
+ ).returns(T.attached_class)
288
292
  end
289
293
  def self.new(data = {})
290
294
  end
@@ -18,10 +18,6 @@ module ModernTreasury
18
18
  sig { returns(T.nilable(String)) }
19
19
  attr_accessor :name
20
20
 
21
- # An optional user-defined 180 character unique identifier.
22
- sig { returns(T.nilable(String)) }
23
- attr_accessor :body_external_id
24
-
25
21
  sig do
26
22
  returns(T.nilable(ModernTreasury::CounterpartyCreateParams::Accounting))
27
23
  end
@@ -55,6 +51,10 @@ module ModernTreasury
55
51
  sig { returns(T.nilable(String)) }
56
52
  attr_accessor :email
57
53
 
54
+ # An optional user-defined 180 character unique identifier.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_accessor :external_id
57
+
58
58
  # An optional type to auto-sync the counterparty to your ledger. Either `customer`
59
59
  # or `vendor`.
60
60
  sig do
@@ -126,12 +126,12 @@ module ModernTreasury
126
126
  sig do
127
127
  params(
128
128
  name: T.nilable(String),
129
- body_external_id: T.nilable(String),
130
129
  accounting:
131
130
  ModernTreasury::CounterpartyCreateParams::Accounting::OrHash,
132
131
  accounts:
133
132
  T::Array[ModernTreasury::CounterpartyCreateParams::Account::OrHash],
134
133
  email: T.nilable(String),
134
+ external_id: T.nilable(String),
135
135
  ledger_type:
136
136
  ModernTreasury::CounterpartyCreateParams::LedgerType::OrSymbol,
137
137
  legal_entity:
@@ -147,13 +147,13 @@ module ModernTreasury
147
147
  def self.new(
148
148
  # A human friendly name for this counterparty.
149
149
  name:,
150
- # An optional user-defined 180 character unique identifier.
151
- body_external_id: nil,
152
150
  accounting: nil,
153
151
  # The accounts for this counterparty.
154
152
  accounts: nil,
155
153
  # The counterparty's email.
156
154
  email: nil,
155
+ # An optional user-defined 180 character unique identifier.
156
+ external_id: nil,
157
157
  # An optional type to auto-sync the counterparty to your ledger. Either `customer`
158
158
  # or `vendor`.
159
159
  ledger_type: nil,
@@ -178,11 +178,11 @@ module ModernTreasury
178
178
  override.returns(
179
179
  {
180
180
  name: T.nilable(String),
181
- body_external_id: T.nilable(String),
182
181
  accounting: ModernTreasury::CounterpartyCreateParams::Accounting,
183
182
  accounts:
184
183
  T::Array[ModernTreasury::CounterpartyCreateParams::Account],
185
184
  email: T.nilable(String),
185
+ external_id: T.nilable(String),
186
186
  ledger_type:
187
187
  ModernTreasury::CounterpartyCreateParams::LedgerType::OrSymbol,
188
188
  legal_entity: ModernTreasury::CounterpartyCreateParams::LegalEntity,