inttegro 2.0.0 → 3.0.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/inttegro/file_download.rb +1 -1
  4. data/lib/inttegro/generated/enums.rb +1 -1
  5. data/lib/inttegro/generated/models.rb +539 -537
  6. data/lib/inttegro/generated/operations.rb +8 -8
  7. data/lib/inttegro/http_client.rb +57 -3
  8. data/lib/inttegro/models.rb +2 -50
  9. data/lib/inttegro/resources/apps.rb +3 -3
  10. data/lib/inttegro/resources/balance_transactions.rb +2 -6
  11. data/lib/inttegro/resources/balances.rb +1 -1
  12. data/lib/inttegro/resources/broadcasts.rb +2 -6
  13. data/lib/inttegro/resources/chimes.rb +5 -5
  14. data/lib/inttegro/resources/customers.rb +4 -4
  15. data/lib/inttegro/resources/file_links.rb +4 -6
  16. data/lib/inttegro/resources/file_references.rb +1 -1
  17. data/lib/inttegro/resources/files.rb +4 -6
  18. data/lib/inttegro/resources/financial_accounts.rb +22 -22
  19. data/lib/inttegro/resources/keys.rb +8 -10
  20. data/lib/inttegro/resources/message_templates.rb +13 -15
  21. data/lib/inttegro/resources/orders.rb +20 -20
  22. data/lib/inttegro/resources/otp.rb +4 -4
  23. data/lib/inttegro/resources/payment_methods.rb +34 -36
  24. data/lib/inttegro/resources/payouts.rb +28 -28
  25. data/lib/inttegro/resources/prices.rb +7 -7
  26. data/lib/inttegro/resources/products.rb +9 -9
  27. data/lib/inttegro/resources/purchase_intents.rb +8 -8
  28. data/lib/inttegro/resources/refunds.rb +6 -6
  29. data/lib/inttegro/resources/schedules.rb +4 -4
  30. data/lib/inttegro/resources/spec.rb +1 -1
  31. data/lib/inttegro/resources/upload_requests.rb +10 -10
  32. data/lib/inttegro/version.rb +1 -1
  33. data/lib/inttegro.rb +15 -0
  34. data/rbi/inttegro/generated.rbi +110 -110
  35. metadata +2 -2
@@ -9,7 +9,7 @@ module Inttegro
9
9
  module Operations
10
10
  RESPONSE_MODELS = T.let({
11
11
  "/otp/initiate" => Inttegro::InitiateOTPResponse,
12
- "/otp/verify" => Inttegro::VerifyOTPResponse,
12
+ "/otp/verify" => Inttegro::OTPVerification,
13
13
  "/otp/lookup" => Inttegro::LookupOTPResponse,
14
14
  "/chimes/send" => Inttegro::ChimeResponse,
15
15
  "/chimes/lookup" => Inttegro::ChimeResponse,
@@ -26,7 +26,7 @@ module Inttegro
26
26
  "/message_templates/archive" => Inttegro::MessageTemplateEnvelope,
27
27
  "/message_templates/lookup" => Inttegro::MessageTemplateEnvelope,
28
28
  "/message_templates/page" => Inttegro::MessageTemplatesPageEnvelope,
29
- "/message_templates/render_preview" => Inttegro::RenderMessageTemplatePreviewResponse,
29
+ "/message_templates/render_preview" => Inttegro::MessageTemplatePreview,
30
30
  "/customers/create" => Inttegro::CustomerResponse,
31
31
  "/customers/lookup" => Inttegro::CustomerResponse,
32
32
  "/customers/update" => Inttegro::CustomerResponse,
@@ -56,7 +56,7 @@ module Inttegro
56
56
  "/keys/lookup" => Inttegro::LookupSecretKeyResponse,
57
57
  "/keys/update" => Inttegro::UpdateSecretKeyResponse,
58
58
  "/keys/destroy" => Inttegro::DestroySecretKeyResponse,
59
- "/keys/usage" => Inttegro::SecretKeyUsageResponse,
59
+ "/keys/usage" => Inttegro::SecretKeyUsage,
60
60
  "/financial_accounts/create" => Inttegro::CreateFinancialAccountResponse,
61
61
  "/financial_accounts/lookup" => Inttegro::LookupFinancialAccountResponse,
62
62
  "/financial_accounts/page" => Inttegro::PageFinancialAccountsResponseInline,
@@ -68,7 +68,7 @@ module Inttegro
68
68
  "/financial_accounts/reconnect" => Inttegro::ReconnectFinancialAccountResponse,
69
69
  "/financial_accounts/enable_pull" => Inttegro::EnableFinancialAccountPullResponse,
70
70
  "/financial_accounts/disable_pull" => Inttegro::DisableFinancialAccountPullResponse,
71
- "/balances" => Inttegro::BalanceSnapshotResponse,
71
+ "/balances" => Inttegro::BalanceSnapshot,
72
72
  "/balance_transactions/lookup" => Inttegro::BalanceTransactionResponse,
73
73
  "/balance_transactions/page" => Inttegro::BalanceTransactionPageResponse,
74
74
  "/payouts/schedule" => Inttegro::SchedulePayoutResponse,
@@ -83,7 +83,7 @@ module Inttegro
83
83
  "/files/lookup" => Inttegro::FileResponse,
84
84
  "/files/page" => Inttegro::FilePageResponse,
85
85
  "/files/delete" => Inttegro::FileResponse,
86
- "/file_links/create" => Inttegro::CreateFileLinkResponse,
86
+ "/file_links/create" => Inttegro::FileLinkCreation,
87
87
  "/file_links/lookup" => Inttegro::FileLinkResponse,
88
88
  "/file_links/page" => Inttegro::FileLinkPageResponse,
89
89
  "/file_links/revoke" => Inttegro::FileLinkResponse,
@@ -92,8 +92,8 @@ module Inttegro
92
92
  "/upload_requests/page" => Inttegro::UploadRequestPageResponse,
93
93
  "/upload_requests/cancel" => Inttegro::UploadRequestResponse,
94
94
  "/upload_requests/review" => Inttegro::UploadRequestWithAttemptResponse,
95
- "/upload_requests/upload" => Inttegro::FulfillUploadRequestResponse,
96
- "/file_references/reconcile" => Inttegro::FileReferenceReconcileResponse,
95
+ "/upload_requests/upload" => Inttegro::UploadFulfillment,
96
+ "/file_references/reconcile" => Inttegro::FileReferenceReconciliation,
97
97
  "/payment_methods/tokenize" => Inttegro::TokenizePaymentMethodResponse,
98
98
  "/payment_methods/lookup" => Inttegro::LookupPaymentMethodResponse,
99
99
  "/payment_methods/page" => Inttegro::PaymentMethodPageResponse,
@@ -123,7 +123,7 @@ module Inttegro
123
123
  "/prices/activate" => Inttegro::PriceResponse,
124
124
  "/prices/deactivate" => Inttegro::PriceResponse,
125
125
  "/prices/archive" => Inttegro::PriceResponse,
126
- "/spec/countries" => Inttegro::ListCountrySpecsResponse
126
+ "/spec/countries" => Inttegro::CountrySpecifications
127
127
  }.freeze, T::Hash[String, T::Class[T::Struct]])
128
128
 
129
129
  REQUEST_TYPE_NAMES = T.let({
@@ -98,6 +98,30 @@ module Inttegro
98
98
  raise TypeError, "expected #{model} from #{path}, got #{response.class}"
99
99
  end
100
100
 
101
+ sig do
102
+ type_parameters(:Model)
103
+ .params(
104
+ path: String,
105
+ model: T::Class[T.type_parameter(:Model)],
106
+ field: Symbol,
107
+ body: Types::RequestBody,
108
+ headers: Types::Headers,
109
+ query: T.nilable(Types::Query)
110
+ )
111
+ .returns(T.type_parameter(:Model))
112
+ end
113
+ def post_resource(path, model, field, body, headers: {}, query: nil)
114
+ envelope = post_object(path, body, headers: headers, query: query)
115
+ value = envelope.public_send(field)
116
+ value = value.to_h if value.is_a?(ResponseObject)
117
+ return value if value.is_a?(model)
118
+
119
+ decoded = Inttegro.deserialize(value, T.cast(model, T::Class[T::Struct]))
120
+ return decoded if decoded.is_a?(model)
121
+
122
+ raise TypeError, "expected #{model} in #{field} from #{path}, got #{decoded.class}"
123
+ end
124
+
101
125
  sig do
102
126
  params(
103
127
  path: String,
@@ -156,6 +180,37 @@ module Inttegro
156
180
  raise TypeError, "expected #{model} from #{path}, got #{response.class}"
157
181
  end
158
182
 
183
+ sig do
184
+ type_parameters(:Model)
185
+ .params(
186
+ path: String,
187
+ model: T::Class[T.type_parameter(:Model)],
188
+ field: Symbol,
189
+ fields: Types::Payload,
190
+ files: Types::Payload,
191
+ headers: Types::Headers,
192
+ authenticated: T::Boolean
193
+ )
194
+ .returns(T.type_parameter(:Model))
195
+ end
196
+ def post_multipart_resource(path, model, field, fields: {}, files: {}, headers: {}, authenticated: true)
197
+ envelope = expect_response_object(perform_multipart(
198
+ path,
199
+ fields,
200
+ files,
201
+ headers,
202
+ authenticated,
203
+ nil
204
+ ), path)
205
+ value = envelope.public_send(field)
206
+ return value if value.is_a?(model)
207
+
208
+ decoded = Inttegro.deserialize(value, T.cast(model, T::Class[T::Struct]))
209
+ return decoded if decoded.is_a?(model)
210
+
211
+ raise TypeError, "expected #{model} in #{field} from #{path}, got #{decoded.class}"
212
+ end
213
+
159
214
  sig do
160
215
  params(
161
216
  path: String,
@@ -393,7 +448,7 @@ module Inttegro
393
448
  status = response.code.to_i
394
449
  data = parse_json(response.body)
395
450
 
396
- return wrap_response(data, model_class || response_model_for(path)) if status < 400
451
+ return wrap_response(data, model_class) if status < 400
397
452
 
398
453
  raise_response_error(response)
399
454
  end
@@ -519,8 +574,7 @@ module Inttegro
519
574
 
520
575
  sig { params(path: String).returns(T.nilable(T::Class[T::Struct])) }
521
576
  def response_model_for(path)
522
- return Inttegro::CancelOTPResponse if path == "/otp/cancel"
523
- return Inttegro::OrderEnvelope if path == "/orders/new"
577
+ return T.cast(Inttegro.const_get(:OrderEnvelope), T::Class[T::Struct]) if path == "/orders/new"
524
578
 
525
579
  Inttegro::Operations::RESPONSE_MODELS[path]
526
580
  end
@@ -9,34 +9,12 @@ require_relative "types"
9
9
  module Inttegro
10
10
  extend T::Sig
11
11
 
12
- # Backward-compatible acronym spellings. New code should use the OpenAPI
13
- # names, which preserve acronyms exactly.
14
- InitiateOtpResponse = InitiateOTPResponse
15
- LookupOtpResponse = LookupOTPResponse
16
- VerifyOtpResponse = VerifyOTPResponse
12
+ # Backward-compatible acronym spellings for domain objects.
17
13
  OtpTransaction = OTPTransaction
18
14
  OtpTransmission = OTPTransmission
19
15
  OtpVerificationAttempt = OTPVerificationAttempt
20
16
 
21
- # Backward-compatible response names whose schemas now have a single,
22
- # endpoint-specific OpenAPI name.
23
- BalancesResponse = BalanceSnapshotResponse
24
- BalanceTransactionsResponse = BalanceTransactionPageResponse
25
- CustomerPageResponse = PageCustomersResponse
26
- ProductPageResponse = PageProductsResponse
27
- ScheduleChimeResponse = ScheduleResponse
28
- CountrySpecificationsResponse = ListCountrySpecsResponse
29
- FinancialAccountResponse = LookupFinancialAccountResponse
30
- PaymentMethodResponse = LookupPaymentMethodResponse
31
- PaymentMethodSettingsResponse = GetPaymentMethodSettingsResponse
32
- PayoutSettingsResponse = GetPayoutSettingsResponse
33
- PayoutPageResponse = PagePayoutsResponse
34
-
35
- class PaymentMethodVerificationResponse < T::Struct
36
- const :verification, T.nilable(PaymentMethodObjectVerification), default: nil
37
- end
38
-
39
- class PaymentMethodDeleteResponse < T::Struct
17
+ class PaymentMethodDeletion < T::Struct
40
18
  const :deleted, T::Boolean
41
19
  const :payment_method_id, String
42
20
  end
@@ -46,32 +24,6 @@ module Inttegro
46
24
  const :price_id, String
47
25
  end
48
26
 
49
- # /otp/cancel predates the public OpenAPI surface. Keep its SDK model typed
50
- # for compatibility without representing it as a documented operation.
51
- class OTPCanceledTransaction < T::Struct
52
- const :id, T.nilable(String), default: nil
53
- const :status, T.nilable(Inttegro::OTPStatus), default: nil
54
- const :full_message, T.nilable(String), default: nil
55
- const :recipient, T.nilable(String), default: nil
56
- const :sender, T.nilable(String), default: nil
57
- const :mechanism, T.nilable(String), default: nil
58
- const :gateway, T.nilable(String), default: nil
59
- const :preferred_gateway, T.nilable(String), default: nil
60
- const :created_at, T.nilable(String), default: nil
61
- const :delivered_at, T.nilable(String), default: nil
62
- const :verifiable_until, T.nilable(String), default: nil
63
- const :canceled_at, T.nilable(String), default: nil
64
- const :cancel_reason, T.nilable(String), default: nil
65
- end
66
-
67
- class CancelOTPResponse < T::Struct
68
- const :transaction, T.nilable(OTPCanceledTransaction), default: nil
69
- const :error, T.nilable(Error), default: nil
70
- end
71
-
72
- OtpCanceledTransaction = OTPCanceledTransaction
73
- CancelOtpResponse = CancelOTPResponse
74
-
75
27
  class BalanceTransaction
76
28
  extend T::Sig
77
29
 
@@ -9,15 +9,15 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def create(payload)
12
- @http.post_model("/apps/create", Inttegro::CreateApplicationResponse, payload)
12
+ @http.post_resource("/apps/create", Inttegro::Application, :app, payload)
13
13
  end
14
14
 
15
15
  def lookup
16
- @http.post_model("/apps/lookup", Inttegro::LookupApplicationResponse, {})
16
+ @http.post_resource("/apps/lookup", Inttegro::Application, :app, {})
17
17
  end
18
18
 
19
19
  def update(payload)
20
- @http.post_model("/apps/update", Inttegro::UpdateApplicationResponse, payload)
20
+ @http.post_resource("/apps/update", Inttegro::Application, :app, payload)
21
21
  end
22
22
  end
23
23
  end
@@ -9,17 +9,13 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def lookup(transaction_id:)
12
- @http.post_model(
13
- "/balance_transactions/lookup",
14
- Inttegro::BalanceTransactionResponse,
12
+ @http.post_resource("/balance_transactions/lookup", Inttegro::BalanceTransaction, :transaction,
15
13
  { transaction_id: transaction_id }
16
14
  )
17
15
  end
18
16
 
19
17
  def page(payload = {})
20
- @http.post_model(
21
- "/balance_transactions/page",
22
- Inttegro::BalanceTransactionPageResponse,
18
+ @http.post_resource("/balance_transactions/page", Inttegro::BalanceTransactionPage, :page,
23
19
  payload || {}
24
20
  )
25
21
  end
@@ -9,7 +9,7 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def get
12
- @http.post_model("/balances", Inttegro::BalanceSnapshotResponse, {})
12
+ @http.post_model("/balances", Inttegro::BalanceSnapshot, {})
13
13
  end
14
14
  end
15
15
  end
@@ -9,17 +9,13 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def lookup(broadcast_id:)
12
- @http.post_model(
13
- "/broadcasts/lookup",
14
- Inttegro::LookupBroadcastResponse,
12
+ @http.post_resource("/broadcasts/lookup", Inttegro::BroadcastDetail, :broadcast,
15
13
  { broadcast_id: broadcast_id }
16
14
  )
17
15
  end
18
16
 
19
17
  def cancel(broadcast_id:)
20
- @http.post_model(
21
- "/broadcasts/cancel",
22
- Inttegro::BroadcastCancelResponse,
18
+ @http.post_resource("/broadcasts/cancel", Inttegro::BroadcastCancelDetail, :broadcast,
23
19
  { broadcast_id: broadcast_id }
24
20
  )
25
21
  end
@@ -9,23 +9,23 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def send(payload)
12
- @http.post_model("/chimes/send", Inttegro::ChimeResponse, payload)
12
+ @http.post_resource("/chimes/send", Inttegro::Chime, :chime, payload)
13
13
  end
14
14
 
15
15
  def lookup(chime_id:)
16
- @http.post_model("/chimes/lookup", Inttegro::ChimeResponse, { chime_id: chime_id })
16
+ @http.post_resource("/chimes/lookup", Inttegro::Chime, :chime, { chime_id: chime_id })
17
17
  end
18
18
 
19
19
  def page(payload = {})
20
- @http.post_model("/chimes/page", Inttegro::PageChimesResponse, payload || {})
20
+ @http.post_resource("/chimes/page", Inttegro::ChimePage, :page, payload || {})
21
21
  end
22
22
 
23
23
  def schedule(payload)
24
- @http.post_model("/chimes/schedule", Inttegro::ScheduleResponse, payload)
24
+ @http.post_resource("/chimes/schedule", Inttegro::ScheduleCreationDetail, :scheduled_chime, payload)
25
25
  end
26
26
 
27
27
  def broadcast(payload)
28
- @http.post_model("/chimes/broadcast", Inttegro::BroadcastResponse, payload)
28
+ @http.post_resource("/chimes/broadcast", Inttegro::BroadcastCreationDetail, :broadcast, payload)
29
29
  end
30
30
  end
31
31
  end
@@ -9,19 +9,19 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def create(payload)
12
- @http.post_model("/customers/create", Inttegro::CustomerResponse, payload)
12
+ @http.post_resource("/customers/create", Inttegro::Customer, :customer, payload)
13
13
  end
14
14
 
15
15
  def update(payload)
16
- @http.post_model("/customers/update", Inttegro::CustomerResponse, payload)
16
+ @http.post_resource("/customers/update", Inttegro::Customer, :customer, payload)
17
17
  end
18
18
 
19
19
  def lookup(customer_id:)
20
- @http.post_model("/customers/lookup", Inttegro::CustomerResponse, { customer_id: customer_id })
20
+ @http.post_resource("/customers/lookup", Inttegro::Customer, :customer, { customer_id: customer_id })
21
21
  end
22
22
 
23
23
  def page(payload = {})
24
- @http.post_model("/customers/page", Inttegro::PageCustomersResponse, payload || {})
24
+ @http.post_resource("/customers/page", Inttegro::CustomerPage, :page, payload || {})
25
25
  end
26
26
  end
27
27
  end
@@ -11,24 +11,22 @@ module Inttegro
11
11
  def create(payload, idempotency_key: nil)
12
12
  @http.post_model(
13
13
  "/file_links/create",
14
- Inttegro::CreateFileLinkResponse,
14
+ Inttegro::FileLinkCreation,
15
15
  payload,
16
16
  headers: headers(idempotency_key)
17
17
  )
18
18
  end
19
19
 
20
20
  def lookup(id:)
21
- @http.post_model("/file_links/lookup", Inttegro::FileLinkResponse, { id: id })
21
+ @http.post_resource("/file_links/lookup", Inttegro::FileLink, :file_link, { id: id })
22
22
  end
23
23
 
24
24
  def page(payload = {})
25
- @http.post_model("/file_links/page", Inttegro::FileLinkPageResponse, payload || {})
25
+ @http.post_resource("/file_links/page", Inttegro::FileLinkPage, :page, payload || {})
26
26
  end
27
27
 
28
28
  def revoke(payload, idempotency_key: nil)
29
- @http.post_model(
30
- "/file_links/revoke",
31
- Inttegro::FileLinkResponse,
29
+ @http.post_resource("/file_links/revoke", Inttegro::FileLink, :file_link,
32
30
  payload,
33
31
  headers: headers(idempotency_key)
34
32
  )
@@ -11,7 +11,7 @@ module Inttegro
11
11
  def reconcile(payload)
12
12
  @http.post_model(
13
13
  "/file_references/reconcile",
14
- Inttegro::FileReferenceReconcileResponse,
14
+ Inttegro::FileReferenceReconciliation,
15
15
  payload
16
16
  )
17
17
  end
@@ -10,9 +10,7 @@ module Inttegro
10
10
 
11
11
  def create(file:, purpose:, title: nil, custom_data: nil, idempotency_key: nil)
12
12
  headers = idempotency_key ? { "Idempotency-Key" => idempotency_key } : {}
13
- @http.post_multipart_model(
14
- "/files/create",
15
- Inttegro::FileResponse,
13
+ @http.post_multipart_resource("/files/create", Inttegro::File, :file,
16
14
  fields: { purpose: purpose, title: title, custom_data: custom_data },
17
15
  files: { file: file },
18
16
  headers: headers
@@ -20,11 +18,11 @@ module Inttegro
20
18
  end
21
19
 
22
20
  def lookup(file_id:)
23
- @http.post_model("/files/lookup", Inttegro::FileResponse, { file_id: file_id })
21
+ @http.post_resource("/files/lookup", Inttegro::File, :file, { file_id: file_id })
24
22
  end
25
23
 
26
24
  def page(payload = {})
27
- @http.post_model("/files/page", Inttegro::FilePageResponse, payload || {})
25
+ @http.post_resource("/files/page", Inttegro::FilePage, :page, payload || {})
28
26
  end
29
27
 
30
28
  def contents(file_id:, disposition: "attachment")
@@ -32,7 +30,7 @@ module Inttegro
32
30
  end
33
31
 
34
32
  def delete(file_id:)
35
- @http.post_model("/files/delete", Inttegro::FileResponse, { file_id: file_id })
33
+ @http.post_resource("/files/delete", Inttegro::File, :file, { file_id: file_id })
36
34
  end
37
35
  end
38
36
  end
@@ -9,49 +9,49 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def create(payload)
12
- @http.post_model(
12
+ @http.post_resource(
13
13
  "/financial_accounts/create",
14
- Inttegro::CreateFinancialAccountResponse,
14
+ Inttegro::FinancialAccount, :account,
15
15
  payload
16
16
  )
17
17
  end
18
18
 
19
19
  def lookup(account_id:)
20
- @http.post_model(
20
+ @http.post_resource(
21
21
  "/financial_accounts/lookup",
22
- Inttegro::LookupFinancialAccountResponse,
22
+ Inttegro::FinancialAccount, :account,
23
23
  { account_id: account_id }
24
24
  )
25
25
  end
26
26
 
27
27
  def connect(payload)
28
- @http.post_model(
28
+ @http.post_resource(
29
29
  "/financial_accounts/connect",
30
- Inttegro::ConnectFinancialAccountResponse,
30
+ Inttegro::FinancialAccount, :account,
31
31
  payload
32
32
  )
33
33
  end
34
34
 
35
35
  def page(payload = {})
36
- @http.post_model(
36
+ @http.post_resource(
37
37
  "/financial_accounts/page",
38
- Inttegro::PageFinancialAccountsResponseInline,
38
+ Inttegro::FinancialAccountPage, :page,
39
39
  payload || {}
40
40
  )
41
41
  end
42
42
 
43
43
  def update(payload)
44
- @http.post_model(
44
+ @http.post_resource(
45
45
  "/financial_accounts/update",
46
- Inttegro::UpdateFinancialAccountResponse,
46
+ Inttegro::FinancialAccount, :account,
47
47
  payload
48
48
  )
49
49
  end
50
50
 
51
51
  def enable_push(account_id:)
52
- @http.post_model(
52
+ @http.post_resource(
53
53
  "/financial_accounts/enable_push",
54
- Inttegro::EnableFinancialAccountPushResponse,
54
+ Inttegro::FinancialAccount, :account,
55
55
  { account_id: account_id }
56
56
  )
57
57
  end
@@ -59,25 +59,25 @@ module Inttegro
59
59
  def disable_push(account_id:, unset_as_payout_destination: nil)
60
60
  payload = { account_id: account_id }
61
61
  payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
62
- @http.post_model(
62
+ @http.post_resource(
63
63
  "/financial_accounts/disable_push",
64
- Inttegro::DisableFinancialAccountPushResponse,
64
+ Inttegro::FinancialAccount, :account,
65
65
  payload
66
66
  )
67
67
  end
68
68
 
69
69
  def enable_pull(account_id:)
70
- @http.post_model(
70
+ @http.post_resource(
71
71
  "/financial_accounts/enable_pull",
72
- Inttegro::EnableFinancialAccountPullResponse,
72
+ Inttegro::FinancialAccount, :account,
73
73
  { account_id: account_id }
74
74
  )
75
75
  end
76
76
 
77
77
  def disable_pull(account_id:)
78
- @http.post_model(
78
+ @http.post_resource(
79
79
  "/financial_accounts/disable_pull",
80
- Inttegro::DisableFinancialAccountPullResponse,
80
+ Inttegro::FinancialAccount, :account,
81
81
  { account_id: account_id }
82
82
  )
83
83
  end
@@ -85,17 +85,17 @@ module Inttegro
85
85
  def disconnect(account_id:, unset_as_payout_destination: nil)
86
86
  payload = { account_id: account_id }
87
87
  payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
88
- @http.post_model(
88
+ @http.post_resource(
89
89
  "/financial_accounts/disconnect",
90
- Inttegro::DisconnectFinancialAccountResponse,
90
+ Inttegro::FinancialAccount, :account,
91
91
  payload
92
92
  )
93
93
  end
94
94
 
95
95
  def reconnect(account_id:)
96
- @http.post_model(
96
+ @http.post_resource(
97
97
  "/financial_accounts/reconnect",
98
- Inttegro::ReconnectFinancialAccountResponse,
98
+ Inttegro::FinancialAccount, :account,
99
99
  { account_id: account_id }
100
100
  )
101
101
  end
@@ -9,37 +9,35 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def generate(payload = {})
12
- @http.post_model("/keys/generate", Inttegro::GenerateSecretKeyResponse, payload || {})
12
+ @http.post_resource("/keys/generate", Inttegro::GeneratedSecretKey, :key, payload || {})
13
13
  end
14
14
 
15
15
  def page(payload = {})
16
- @http.post_model("/keys/page", Inttegro::PageSecretKeysResponse, payload || {})
16
+ @http.post_resource("/keys/page", Inttegro::SecretKeyPage, :page, payload || {})
17
17
  end
18
18
 
19
19
  def lookup(secret_key_id: nil, key_id: nil, id: nil)
20
- @http.post_model(
20
+ @http.post_resource(
21
21
  "/keys/lookup",
22
- Inttegro::LookupSecretKeyResponse,
22
+ Inttegro::SecretKey, :key,
23
23
  identifier_payload(secret_key_id, key_id, id)
24
24
  )
25
25
  end
26
26
 
27
27
  def update(payload)
28
- @http.post_model("/keys/update", Inttegro::UpdateSecretKeyResponse, payload)
28
+ @http.post_resource("/keys/update", Inttegro::SecretKey, :key, payload)
29
29
  end
30
30
 
31
31
  def destroy(secret_key_id: nil, key_id: nil, id: nil)
32
- @http.post_model(
32
+ @http.post_resource(
33
33
  "/keys/destroy",
34
- Inttegro::DestroySecretKeyResponse,
34
+ Inttegro::SecretKey, :key,
35
35
  identifier_payload(secret_key_id, key_id, id)
36
36
  )
37
37
  end
38
38
 
39
39
  def usage(secret_key_id: nil, key_id: nil, id: nil, **options)
40
- @http.post_model(
41
- "/keys/usage",
42
- Inttegro::SecretKeyUsageResponse,
40
+ @http.post_model("/keys/usage", Inttegro::SecretKeyUsage,
43
41
  identifier_payload(secret_key_id, key_id, id).merge(options)
44
42
  )
45
43
  end
@@ -9,61 +9,59 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def create(payload, idempotency_key: nil)
12
- @http.post_model(
12
+ @http.post_resource(
13
13
  "/message_templates/create",
14
- Inttegro::MessageTemplateEnvelope,
14
+ Inttegro::MessageTemplate, :message_template,
15
15
  payload,
16
16
  headers: idempotency_headers(idempotency_key)
17
17
  )
18
18
  end
19
19
 
20
20
  def update(payload, idempotency_key: nil)
21
- @http.post_model(
21
+ @http.post_resource(
22
22
  "/message_templates/update",
23
- Inttegro::MessageTemplateEnvelope,
23
+ Inttegro::MessageTemplate, :message_template,
24
24
  payload,
25
25
  headers: idempotency_headers(idempotency_key)
26
26
  )
27
27
  end
28
28
 
29
29
  def publish(template_id:, idempotency_key: nil)
30
- @http.post_model(
30
+ @http.post_resource(
31
31
  "/message_templates/publish",
32
- Inttegro::MessageTemplateEnvelope,
32
+ Inttegro::MessageTemplate, :message_template,
33
33
  { id: template_id },
34
34
  headers: idempotency_headers(idempotency_key)
35
35
  )
36
36
  end
37
37
 
38
38
  def archive(template_id:, idempotency_key: nil)
39
- @http.post_model(
39
+ @http.post_resource(
40
40
  "/message_templates/archive",
41
- Inttegro::MessageTemplateEnvelope,
41
+ Inttegro::MessageTemplate, :message_template,
42
42
  { id: template_id },
43
43
  headers: idempotency_headers(idempotency_key)
44
44
  )
45
45
  end
46
46
 
47
47
  def lookup(template_id:)
48
- @http.post_model(
48
+ @http.post_resource(
49
49
  "/message_templates/lookup",
50
- Inttegro::MessageTemplateEnvelope,
50
+ Inttegro::MessageTemplate, :message_template,
51
51
  { id: template_id }
52
52
  )
53
53
  end
54
54
 
55
55
  def page(payload = {})
56
- @http.post_model(
56
+ @http.post_resource(
57
57
  "/message_templates/page",
58
- Inttegro::MessageTemplatesPageEnvelope,
58
+ Inttegro::MessageTemplatesPage, :page,
59
59
  payload || {}
60
60
  )
61
61
  end
62
62
 
63
63
  def render_preview(payload)
64
- @http.post_model(
65
- "/message_templates/render_preview",
66
- Inttegro::RenderMessageTemplatePreviewResponse,
64
+ @http.post_model("/message_templates/render_preview", Inttegro::MessageTemplatePreview,
67
65
  payload
68
66
  )
69
67
  end