leal 0.0.13 → 0.0.15
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 +4 -4
- data/.fern/metadata.json +2 -2
- data/lib/leal/cards/types/create_cards_request_card.rb +8 -0
- data/lib/leal/cards/types/create_cards_request_card_qr_style.rb +14 -0
- data/lib/leal/cards/types/create_cards_response.rb +8 -0
- data/lib/leal/cards/types/get_cards_response.rb +8 -0
- data/lib/leal/cards/types/list_cards_response_item.rb +8 -0
- data/lib/leal/cards/types/update_cards_request_card.rb +8 -0
- data/lib/leal/cards/types/update_cards_request_card_qr_style.rb +14 -0
- data/lib/leal/cards/types/update_cards_response.rb +8 -0
- data/lib/leal/client.rb +6 -1
- data/lib/leal/customer_cards/client.rb +4 -2
- data/lib/leal/customer_cards/types/get_customer_cards_response.rb +6 -0
- data/lib/leal/customer_cards/types/get_customer_cards_response_referred_by.rb +19 -0
- data/lib/leal/customer_cards/types/list_customer_cards_response_item.rb +2 -0
- data/lib/leal/customer_cards/types/stamp_customer_cards_response.rb +6 -0
- data/lib/leal/customer_cards/types/stamp_customer_cards_response_referred_by.rb +19 -0
- data/lib/leal/customers/client.rb +3 -1
- data/lib/leal/customers/types/create_customers_request.rb +2 -0
- data/lib/leal/version.rb +1 -1
- data/lib/leal/webhook_subscriptions/client.rb +316 -0
- data/lib/leal/webhook_subscriptions/types/delete_api_v1accounts_account_id_webhook_subscriptions_id_request.rb +13 -0
- data/lib/leal/webhook_subscriptions/types/get_api_v1accounts_account_id_webhook_subscriptions_id_request.rb +13 -0
- data/lib/leal/webhook_subscriptions/types/get_api_v1accounts_account_id_webhook_subscriptions_id_response.rb +41 -0
- data/lib/leal/webhook_subscriptions/types/get_api_v1accounts_account_id_webhook_subscriptions_request.rb +13 -0
- data/lib/leal/webhook_subscriptions/types/get_api_v1accounts_account_id_webhook_subscriptions_response_item.rb +39 -0
- data/lib/leal/webhook_subscriptions/types/patch_api_v1accounts_account_id_webhook_subscriptions_id_request.rb +25 -0
- data/lib/leal/webhook_subscriptions/types/patch_api_v1accounts_account_id_webhook_subscriptions_id_response.rb +39 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_id_rotate_secret_request.rb +13 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_id_rotate_secret_response.rb +41 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_id_test_request.rb +13 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_id_test_response.rb +17 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_request.rb +23 -0
- data/lib/leal/webhook_subscriptions/types/post_api_v1accounts_account_id_webhook_subscriptions_response.rb +41 -0
- data/lib/leal.rb +18 -0
- data/reference.md +618 -4
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 041ecf0ebe5dde00f2be312f6b3370c3061f09e3c7bd939d5188b280896a0b9c
|
|
4
|
+
data.tar.gz: e9a796a097d629b4208a22897e23ef2518b6380bfb27b7d7f58dd3f390289ce6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02e7fd662bea9ac2def7bb857485148417e040eba292bb7bb0b478edba53e35e817a77359726a5fe21d14ed578c32b30bf92dda77fe09462b7b5409a60be0fca
|
|
7
|
+
data.tar.gz: ed17b2fc1af6d86ee1be7f351638b8fd0215deefc71bb3e9b8c31cc9c7aed322bcc1c72b51d12ace434c561c578270f0695339056f8d2ea90d4be6ce171928ac
|
data/.fern/metadata.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"cliVersion": "5.102.0",
|
|
3
3
|
"generatorName": "fernapi/fern-ruby-sdk",
|
|
4
4
|
"generatorVersion": "1.23.2",
|
|
5
|
-
"originGitCommit": "
|
|
5
|
+
"originGitCommit": "254da807428bdf6c997fa3a10a7e4a5960b0a6d9",
|
|
6
6
|
"originGitCommitIsDirty": false,
|
|
7
7
|
"invokedBy": "ci",
|
|
8
8
|
"ciProvider": "github",
|
|
9
|
-
"sdkVersion": "0.0.
|
|
9
|
+
"sdkVersion": "0.0.15"
|
|
10
10
|
}
|
|
@@ -16,6 +16,14 @@ module Leal
|
|
|
16
16
|
|
|
17
17
|
field :name, -> { String }, optional: false, nullable: false
|
|
18
18
|
|
|
19
|
+
field :qr_style, -> { Leal::Cards::Types::CreateCardsRequestCardQrStyle }, optional: true, nullable: false
|
|
20
|
+
|
|
21
|
+
field :referee_stamps, -> { Integer }, optional: true, nullable: false
|
|
22
|
+
|
|
23
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
24
|
+
|
|
25
|
+
field :referrer_stamps, -> { Integer }, optional: true, nullable: false
|
|
26
|
+
|
|
19
27
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
20
28
|
|
|
21
29
|
field :show_stamps_to_reward_field, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
@@ -24,6 +24,14 @@ module Leal
|
|
|
24
24
|
|
|
25
25
|
field :name, -> { String }, optional: false, nullable: false
|
|
26
26
|
|
|
27
|
+
field :qr_style, -> { String }, optional: false, nullable: false
|
|
28
|
+
|
|
29
|
+
field :referee_stamps, -> { Integer }, optional: false, nullable: false
|
|
30
|
+
|
|
31
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrer_stamps, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
27
35
|
field :rewards_count, -> { Integer }, optional: false, nullable: false
|
|
28
36
|
|
|
29
37
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
@@ -24,6 +24,14 @@ module Leal
|
|
|
24
24
|
|
|
25
25
|
field :name, -> { String }, optional: false, nullable: false
|
|
26
26
|
|
|
27
|
+
field :qr_style, -> { String }, optional: false, nullable: false
|
|
28
|
+
|
|
29
|
+
field :referee_stamps, -> { Integer }, optional: false, nullable: false
|
|
30
|
+
|
|
31
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrer_stamps, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
27
35
|
field :rewards_count, -> { Integer }, optional: false, nullable: false
|
|
28
36
|
|
|
29
37
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
@@ -24,6 +24,14 @@ module Leal
|
|
|
24
24
|
|
|
25
25
|
field :name, -> { String }, optional: false, nullable: false
|
|
26
26
|
|
|
27
|
+
field :qr_style, -> { String }, optional: false, nullable: false
|
|
28
|
+
|
|
29
|
+
field :referee_stamps, -> { Integer }, optional: false, nullable: false
|
|
30
|
+
|
|
31
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrer_stamps, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
27
35
|
field :rewards_count, -> { Integer }, optional: false, nullable: false
|
|
28
36
|
|
|
29
37
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
@@ -16,6 +16,14 @@ module Leal
|
|
|
16
16
|
|
|
17
17
|
field :name, -> { String }, optional: true, nullable: false
|
|
18
18
|
|
|
19
|
+
field :qr_style, -> { Leal::Cards::Types::UpdateCardsRequestCardQrStyle }, optional: true, nullable: false
|
|
20
|
+
|
|
21
|
+
field :referee_stamps, -> { Integer }, optional: true, nullable: false
|
|
22
|
+
|
|
23
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
24
|
+
|
|
25
|
+
field :referrer_stamps, -> { Integer }, optional: true, nullable: false
|
|
26
|
+
|
|
19
27
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
20
28
|
|
|
21
29
|
field :show_stamps_to_reward_field, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
@@ -24,6 +24,14 @@ module Leal
|
|
|
24
24
|
|
|
25
25
|
field :name, -> { String }, optional: false, nullable: false
|
|
26
26
|
|
|
27
|
+
field :qr_style, -> { String }, optional: false, nullable: false
|
|
28
|
+
|
|
29
|
+
field :referee_stamps, -> { Integer }, optional: false, nullable: false
|
|
30
|
+
|
|
31
|
+
field :referrals_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrer_stamps, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
27
35
|
field :rewards_count, -> { Integer }, optional: false, nullable: false
|
|
28
36
|
|
|
29
37
|
field :show_member_field, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
data/lib/leal/client.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Leal
|
|
|
11
11
|
@raw_client = Leal::Internal::Http::RawClient.new(
|
|
12
12
|
base_url: base_url || Leal::Environment::PRODUCTION,
|
|
13
13
|
headers: {
|
|
14
|
-
"User-Agent" => "leal/0.0.
|
|
14
|
+
"User-Agent" => "leal/0.0.15",
|
|
15
15
|
"X-Fern-Language" => "Ruby",
|
|
16
16
|
Authorization: "Bearer #{token}"
|
|
17
17
|
},
|
|
@@ -54,6 +54,11 @@ module Leal
|
|
|
54
54
|
@rewards ||= Leal::Rewards::Client.new(client: @raw_client)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
# @return [Leal::WebhookSubscriptions::Client]
|
|
58
|
+
def webhook_subscriptions
|
|
59
|
+
@webhook_subscriptions ||= Leal::WebhookSubscriptions::Client.new(client: @raw_client)
|
|
60
|
+
end
|
|
61
|
+
|
|
57
62
|
# @return [Leal::Status::Client]
|
|
58
63
|
def status
|
|
59
64
|
@status ||= Leal::Status::Client.new(client: @raw_client)
|
|
@@ -149,8 +149,10 @@ module Leal
|
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
# Adds stamps to a customer's loyalty card. Triggers ledger entries
|
|
153
|
-
# and push notifications. Pass `skip_notifications` to stamp silently.
|
|
152
|
+
# Adds stamps to a customer's loyalty card. Triggers ledger entries (`entry_type` `api`),
|
|
153
|
+
# wallet pass updates, and push notifications. Pass `skip_notifications` to stamp silently.
|
|
154
|
+
# Call it for real visits or purchases: if this customer joined with a friend's invite, the
|
|
155
|
+
# first call pays out the referral to both of them.
|
|
154
156
|
#
|
|
155
157
|
# @param request_options [Hash]
|
|
156
158
|
# @param params [Leal::CustomerCards::Types::StampCustomerCardsRequest]
|
|
@@ -28,6 +28,12 @@ module Leal
|
|
|
28
28
|
|
|
29
29
|
field :progress_percentage, -> { Integer }, optional: false, nullable: false
|
|
30
30
|
|
|
31
|
+
field :referral_url, -> { String }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrals_count, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
35
|
+
field :referred_by, -> { Leal::CustomerCards::Types::GetCustomerCardsResponseReferredBy }, optional: false, nullable: false
|
|
36
|
+
|
|
31
37
|
field :stamps_count, -> { Integer }, optional: false, nullable: false
|
|
32
38
|
|
|
33
39
|
field :stamps_remaining, -> { Integer }, optional: false, nullable: false
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Leal
|
|
4
|
+
module CustomerCards
|
|
5
|
+
module Types
|
|
6
|
+
class GetCustomerCardsResponseReferredBy < Internal::Types::Model
|
|
7
|
+
field :customer_card_id, -> { Integer }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :customer_id, -> { Integer }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :referral_id, -> { Integer }, optional: false, nullable: false
|
|
12
|
+
|
|
13
|
+
field :rewarded_at, -> { String }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :status, -> { String }, optional: false, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -22,6 +22,8 @@ module Leal
|
|
|
22
22
|
|
|
23
23
|
field :progress_percentage, -> { Integer }, optional: false, nullable: false
|
|
24
24
|
|
|
25
|
+
field :referral_url, -> { String }, optional: false, nullable: false
|
|
26
|
+
|
|
25
27
|
field :stamps_count, -> { Integer }, optional: false, nullable: false
|
|
26
28
|
|
|
27
29
|
field :stamps_remaining, -> { Integer }, optional: false, nullable: false
|
|
@@ -28,6 +28,12 @@ module Leal
|
|
|
28
28
|
|
|
29
29
|
field :progress_percentage, -> { Integer }, optional: false, nullable: false
|
|
30
30
|
|
|
31
|
+
field :referral_url, -> { String }, optional: false, nullable: false
|
|
32
|
+
|
|
33
|
+
field :referrals_count, -> { Integer }, optional: false, nullable: false
|
|
34
|
+
|
|
35
|
+
field :referred_by, -> { Leal::CustomerCards::Types::StampCustomerCardsResponseReferredBy }, optional: false, nullable: false
|
|
36
|
+
|
|
31
37
|
field :stamps_count, -> { Integer }, optional: false, nullable: false
|
|
32
38
|
|
|
33
39
|
field :stamps_remaining, -> { Integer }, optional: false, nullable: false
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Leal
|
|
4
|
+
module CustomerCards
|
|
5
|
+
module Types
|
|
6
|
+
class StampCustomerCardsResponseReferredBy < Internal::Types::Model
|
|
7
|
+
field :customer_card_id, -> { Integer }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :customer_id, -> { Integer }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :referral_id, -> { Integer }, optional: false, nullable: false
|
|
12
|
+
|
|
13
|
+
field :rewarded_at, -> { String }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :status, -> { String }, optional: false, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -11,7 +11,9 @@ module Leal
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# Returns a paginated list of customers for the store. Use the `search` parameter to filter
|
|
14
|
-
# by name, email, phone, card code (barcode), or external reference ID.
|
|
14
|
+
# by name, email, phone, card code (barcode), or external reference ID. A scanned wallet pass
|
|
15
|
+
# QR can be passed as it is: newer passes hold a link with the card code after the `#`, and
|
|
16
|
+
# that is matched to the card exactly. Alternatively, pass
|
|
15
17
|
# `source` AND `external_id` together to perform an exact lookup by an external reference -
|
|
16
18
|
# the response will contain at most one customer.
|
|
17
19
|
#
|
|
@@ -10,6 +10,8 @@ module Leal
|
|
|
10
10
|
|
|
11
11
|
field :customer, -> { Leal::Customers::Types::CreateCustomersRequestCustomer }, optional: false, nullable: false
|
|
12
12
|
|
|
13
|
+
field :referral_code, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
13
15
|
field :send_card_links, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
14
16
|
end
|
|
15
17
|
end
|
data/lib/leal/version.rb
CHANGED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Leal
|
|
4
|
+
module WebhookSubscriptions
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Leal::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Returns every webhook subscription for the store, oldest first. Signing secrets are not included; fetch a single
|
|
14
|
+
# subscription to read its secret.
|
|
15
|
+
#
|
|
16
|
+
# @param request_options [Hash]
|
|
17
|
+
# @param params [Hash]
|
|
18
|
+
# @option request_options [String] :base_url
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
21
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
22
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
23
|
+
# @option params [Integer] :account_id
|
|
24
|
+
# @option params [String, nil] :event
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# client.webhook_subscriptions.get_api_v1accounts_account_id_webhook_subscriptions(account_id: 1)
|
|
28
|
+
#
|
|
29
|
+
# @return [Array[Leal::WebhookSubscriptions::Types::GetAPIV1AccountsAccountIDWebhookSubscriptionsResponseItem]]
|
|
30
|
+
def get_api_v1accounts_account_id_webhook_subscriptions(request_options: {}, **params)
|
|
31
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
32
|
+
query_params = {}
|
|
33
|
+
query_params["event"] = params[:event] if params.key?(:event)
|
|
34
|
+
|
|
35
|
+
request = Leal::Internal::JSON::Request.new(
|
|
36
|
+
base_url: request_options[:base_url],
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions",
|
|
39
|
+
query: query_params,
|
|
40
|
+
request_options: request_options
|
|
41
|
+
)
|
|
42
|
+
begin
|
|
43
|
+
response = @client.send(request)
|
|
44
|
+
rescue Net::HTTPRequestTimeout
|
|
45
|
+
raise Leal::Errors::TimeoutError
|
|
46
|
+
end
|
|
47
|
+
code = response.code.to_i
|
|
48
|
+
return if code.between?(200, 299)
|
|
49
|
+
|
|
50
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
51
|
+
raise error_class.new(response.body, code: code)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Subscribes a URL to one or more events. The response includes the signing `secret`; store it to
|
|
55
|
+
# verify deliveries. The URL must be publicly reachable over https.
|
|
56
|
+
#
|
|
57
|
+
# Events: `customer.created`, `customer.updated`, `customer_card.created`, `stamp.earned`, `stamp.removed`,
|
|
58
|
+
# `reward.unlocked`, `reward.redeemed`, `referral.created`, `referral.rewarded`, or `*` for all of them.
|
|
59
|
+
#
|
|
60
|
+
# @param request_options [Hash]
|
|
61
|
+
# @param params [Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsRequest]
|
|
62
|
+
# @option request_options [String] :base_url
|
|
63
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
64
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
65
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
66
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
67
|
+
# @option params [Integer] :account_id
|
|
68
|
+
#
|
|
69
|
+
# @example
|
|
70
|
+
# client.webhook_subscriptions.post_api_v1accounts_account_id_webhook_subscriptions(
|
|
71
|
+
# account_id: 1,
|
|
72
|
+
# target_url: "target_url"
|
|
73
|
+
# )
|
|
74
|
+
#
|
|
75
|
+
# @return [Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsResponse]
|
|
76
|
+
def post_api_v1accounts_account_id_webhook_subscriptions(request_options: {}, **params)
|
|
77
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
78
|
+
request_data = Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsRequest.new(params).to_h
|
|
79
|
+
non_body_param_names = %w[account_id]
|
|
80
|
+
body = request_data.except(*non_body_param_names)
|
|
81
|
+
|
|
82
|
+
request = Leal::Internal::JSON::Request.new(
|
|
83
|
+
base_url: request_options[:base_url],
|
|
84
|
+
method: "POST",
|
|
85
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions",
|
|
86
|
+
body: body,
|
|
87
|
+
request_options: request_options
|
|
88
|
+
)
|
|
89
|
+
begin
|
|
90
|
+
response = @client.send(request)
|
|
91
|
+
rescue Net::HTTPRequestTimeout
|
|
92
|
+
raise Leal::Errors::TimeoutError
|
|
93
|
+
end
|
|
94
|
+
code = response.code.to_i
|
|
95
|
+
if code.between?(200, 299)
|
|
96
|
+
Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsResponse.load(response.body)
|
|
97
|
+
else
|
|
98
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
99
|
+
raise error_class.new(response.body, code: code)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a single subscription, including its signing secret and the result of the most recent delivery.
|
|
104
|
+
#
|
|
105
|
+
# @param request_options [Hash]
|
|
106
|
+
# @param params [Hash]
|
|
107
|
+
# @option request_options [String] :base_url
|
|
108
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
109
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
110
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
111
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
112
|
+
# @option params [Integer] :account_id
|
|
113
|
+
# @option params [Integer] :id
|
|
114
|
+
#
|
|
115
|
+
# @example
|
|
116
|
+
# client.webhook_subscriptions.get_api_v1accounts_account_id_webhook_subscriptions_id(
|
|
117
|
+
# account_id: 1,
|
|
118
|
+
# id: 1
|
|
119
|
+
# )
|
|
120
|
+
#
|
|
121
|
+
# @return [Leal::WebhookSubscriptions::Types::GetAPIV1AccountsAccountIDWebhookSubscriptionsIDResponse]
|
|
122
|
+
def get_api_v1accounts_account_id_webhook_subscriptions_id(request_options: {}, **params)
|
|
123
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
124
|
+
request = Leal::Internal::JSON::Request.new(
|
|
125
|
+
base_url: request_options[:base_url],
|
|
126
|
+
method: "GET",
|
|
127
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
128
|
+
request_options: request_options
|
|
129
|
+
)
|
|
130
|
+
begin
|
|
131
|
+
response = @client.send(request)
|
|
132
|
+
rescue Net::HTTPRequestTimeout
|
|
133
|
+
raise Leal::Errors::TimeoutError
|
|
134
|
+
end
|
|
135
|
+
code = response.code.to_i
|
|
136
|
+
if code.between?(200, 299)
|
|
137
|
+
Leal::WebhookSubscriptions::Types::GetAPIV1AccountsAccountIDWebhookSubscriptionsIDResponse.load(response.body)
|
|
138
|
+
else
|
|
139
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
140
|
+
raise error_class.new(response.body, code: code)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Stops deliveries and deletes the subscription. This cannot be undone.
|
|
145
|
+
#
|
|
146
|
+
# @param request_options [Hash]
|
|
147
|
+
# @param params [Hash]
|
|
148
|
+
# @option request_options [String] :base_url
|
|
149
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
150
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
151
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
152
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
153
|
+
# @option params [Integer] :account_id
|
|
154
|
+
# @option params [Integer] :id
|
|
155
|
+
#
|
|
156
|
+
# @example
|
|
157
|
+
# client.webhook_subscriptions.delete_api_v1accounts_account_id_webhook_subscriptions_id(
|
|
158
|
+
# account_id: 1,
|
|
159
|
+
# id: 1
|
|
160
|
+
# )
|
|
161
|
+
#
|
|
162
|
+
# @return [untyped]
|
|
163
|
+
def delete_api_v1accounts_account_id_webhook_subscriptions_id(request_options: {}, **params)
|
|
164
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
165
|
+
request = Leal::Internal::JSON::Request.new(
|
|
166
|
+
base_url: request_options[:base_url],
|
|
167
|
+
method: "DELETE",
|
|
168
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
169
|
+
request_options: request_options
|
|
170
|
+
)
|
|
171
|
+
begin
|
|
172
|
+
response = @client.send(request)
|
|
173
|
+
rescue Net::HTTPRequestTimeout
|
|
174
|
+
raise Leal::Errors::TimeoutError
|
|
175
|
+
end
|
|
176
|
+
code = response.code.to_i
|
|
177
|
+
return if code.between?(200, 299)
|
|
178
|
+
|
|
179
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
180
|
+
raise error_class.new(response.body, code: code)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Changes the URL, events, label or payload format, or turns the subscription off and on. Re-enabling a
|
|
184
|
+
# subscription that was disabled for failing clears its failure state.
|
|
185
|
+
#
|
|
186
|
+
# @param request_options [Hash]
|
|
187
|
+
# @param params [Leal::WebhookSubscriptions::Types::PatchAPIV1AccountsAccountIDWebhookSubscriptionsIDRequest]
|
|
188
|
+
# @option request_options [String] :base_url
|
|
189
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
190
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
191
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
192
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
193
|
+
# @option params [Integer] :account_id
|
|
194
|
+
# @option params [Integer] :id
|
|
195
|
+
#
|
|
196
|
+
# @example
|
|
197
|
+
# client.webhook_subscriptions.patch_api_v1accounts_account_id_webhook_subscriptions_id(
|
|
198
|
+
# account_id: 1,
|
|
199
|
+
# id: 1
|
|
200
|
+
# )
|
|
201
|
+
#
|
|
202
|
+
# @return [Leal::WebhookSubscriptions::Types::PatchAPIV1AccountsAccountIDWebhookSubscriptionsIDResponse]
|
|
203
|
+
def patch_api_v1accounts_account_id_webhook_subscriptions_id(request_options: {}, **params)
|
|
204
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
205
|
+
request_data = Leal::WebhookSubscriptions::Types::PatchAPIV1AccountsAccountIDWebhookSubscriptionsIDRequest.new(params).to_h
|
|
206
|
+
non_body_param_names = %w[account_id id]
|
|
207
|
+
body = request_data.except(*non_body_param_names)
|
|
208
|
+
|
|
209
|
+
request = Leal::Internal::JSON::Request.new(
|
|
210
|
+
base_url: request_options[:base_url],
|
|
211
|
+
method: "PATCH",
|
|
212
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
213
|
+
body: body,
|
|
214
|
+
request_options: request_options
|
|
215
|
+
)
|
|
216
|
+
begin
|
|
217
|
+
response = @client.send(request)
|
|
218
|
+
rescue Net::HTTPRequestTimeout
|
|
219
|
+
raise Leal::Errors::TimeoutError
|
|
220
|
+
end
|
|
221
|
+
code = response.code.to_i
|
|
222
|
+
if code.between?(200, 299)
|
|
223
|
+
Leal::WebhookSubscriptions::Types::PatchAPIV1AccountsAccountIDWebhookSubscriptionsIDResponse.load(response.body)
|
|
224
|
+
else
|
|
225
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
226
|
+
raise error_class.new(response.body, code: code)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Replaces the subscription's signing secret. Deliveries are signed with the new secret straight away, so update
|
|
231
|
+
# your receiver at the same time.
|
|
232
|
+
#
|
|
233
|
+
# @param request_options [Hash]
|
|
234
|
+
# @param params [Hash]
|
|
235
|
+
# @option request_options [String] :base_url
|
|
236
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
237
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
238
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
239
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
240
|
+
# @option params [Integer] :account_id
|
|
241
|
+
# @option params [Integer] :id
|
|
242
|
+
#
|
|
243
|
+
# @example
|
|
244
|
+
# client.webhook_subscriptions.post_api_v1accounts_account_id_webhook_subscriptions_id_rotate_secret(
|
|
245
|
+
# account_id: 1,
|
|
246
|
+
# id: 1
|
|
247
|
+
# )
|
|
248
|
+
#
|
|
249
|
+
# @return [Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsIDRotateSecretResponse]
|
|
250
|
+
def post_api_v1accounts_account_id_webhook_subscriptions_id_rotate_secret(request_options: {}, **params)
|
|
251
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
252
|
+
request = Leal::Internal::JSON::Request.new(
|
|
253
|
+
base_url: request_options[:base_url],
|
|
254
|
+
method: "POST",
|
|
255
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions/#{URI.encode_uri_component(params[:id].to_s)}/rotate_secret",
|
|
256
|
+
request_options: request_options
|
|
257
|
+
)
|
|
258
|
+
begin
|
|
259
|
+
response = @client.send(request)
|
|
260
|
+
rescue Net::HTTPRequestTimeout
|
|
261
|
+
raise Leal::Errors::TimeoutError
|
|
262
|
+
end
|
|
263
|
+
code = response.code.to_i
|
|
264
|
+
if code.between?(200, 299)
|
|
265
|
+
Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsIDRotateSecretResponse.load(response.body)
|
|
266
|
+
else
|
|
267
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
268
|
+
raise error_class.new(response.body, code: code)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Immediately sends a signed `webhook.test` event to the subscription's URL and reports what
|
|
273
|
+
# happened, so you can check your endpoint and signature verification without waiting for real
|
|
274
|
+
# activity. Test events are not retried and do not count towards disabling the subscription.
|
|
275
|
+
#
|
|
276
|
+
# @param request_options [Hash]
|
|
277
|
+
# @param params [Hash]
|
|
278
|
+
# @option request_options [String] :base_url
|
|
279
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
280
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
281
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
282
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
283
|
+
# @option params [Integer] :account_id
|
|
284
|
+
# @option params [Integer] :id
|
|
285
|
+
#
|
|
286
|
+
# @example
|
|
287
|
+
# client.webhook_subscriptions.post_api_v1accounts_account_id_webhook_subscriptions_id_test(
|
|
288
|
+
# account_id: 1,
|
|
289
|
+
# id: 1
|
|
290
|
+
# )
|
|
291
|
+
#
|
|
292
|
+
# @return [Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsIDTestResponse]
|
|
293
|
+
def post_api_v1accounts_account_id_webhook_subscriptions_id_test(request_options: {}, **params)
|
|
294
|
+
params = Leal::Internal::Types::Utils.normalize_keys(params)
|
|
295
|
+
request = Leal::Internal::JSON::Request.new(
|
|
296
|
+
base_url: request_options[:base_url],
|
|
297
|
+
method: "POST",
|
|
298
|
+
path: "api/v1/accounts/#{URI.encode_uri_component(params[:account_id].to_s)}/webhook_subscriptions/#{URI.encode_uri_component(params[:id].to_s)}/test",
|
|
299
|
+
request_options: request_options
|
|
300
|
+
)
|
|
301
|
+
begin
|
|
302
|
+
response = @client.send(request)
|
|
303
|
+
rescue Net::HTTPRequestTimeout
|
|
304
|
+
raise Leal::Errors::TimeoutError
|
|
305
|
+
end
|
|
306
|
+
code = response.code.to_i
|
|
307
|
+
if code.between?(200, 299)
|
|
308
|
+
Leal::WebhookSubscriptions::Types::PostAPIV1AccountsAccountIDWebhookSubscriptionsIDTestResponse.load(response.body)
|
|
309
|
+
else
|
|
310
|
+
error_class = Leal::Errors::ResponseError.subclass_for_code(code)
|
|
311
|
+
raise error_class.new(response.body, code: code)
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Leal
|
|
4
|
+
module WebhookSubscriptions
|
|
5
|
+
module Types
|
|
6
|
+
class DeleteAPIV1AccountsAccountIDWebhookSubscriptionsIDRequest < Internal::Types::Model
|
|
7
|
+
field :account_id, -> { Integer }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :id, -> { Integer }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Leal
|
|
4
|
+
module WebhookSubscriptions
|
|
5
|
+
module Types
|
|
6
|
+
class GetAPIV1AccountsAccountIDWebhookSubscriptionsIDRequest < Internal::Types::Model
|
|
7
|
+
field :account_id, -> { Integer }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :id, -> { Integer }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|