inttegro 1.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Dockerfile +1 -1
  4. data/README.md +9 -7
  5. data/SECURITY.md +11 -0
  6. data/lib/inttegro/enums.rb +2 -2
  7. data/lib/inttegro/file_download.rb +1 -1
  8. data/lib/inttegro/generated/enums.rb +221 -329
  9. data/lib/inttegro/generated/models.rb +3707 -3830
  10. data/lib/inttegro/generated/operations.rb +230 -230
  11. data/lib/inttegro/http_client.rb +62 -5
  12. data/lib/inttegro/models.rb +54 -105
  13. data/lib/inttegro/resources/apps.rb +3 -3
  14. data/lib/inttegro/resources/balance_transactions.rb +2 -6
  15. data/lib/inttegro/resources/balances.rb +1 -1
  16. data/lib/inttegro/resources/broadcasts.rb +2 -6
  17. data/lib/inttegro/resources/chimes.rb +5 -5
  18. data/lib/inttegro/resources/customers.rb +4 -4
  19. data/lib/inttegro/resources/file_links.rb +4 -6
  20. data/lib/inttegro/resources/file_references.rb +1 -1
  21. data/lib/inttegro/resources/files.rb +4 -6
  22. data/lib/inttegro/resources/financial_accounts.rb +22 -22
  23. data/lib/inttegro/resources/keys.rb +8 -10
  24. data/lib/inttegro/resources/message_templates.rb +13 -15
  25. data/lib/inttegro/resources/orders.rb +72 -69
  26. data/lib/inttegro/resources/otp.rb +4 -4
  27. data/lib/inttegro/resources/payment_methods.rb +34 -36
  28. data/lib/inttegro/resources/payouts.rb +28 -28
  29. data/lib/inttegro/resources/prices.rb +7 -7
  30. data/lib/inttegro/resources/products.rb +9 -9
  31. data/lib/inttegro/resources/purchase_intents.rb +8 -8
  32. data/lib/inttegro/resources/refunds.rb +6 -6
  33. data/lib/inttegro/resources/schedules.rb +4 -4
  34. data/lib/inttegro/resources/spec.rb +1 -1
  35. data/lib/inttegro/resources/upload_requests.rb +10 -10
  36. data/lib/inttegro/response_object.rb +1 -1
  37. data/lib/inttegro/version.rb +1 -1
  38. data/lib/inttegro.rb +15 -0
  39. data/rbi/inttegro/generated.rbi +124 -124
  40. metadata +3 -2
@@ -7,126 +7,75 @@ require_relative "generated/models"
7
7
  require_relative "types"
8
8
 
9
9
  module Inttegro
10
- module Models
11
- extend T::Sig
10
+ extend T::Sig
12
11
 
13
- # Backward-compatible acronym spellings. New code should use the OpenAPI
14
- # names, which preserve acronyms exactly.
15
- InitiateOtpResponse = InitiateOTPResponse
16
- LookupOtpResponse = LookupOTPResponse
17
- VerifyOtpResponse = VerifyOTPResponse
18
- OtpTransaction = OTPTransaction
19
- OtpTransmission = OTPTransmission
20
- OtpVerificationAttempt = OTPVerificationAttempt
12
+ # Backward-compatible acronym spellings for domain objects.
13
+ OtpTransaction = OTPTransaction
14
+ OtpTransmission = OTPTransmission
15
+ OtpVerificationAttempt = OTPVerificationAttempt
21
16
 
22
- # Backward-compatible response names whose schemas now have a single,
23
- # endpoint-specific OpenAPI name.
24
- BalancesResponse = BalanceSnapshotResponse
25
- BalanceTransactionsResponse = BalanceTransactionPageResponse
26
- CustomerPageResponse = PageCustomersResponse
27
- OrderPageResponse = PageOrdersResponse
28
- ProductPageResponse = PageProductsResponse
29
- ScheduleChimeResponse = ScheduleResponse
30
- CountrySpecificationsResponse = ListCountrySpecsResponse
31
- FinancialAccountResponse = LookupFinancialAccountResponse
32
- PaymentMethodResponse = LookupPaymentMethodResponse
33
- PaymentMethodSettingsResponse = GetPaymentMethodSettingsResponse
34
- PayoutSettingsResponse = GetPayoutSettingsResponse
35
- PayoutPageResponse = PagePayoutsResponse
17
+ class PaymentMethodDeletion < T::Struct
18
+ const :deleted, T::Boolean
19
+ const :payment_method_id, String
20
+ end
36
21
 
37
- class PaymentMethodVerificationResponse < T::Struct
38
- const :verification, T.nilable(PaymentMethodObjectVerification), default: nil
39
- end
22
+ class SetDefaultUnitPriceRequest < T::Struct
23
+ const :product_id, String
24
+ const :price_id, String
25
+ end
40
26
 
41
- class PaymentMethodDeleteResponse < T::Struct
42
- const :deleted, T::Boolean
43
- const :payment_method_id, String
44
- end
27
+ class BalanceTransaction
28
+ extend T::Sig
45
29
 
46
- class SetDefaultUnitPriceRequest < T::Struct
47
- const :product_id, String
48
- const :price_id, String
49
- end
30
+ sig { returns(T.nilable(String)) }
31
+ def source_id
32
+ payment = payment_id
33
+ refund = refund_id
34
+ if type == Inttegro::BalanceTransactionType::PAYMENT && payment && !payment.empty? && refund.nil?
35
+ return payment
36
+ end
37
+ if type == Inttegro::BalanceTransactionType::REFUND && refund && !refund.empty? && payment.nil?
38
+ return refund
39
+ end
50
40
 
51
- # /otp/cancel predates the public OpenAPI surface. Keep its SDK model typed
52
- # for compatibility without representing it as a documented operation.
53
- class OTPCanceledTransaction < T::Struct
54
- const :id, T.nilable(String), default: nil
55
- const :status, T.nilable(Inttegro::Enums::OTPStatus), default: nil
56
- const :full_message, T.nilable(String), default: nil
57
- const :recipient, T.nilable(String), default: nil
58
- const :sender, T.nilable(String), default: nil
59
- const :mechanism, T.nilable(String), default: nil
60
- const :gateway, T.nilable(String), default: nil
61
- const :preferred_gateway, T.nilable(String), default: nil
62
- const :created_at, T.nilable(String), default: nil
63
- const :delivered_at, T.nilable(String), default: nil
64
- const :verifiable_until, T.nilable(String), default: nil
65
- const :canceled_at, T.nilable(String), default: nil
66
- const :cancel_reason, T.nilable(String), default: nil
41
+ nil
67
42
  end
68
43
 
69
- class CancelOTPResponse < T::Struct
70
- const :transaction, T.nilable(OTPCanceledTransaction), default: nil
71
- const :error, T.nilable(Error), default: nil
44
+ sig { returns(T::Boolean) }
45
+ def valid_source?
46
+ !source_id.nil?
72
47
  end
73
48
 
74
- OtpCanceledTransaction = OTPCanceledTransaction
75
- CancelOtpResponse = CancelOTPResponse
76
-
77
- class BalanceTransaction
78
- extend T::Sig
79
-
80
- sig { returns(T.nilable(String)) }
81
- def source_id
82
- payment = payment_id
83
- refund = refund_id
84
- if type == Inttegro::Enums::BalanceTransactionType::PAYMENT && payment && !payment.empty? && refund.nil?
85
- return payment
86
- end
87
- if type == Inttegro::Enums::BalanceTransactionType::REFUND && refund && !refund.empty? && payment.nil?
88
- return refund
89
- end
90
-
91
- nil
92
- end
93
-
94
- sig { returns(T::Boolean) }
95
- def valid_source?
96
- !source_id.nil?
97
- end
98
-
99
- sig { returns(T::Boolean) }
100
- def valid?
101
- !id.empty? && !order_id.empty? && !created_at.empty? && valid_source?
102
- end
49
+ sig { returns(T::Boolean) }
50
+ def valid?
51
+ !id.empty? && !order_id.empty? && !created_at.empty? && valid_source?
103
52
  end
53
+ end
104
54
 
105
- sig { params(value: Object, klass: T::Class[T::Struct]).returns(T::Struct) }
106
- def self.deserialize(value, klass)
107
- data = stringify_json_keys(value)
108
- raise TypeError, "expected an object for #{klass}, got #{data.class}" unless data.is_a?(Hash)
55
+ sig { params(value: Object, klass: T::Class[T::Struct]).returns(T::Struct) }
56
+ def self.deserialize(value, klass)
57
+ data = stringify_json_keys(value)
58
+ raise TypeError, "expected an object for #{klass}, got #{data.class}" unless data.is_a?(Hash)
109
59
 
110
- T.cast(klass, T.class_of(T::Struct)).from_hash(data)
111
- end
60
+ T.cast(klass, T.class_of(T::Struct)).from_hash(data)
61
+ end
112
62
 
113
- sig { params(value: Object).returns(Object) }
114
- def self.stringify_json_keys(value)
115
- case value
116
- when T::Struct
117
- stringify_json_keys(value.serialize)
118
- when T::Enum
119
- value.serialize
120
- when Hash
121
- value.each_with_object({}) do |(key, item), output|
122
- output[key.to_s] = stringify_json_keys(item)
123
- end
124
- when Array
125
- value.map { |item| stringify_json_keys(item) }
126
- else
127
- value
63
+ sig { params(value: Object).returns(Object) }
64
+ def self.stringify_json_keys(value)
65
+ case value
66
+ when T::Struct
67
+ stringify_json_keys(value.serialize)
68
+ when T::Enum
69
+ value.serialize
70
+ when Hash
71
+ value.each_with_object({}) do |(key, item), output|
72
+ output[key.to_s] = stringify_json_keys(item)
128
73
  end
74
+ when Array
75
+ value.map { |item| stringify_json_keys(item) }
76
+ else
77
+ value
129
78
  end
130
- private_class_method :stringify_json_keys
131
79
  end
80
+ private_class_method :stringify_json_keys
132
81
  end
@@ -9,15 +9,15 @@ module Inttegro
9
9
  end
10
10
 
11
11
  def create(payload)
12
- @http.post_model("/apps/create", Inttegro::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::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::Models::RenderMessageTemplatePreviewResponse,
64
+ @http.post_model("/message_templates/render_preview", Inttegro::MessageTemplatePreview,
67
65
  payload
68
66
  )
69
67
  end