inttegro 1.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.
- checksums.yaml +7 -0
- data/.dockerignore +9 -0
- data/CHANGELOG.md +17 -0
- data/Dockerfile +23 -0
- data/LICENSE +21 -0
- data/README.md +104 -0
- data/Rakefile +50 -0
- data/lib/inttegro/client.rb +159 -0
- data/lib/inttegro/enums.rb +6 -0
- data/lib/inttegro/errors.rb +128 -0
- data/lib/inttegro/file_download.rb +29 -0
- data/lib/inttegro/generated/enums.rb +693 -0
- data/lib/inttegro/generated/models.rb +3840 -0
- data/lib/inttegro/generated/operations.rb +369 -0
- data/lib/inttegro/http_client.rb +639 -0
- data/lib/inttegro/models.rb +132 -0
- data/lib/inttegro/resources/apps.rb +24 -0
- data/lib/inttegro/resources/balance_transactions.rb +28 -0
- data/lib/inttegro/resources/balances.rb +16 -0
- data/lib/inttegro/resources/broadcasts.rb +28 -0
- data/lib/inttegro/resources/chimes.rb +32 -0
- data/lib/inttegro/resources/customers.rb +28 -0
- data/lib/inttegro/resources/file_links.rb +50 -0
- data/lib/inttegro/resources/file_references.rb +20 -0
- data/lib/inttegro/resources/files.rb +39 -0
- data/lib/inttegro/resources/financial_accounts.rb +104 -0
- data/lib/inttegro/resources/keys.rb +60 -0
- data/lib/inttegro/resources/message_templates.rb +78 -0
- data/lib/inttegro/resources/orders.rb +422 -0
- data/lib/inttegro/resources/otp.rb +30 -0
- data/lib/inttegro/resources/payment_methods.rb +250 -0
- data/lib/inttegro/resources/payouts.rb +200 -0
- data/lib/inttegro/resources/prices.rb +40 -0
- data/lib/inttegro/resources/products.rb +48 -0
- data/lib/inttegro/resources/purchase_intents.rb +44 -0
- data/lib/inttegro/resources/refunds.rb +36 -0
- data/lib/inttegro/resources/schedules.rb +28 -0
- data/lib/inttegro/resources/spec.rb +16 -0
- data/lib/inttegro/resources/upload_requests.rb +66 -0
- data/lib/inttegro/response_object.rb +86 -0
- data/lib/inttegro/transport_response.rb +65 -0
- data/lib/inttegro/types.rb +32 -0
- data/lib/inttegro/version.rb +6 -0
- data/lib/inttegro.rb +14 -0
- data/rbi/inttegro/generated.rbi +529 -0
- metadata +107 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
require "sorbet-runtime"
|
|
5
|
+
|
|
6
|
+
require_relative "generated/models"
|
|
7
|
+
require_relative "types"
|
|
8
|
+
|
|
9
|
+
module Inttegro
|
|
10
|
+
module Models
|
|
11
|
+
extend T::Sig
|
|
12
|
+
|
|
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
|
|
21
|
+
|
|
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
|
|
36
|
+
|
|
37
|
+
class PaymentMethodVerificationResponse < T::Struct
|
|
38
|
+
const :verification, T.nilable(PaymentMethodObjectVerification), default: nil
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class PaymentMethodDeleteResponse < T::Struct
|
|
42
|
+
const :deleted, T::Boolean
|
|
43
|
+
const :payment_method_id, String
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class SetDefaultUnitPriceRequest < T::Struct
|
|
47
|
+
const :product_id, String
|
|
48
|
+
const :price_id, String
|
|
49
|
+
end
|
|
50
|
+
|
|
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
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class CancelOTPResponse < T::Struct
|
|
70
|
+
const :transaction, T.nilable(OTPCanceledTransaction), default: nil
|
|
71
|
+
const :error, T.nilable(Error), default: nil
|
|
72
|
+
end
|
|
73
|
+
|
|
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
|
|
103
|
+
end
|
|
104
|
+
|
|
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)
|
|
109
|
+
|
|
110
|
+
T.cast(klass, T.class_of(T::Struct)).from_hash(data)
|
|
111
|
+
end
|
|
112
|
+
|
|
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
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
private_class_method :stringify_json_keys
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Apps
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/apps/create", Inttegro::Models::CreateApplicationResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def lookup
|
|
16
|
+
@http.post_model("/apps/lookup", Inttegro::Models::LookupApplicationResponse, {})
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def update(payload)
|
|
20
|
+
@http.post_model("/apps/update", Inttegro::Models::UpdateApplicationResponse, payload)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class BalanceTransactions
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def lookup(transaction_id:)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/balance_transactions/lookup",
|
|
14
|
+
Inttegro::Models::BalanceTransactionResponse,
|
|
15
|
+
{ transaction_id: transaction_id }
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def page(payload = {})
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/balance_transactions/page",
|
|
22
|
+
Inttegro::Models::BalanceTransactionPageResponse,
|
|
23
|
+
payload || {}
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Balances
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def get
|
|
12
|
+
@http.post_model("/balances", Inttegro::Models::BalanceSnapshotResponse, {})
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Broadcasts
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def lookup(broadcast_id:)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/broadcasts/lookup",
|
|
14
|
+
Inttegro::Models::LookupBroadcastResponse,
|
|
15
|
+
{ broadcast_id: broadcast_id }
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def cancel(broadcast_id:)
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/broadcasts/cancel",
|
|
22
|
+
Inttegro::Models::BroadcastCancelResponse,
|
|
23
|
+
{ broadcast_id: broadcast_id }
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Chimes
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def send(payload)
|
|
12
|
+
@http.post_model("/chimes/send", Inttegro::Models::ChimeResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def lookup(chime_id:)
|
|
16
|
+
@http.post_model("/chimes/lookup", Inttegro::Models::ChimeResponse, { chime_id: chime_id })
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def page(payload = {})
|
|
20
|
+
@http.post_model("/chimes/page", Inttegro::Models::PageChimesResponse, payload || {})
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def schedule(payload)
|
|
24
|
+
@http.post_model("/chimes/schedule", Inttegro::Models::ScheduleResponse, payload)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def broadcast(payload)
|
|
28
|
+
@http.post_model("/chimes/broadcast", Inttegro::Models::BroadcastResponse, payload)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Customers
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/customers/create", Inttegro::Models::CustomerResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def update(payload)
|
|
16
|
+
@http.post_model("/customers/update", Inttegro::Models::CustomerResponse, payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def lookup(customer_id:)
|
|
20
|
+
@http.post_model("/customers/lookup", Inttegro::Models::CustomerResponse, { customer_id: customer_id })
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def page(payload = {})
|
|
24
|
+
@http.post_model("/customers/page", Inttegro::Models::PageCustomersResponse, payload || {})
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class FileLinks
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload, idempotency_key: nil)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/file_links/create",
|
|
14
|
+
Inttegro::Models::CreateFileLinkResponse,
|
|
15
|
+
payload,
|
|
16
|
+
headers: headers(idempotency_key)
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def lookup(id:)
|
|
21
|
+
@http.post_model("/file_links/lookup", Inttegro::Models::FileLinkResponse, { id: id })
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def page(payload = {})
|
|
25
|
+
@http.post_model("/file_links/page", Inttegro::Models::FileLinkPageResponse, payload || {})
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def revoke(payload, idempotency_key: nil)
|
|
29
|
+
@http.post_model(
|
|
30
|
+
"/file_links/revoke",
|
|
31
|
+
Inttegro::Models::FileLinkResponse,
|
|
32
|
+
payload,
|
|
33
|
+
headers: headers(idempotency_key)
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def open(url, save_to: nil)
|
|
38
|
+
download = @http.get_binary_public(url)
|
|
39
|
+
download.save_to(save_to) if save_to
|
|
40
|
+
download
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def headers(idempotency_key)
|
|
46
|
+
idempotency_key ? { "Idempotency-Key" => idempotency_key } : {}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class FileReferences
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def reconcile(payload)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/file_references/reconcile",
|
|
14
|
+
Inttegro::Models::FileReferenceReconcileResponse,
|
|
15
|
+
payload
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Files
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(file:, purpose:, title: nil, custom_data: nil, idempotency_key: nil)
|
|
12
|
+
headers = idempotency_key ? { "Idempotency-Key" => idempotency_key } : {}
|
|
13
|
+
@http.post_multipart_model(
|
|
14
|
+
"/files/create",
|
|
15
|
+
Inttegro::Models::FileResponse,
|
|
16
|
+
fields: { purpose: purpose, title: title, custom_data: custom_data },
|
|
17
|
+
files: { file: file },
|
|
18
|
+
headers: headers
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def lookup(file_id:)
|
|
23
|
+
@http.post_model("/files/lookup", Inttegro::Models::FileResponse, { file_id: file_id })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def page(payload = {})
|
|
27
|
+
@http.post_model("/files/page", Inttegro::Models::FilePageResponse, payload || {})
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def contents(file_id:, disposition: "attachment")
|
|
31
|
+
@http.post_binary_json("/files/contents", { file_id: file_id, disposition: disposition })
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def delete(file_id:)
|
|
35
|
+
@http.post_model("/files/delete", Inttegro::Models::FileResponse, { file_id: file_id })
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class FinancialAccounts
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/financial_accounts/create",
|
|
14
|
+
Inttegro::Models::CreateFinancialAccountResponse,
|
|
15
|
+
payload
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def lookup(account_id:)
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/financial_accounts/lookup",
|
|
22
|
+
Inttegro::Models::LookupFinancialAccountResponse,
|
|
23
|
+
{ account_id: account_id }
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def connect(payload)
|
|
28
|
+
@http.post_model(
|
|
29
|
+
"/financial_accounts/connect",
|
|
30
|
+
Inttegro::Models::ConnectFinancialAccountResponse,
|
|
31
|
+
payload
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def page(payload = {})
|
|
36
|
+
@http.post_model(
|
|
37
|
+
"/financial_accounts/page",
|
|
38
|
+
Inttegro::Models::PageFinancialAccountsResponseInline,
|
|
39
|
+
payload || {}
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def update(payload)
|
|
44
|
+
@http.post_model(
|
|
45
|
+
"/financial_accounts/update",
|
|
46
|
+
Inttegro::Models::UpdateFinancialAccountResponse,
|
|
47
|
+
payload
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def enable_push(account_id:)
|
|
52
|
+
@http.post_model(
|
|
53
|
+
"/financial_accounts/enable_push",
|
|
54
|
+
Inttegro::Models::EnableFinancialAccountPushResponse,
|
|
55
|
+
{ account_id: account_id }
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def disable_push(account_id:, unset_as_payout_destination: nil)
|
|
60
|
+
payload = { account_id: account_id }
|
|
61
|
+
payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
|
|
62
|
+
@http.post_model(
|
|
63
|
+
"/financial_accounts/disable_push",
|
|
64
|
+
Inttegro::Models::DisableFinancialAccountPushResponse,
|
|
65
|
+
payload
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def enable_pull(account_id:)
|
|
70
|
+
@http.post_model(
|
|
71
|
+
"/financial_accounts/enable_pull",
|
|
72
|
+
Inttegro::Models::EnableFinancialAccountPullResponse,
|
|
73
|
+
{ account_id: account_id }
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def disable_pull(account_id:)
|
|
78
|
+
@http.post_model(
|
|
79
|
+
"/financial_accounts/disable_pull",
|
|
80
|
+
Inttegro::Models::DisableFinancialAccountPullResponse,
|
|
81
|
+
{ account_id: account_id }
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def disconnect(account_id:, unset_as_payout_destination: nil)
|
|
86
|
+
payload = { account_id: account_id }
|
|
87
|
+
payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
|
|
88
|
+
@http.post_model(
|
|
89
|
+
"/financial_accounts/disconnect",
|
|
90
|
+
Inttegro::Models::DisconnectFinancialAccountResponse,
|
|
91
|
+
payload
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def reconnect(account_id:)
|
|
96
|
+
@http.post_model(
|
|
97
|
+
"/financial_accounts/reconnect",
|
|
98
|
+
Inttegro::Models::ReconnectFinancialAccountResponse,
|
|
99
|
+
{ account_id: account_id }
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Keys
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def generate(payload = {})
|
|
12
|
+
@http.post_model("/keys/generate", Inttegro::Models::GenerateSecretKeyResponse, payload || {})
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def page(payload = {})
|
|
16
|
+
@http.post_model("/keys/page", Inttegro::Models::PageSecretKeysResponse, payload || {})
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def lookup(secret_key_id: nil, key_id: nil, id: nil)
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/keys/lookup",
|
|
22
|
+
Inttegro::Models::LookupSecretKeyResponse,
|
|
23
|
+
identifier_payload(secret_key_id, key_id, id)
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update(payload)
|
|
28
|
+
@http.post_model("/keys/update", Inttegro::Models::UpdateSecretKeyResponse, payload)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def destroy(secret_key_id: nil, key_id: nil, id: nil)
|
|
32
|
+
@http.post_model(
|
|
33
|
+
"/keys/destroy",
|
|
34
|
+
Inttegro::Models::DestroySecretKeyResponse,
|
|
35
|
+
identifier_payload(secret_key_id, key_id, id)
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def usage(secret_key_id: nil, key_id: nil, id: nil, **options)
|
|
40
|
+
@http.post_model(
|
|
41
|
+
"/keys/usage",
|
|
42
|
+
Inttegro::Models::SecretKeyUsageResponse,
|
|
43
|
+
identifier_payload(secret_key_id, key_id, id).merge(options)
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def identifier_payload(secret_key_id, key_id, id)
|
|
50
|
+
if secret_key_id
|
|
51
|
+
{ secret_key_id: secret_key_id }
|
|
52
|
+
elsif key_id
|
|
53
|
+
{ key_id: key_id }
|
|
54
|
+
else
|
|
55
|
+
{ id: id }
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class MessageTemplates
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload, idempotency_key: nil)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/message_templates/create",
|
|
14
|
+
Inttegro::Models::MessageTemplateEnvelope,
|
|
15
|
+
payload,
|
|
16
|
+
headers: idempotency_headers(idempotency_key)
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def update(payload, idempotency_key: nil)
|
|
21
|
+
@http.post_model(
|
|
22
|
+
"/message_templates/update",
|
|
23
|
+
Inttegro::Models::MessageTemplateEnvelope,
|
|
24
|
+
payload,
|
|
25
|
+
headers: idempotency_headers(idempotency_key)
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def publish(template_id:, idempotency_key: nil)
|
|
30
|
+
@http.post_model(
|
|
31
|
+
"/message_templates/publish",
|
|
32
|
+
Inttegro::Models::MessageTemplateEnvelope,
|
|
33
|
+
{ id: template_id },
|
|
34
|
+
headers: idempotency_headers(idempotency_key)
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def archive(template_id:, idempotency_key: nil)
|
|
39
|
+
@http.post_model(
|
|
40
|
+
"/message_templates/archive",
|
|
41
|
+
Inttegro::Models::MessageTemplateEnvelope,
|
|
42
|
+
{ id: template_id },
|
|
43
|
+
headers: idempotency_headers(idempotency_key)
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def lookup(template_id:)
|
|
48
|
+
@http.post_model(
|
|
49
|
+
"/message_templates/lookup",
|
|
50
|
+
Inttegro::Models::MessageTemplateEnvelope,
|
|
51
|
+
{ id: template_id }
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def page(payload = {})
|
|
56
|
+
@http.post_model(
|
|
57
|
+
"/message_templates/page",
|
|
58
|
+
Inttegro::Models::MessageTemplatesPageEnvelope,
|
|
59
|
+
payload || {}
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def render_preview(payload)
|
|
64
|
+
@http.post_model(
|
|
65
|
+
"/message_templates/render_preview",
|
|
66
|
+
Inttegro::Models::RenderMessageTemplatePreviewResponse,
|
|
67
|
+
payload
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private
|
|
72
|
+
|
|
73
|
+
def idempotency_headers(idempotency_key)
|
|
74
|
+
idempotency_key.to_s.strip.empty? ? {} : { "Idempotency-Key" => idempotency_key }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|