stigg 0.1.0.pre.alpha.1
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/.ignore +2 -0
- data/CHANGELOG.md +45 -0
- data/README.md +233 -0
- data/SECURITY.md +23 -0
- data/lib/stigg/client.rb +72 -0
- data/lib/stigg/errors.rb +228 -0
- data/lib/stigg/file_part.rb +58 -0
- data/lib/stigg/internal/my_cursor_id_page.rb +82 -0
- data/lib/stigg/internal/transport/base_client.rb +570 -0
- data/lib/stigg/internal/transport/pooled_net_requester.rb +210 -0
- data/lib/stigg/internal/type/array_of.rb +168 -0
- data/lib/stigg/internal/type/base_model.rb +529 -0
- data/lib/stigg/internal/type/base_page.rb +55 -0
- data/lib/stigg/internal/type/boolean.rb +77 -0
- data/lib/stigg/internal/type/converter.rb +327 -0
- data/lib/stigg/internal/type/enum.rb +131 -0
- data/lib/stigg/internal/type/file_input.rb +110 -0
- data/lib/stigg/internal/type/hash_of.rb +188 -0
- data/lib/stigg/internal/type/request_parameters.rb +42 -0
- data/lib/stigg/internal/type/union.rb +237 -0
- data/lib/stigg/internal/type/unknown.rb +81 -0
- data/lib/stigg/internal/util.rb +920 -0
- data/lib/stigg/internal.rb +20 -0
- data/lib/stigg/models/v1/coupon_create_params.rb +221 -0
- data/lib/stigg/models/v1/coupon_create_response.rb +317 -0
- data/lib/stigg/models/v1/coupon_list_params.rb +40 -0
- data/lib/stigg/models/v1/coupon_list_response.rb +324 -0
- data/lib/stigg/models/v1/coupon_retrieve_params.rb +16 -0
- data/lib/stigg/models/v1/coupon_retrieve_response.rb +317 -0
- data/lib/stigg/models/v1/customer_archive_params.rb +16 -0
- data/lib/stigg/models/v1/customer_create_params.rb +185 -0
- data/lib/stigg/models/v1/customer_list_params.rb +40 -0
- data/lib/stigg/models/v1/customer_list_response.rb +223 -0
- data/lib/stigg/models/v1/customer_response.rb +216 -0
- data/lib/stigg/models/v1/customer_retrieve_params.rb +16 -0
- data/lib/stigg/models/v1/customer_unarchive_params.rb +16 -0
- data/lib/stigg/models/v1/customer_update_params.rb +107 -0
- data/lib/stigg/models/v1/customers/payment_method_attach_params.rb +197 -0
- data/lib/stigg/models/v1/customers/payment_method_detach_params.rb +18 -0
- data/lib/stigg/models/v1/customers/promotional_create_params.rb +294 -0
- data/lib/stigg/models/v1/customers/promotional_create_response.rb +268 -0
- data/lib/stigg/models/v1/customers/promotional_revoke_params.rb +24 -0
- data/lib/stigg/models/v1/customers/promotional_revoke_response.rb +268 -0
- data/lib/stigg/models/v1/customers/usage_retrieve_params.rb +56 -0
- data/lib/stigg/models/v1/customers/usage_retrieve_response.rb +145 -0
- data/lib/stigg/models/v1/subscription_create_params.rb +214 -0
- data/lib/stigg/models/v1/subscription_create_response.rb +338 -0
- data/lib/stigg/models/v1/subscription_delegate_params.rb +24 -0
- data/lib/stigg/models/v1/subscription_delegate_response.rb +274 -0
- data/lib/stigg/models/v1/subscription_list_params.rb +60 -0
- data/lib/stigg/models/v1/subscription_list_response.rb +281 -0
- data/lib/stigg/models/v1/subscription_migrate_params.rb +37 -0
- data/lib/stigg/models/v1/subscription_migrate_response.rb +274 -0
- data/lib/stigg/models/v1/subscription_preview_params.rb +644 -0
- data/lib/stigg/models/v1/subscription_preview_response.rb +431 -0
- data/lib/stigg/models/v1/subscription_retrieve_params.rb +16 -0
- data/lib/stigg/models/v1/subscription_retrieve_response.rb +274 -0
- data/lib/stigg/models/v1/subscription_transfer_params.rb +28 -0
- data/lib/stigg/models/v1/subscription_transfer_response.rb +274 -0
- data/lib/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rb +18 -0
- data/lib/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rb +32 -0
- data/lib/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rb +18 -0
- data/lib/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rb +32 -0
- data/lib/stigg/models/v1_create_event_params.rb +87 -0
- data/lib/stigg/models/v1_create_event_response.rb +16 -0
- data/lib/stigg/models/v1_create_usage_params.rb +96 -0
- data/lib/stigg/models/v1_create_usage_response.rb +112 -0
- data/lib/stigg/models.rb +47 -0
- data/lib/stigg/request_options.rb +77 -0
- data/lib/stigg/resources/v1/coupons.rb +95 -0
- data/lib/stigg/resources/v1/customers/payment_method.rb +67 -0
- data/lib/stigg/resources/v1/customers/promotional.rb +69 -0
- data/lib/stigg/resources/v1/customers/usage.rb +59 -0
- data/lib/stigg/resources/v1/customers.rb +177 -0
- data/lib/stigg/resources/v1/subscriptions/future_update.rb +56 -0
- data/lib/stigg/resources/v1/subscriptions.rb +241 -0
- data/lib/stigg/resources/v1.rb +70 -0
- data/lib/stigg/version.rb +5 -0
- data/lib/stigg.rb +108 -0
- data/manifest.yaml +17 -0
- data/rbi/stigg/client.rbi +49 -0
- data/rbi/stigg/errors.rbi +205 -0
- data/rbi/stigg/file_part.rbi +37 -0
- data/rbi/stigg/internal/my_cursor_id_page.rbi +19 -0
- data/rbi/stigg/internal/transport/base_client.rbi +297 -0
- data/rbi/stigg/internal/transport/pooled_net_requester.rbi +82 -0
- data/rbi/stigg/internal/type/array_of.rbi +104 -0
- data/rbi/stigg/internal/type/base_model.rbi +299 -0
- data/rbi/stigg/internal/type/base_page.rbi +42 -0
- data/rbi/stigg/internal/type/boolean.rbi +58 -0
- data/rbi/stigg/internal/type/converter.rbi +204 -0
- data/rbi/stigg/internal/type/enum.rbi +82 -0
- data/rbi/stigg/internal/type/file_input.rbi +58 -0
- data/rbi/stigg/internal/type/hash_of.rbi +104 -0
- data/rbi/stigg/internal/type/request_parameters.rbi +29 -0
- data/rbi/stigg/internal/type/union.rbi +126 -0
- data/rbi/stigg/internal/type/unknown.rbi +58 -0
- data/rbi/stigg/internal/util.rbi +478 -0
- data/rbi/stigg/internal.rbi +16 -0
- data/rbi/stigg/models/v1/coupon_create_params.rbi +758 -0
- data/rbi/stigg/models/v1/coupon_create_response.rbi +986 -0
- data/rbi/stigg/models/v1/coupon_list_params.rbi +70 -0
- data/rbi/stigg/models/v1/coupon_list_response.rbi +983 -0
- data/rbi/stigg/models/v1/coupon_retrieve_params.rbi +29 -0
- data/rbi/stigg/models/v1/coupon_retrieve_response.rbi +986 -0
- data/rbi/stigg/models/v1/customer_archive_params.rbi +29 -0
- data/rbi/stigg/models/v1/customer_create_params.rbi +376 -0
- data/rbi/stigg/models/v1/customer_list_params.rbi +70 -0
- data/rbi/stigg/models/v1/customer_list_response.rbi +447 -0
- data/rbi/stigg/models/v1/customer_response.rbi +423 -0
- data/rbi/stigg/models/v1/customer_retrieve_params.rbi +29 -0
- data/rbi/stigg/models/v1/customer_unarchive_params.rbi +29 -0
- data/rbi/stigg/models/v1/customer_update_params.rbi +226 -0
- data/rbi/stigg/models/v1/customers/payment_method_attach_params.rbi +769 -0
- data/rbi/stigg/models/v1/customers/payment_method_detach_params.rbi +34 -0
- data/rbi/stigg/models/v1/customers/promotional_create_params.rbi +639 -0
- data/rbi/stigg/models/v1/customers/promotional_create_response.rbi +495 -0
- data/rbi/stigg/models/v1/customers/promotional_revoke_params.rbi +42 -0
- data/rbi/stigg/models/v1/customers/promotional_revoke_response.rbi +497 -0
- data/rbi/stigg/models/v1/customers/usage_retrieve_params.rbi +84 -0
- data/rbi/stigg/models/v1/customers/usage_retrieve_response.rbi +353 -0
- data/rbi/stigg/models/v1/subscription_create_params.rbi +394 -0
- data/rbi/stigg/models/v1/subscription_create_response.rbi +668 -0
- data/rbi/stigg/models/v1/subscription_delegate_params.rbi +48 -0
- data/rbi/stigg/models/v1/subscription_delegate_response.rbi +535 -0
- data/rbi/stigg/models/v1/subscription_list_params.rbi +94 -0
- data/rbi/stigg/models/v1/subscription_list_response.rbi +543 -0
- data/rbi/stigg/models/v1/subscription_migrate_params.rbi +99 -0
- data/rbi/stigg/models/v1/subscription_migrate_response.rbi +535 -0
- data/rbi/stigg/models/v1/subscription_preview_params.rbi +1786 -0
- data/rbi/stigg/models/v1/subscription_preview_response.rbi +929 -0
- data/rbi/stigg/models/v1/subscription_retrieve_params.rbi +32 -0
- data/rbi/stigg/models/v1/subscription_retrieve_response.rbi +535 -0
- data/rbi/stigg/models/v1/subscription_transfer_params.rbi +50 -0
- data/rbi/stigg/models/v1/subscription_transfer_response.rbi +535 -0
- data/rbi/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rbi +34 -0
- data/rbi/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbi +79 -0
- data/rbi/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rbi +34 -0
- data/rbi/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rbi +79 -0
- data/rbi/stigg/models/v1_create_event_params.rbi +160 -0
- data/rbi/stigg/models/v1_create_event_response.rbi +23 -0
- data/rbi/stigg/models/v1_create_usage_params.rbi +177 -0
- data/rbi/stigg/models/v1_create_usage_response.rbi +150 -0
- data/rbi/stigg/models.rbi +9 -0
- data/rbi/stigg/request_options.rbi +55 -0
- data/rbi/stigg/resources/v1/coupons.rbi +79 -0
- data/rbi/stigg/resources/v1/customers/payment_method.rbi +54 -0
- data/rbi/stigg/resources/v1/customers/promotional.rbi +53 -0
- data/rbi/stigg/resources/v1/customers/usage.rbi +45 -0
- data/rbi/stigg/resources/v1/customers.rbi +138 -0
- data/rbi/stigg/resources/v1/subscriptions/future_update.rbi +40 -0
- data/rbi/stigg/resources/v1/subscriptions.rbi +199 -0
- data/rbi/stigg/resources/v1.rbi +49 -0
- data/rbi/stigg/version.rbi +5 -0
- data/sig/stigg/client.rbs +26 -0
- data/sig/stigg/errors.rbs +117 -0
- data/sig/stigg/file_part.rbs +21 -0
- data/sig/stigg/internal/my_cursor_id_page.rbs +11 -0
- data/sig/stigg/internal/transport/base_client.rbs +133 -0
- data/sig/stigg/internal/transport/pooled_net_requester.rbs +48 -0
- data/sig/stigg/internal/type/array_of.rbs +48 -0
- data/sig/stigg/internal/type/base_model.rbs +102 -0
- data/sig/stigg/internal/type/base_page.rbs +24 -0
- data/sig/stigg/internal/type/boolean.rbs +26 -0
- data/sig/stigg/internal/type/converter.rbs +79 -0
- data/sig/stigg/internal/type/enum.rbs +32 -0
- data/sig/stigg/internal/type/file_input.rbs +25 -0
- data/sig/stigg/internal/type/hash_of.rbs +48 -0
- data/sig/stigg/internal/type/request_parameters.rbs +17 -0
- data/sig/stigg/internal/type/union.rbs +52 -0
- data/sig/stigg/internal/type/unknown.rbs +26 -0
- data/sig/stigg/internal/util.rbs +185 -0
- data/sig/stigg/internal.rbs +9 -0
- data/sig/stigg/models/v1/coupon_create_params.rbs +323 -0
- data/sig/stigg/models/v1/coupon_create_response.rbs +392 -0
- data/sig/stigg/models/v1/coupon_list_params.rbs +40 -0
- data/sig/stigg/models/v1/coupon_list_response.rbs +399 -0
- data/sig/stigg/models/v1/coupon_retrieve_params.rbs +17 -0
- data/sig/stigg/models/v1/coupon_retrieve_response.rbs +394 -0
- data/sig/stigg/models/v1/customer_archive_params.rbs +17 -0
- data/sig/stigg/models/v1/customer_create_params.rbs +169 -0
- data/sig/stigg/models/v1/customer_list_params.rbs +40 -0
- data/sig/stigg/models/v1/customer_list_response.rbs +198 -0
- data/sig/stigg/models/v1/customer_response.rbs +188 -0
- data/sig/stigg/models/v1/customer_retrieve_params.rbs +17 -0
- data/sig/stigg/models/v1/customer_unarchive_params.rbs +17 -0
- data/sig/stigg/models/v1/customer_update_params.rbs +110 -0
- data/sig/stigg/models/v1/customers/payment_method_attach_params.rbs +315 -0
- data/sig/stigg/models/v1/customers/payment_method_detach_params.rbs +19 -0
- data/sig/stigg/models/v1/customers/promotional_create_params.rbs +234 -0
- data/sig/stigg/models/v1/customers/promotional_create_response.rbs +209 -0
- data/sig/stigg/models/v1/customers/promotional_revoke_params.rbs +27 -0
- data/sig/stigg/models/v1/customers/promotional_revoke_response.rbs +209 -0
- data/sig/stigg/models/v1/customers/usage_retrieve_params.rbs +54 -0
- data/sig/stigg/models/v1/customers/usage_retrieve_response.rbs +134 -0
- data/sig/stigg/models/v1/subscription_create_params.rbs +199 -0
- data/sig/stigg/models/v1/subscription_create_response.rbs +283 -0
- data/sig/stigg/models/v1/subscription_delegate_params.rbs +26 -0
- data/sig/stigg/models/v1/subscription_delegate_response.rbs +224 -0
- data/sig/stigg/models/v1/subscription_list_params.rbs +58 -0
- data/sig/stigg/models/v1/subscription_list_response.rbs +229 -0
- data/sig/stigg/models/v1/subscription_migrate_params.rbs +43 -0
- data/sig/stigg/models/v1/subscription_migrate_response.rbs +224 -0
- data/sig/stigg/models/v1/subscription_preview_params.rbs +821 -0
- data/sig/stigg/models/v1/subscription_preview_response.rbs +466 -0
- data/sig/stigg/models/v1/subscription_retrieve_params.rbs +17 -0
- data/sig/stigg/models/v1/subscription_retrieve_response.rbs +224 -0
- data/sig/stigg/models/v1/subscription_transfer_params.rbs +26 -0
- data/sig/stigg/models/v1/subscription_transfer_response.rbs +224 -0
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_params.rbs +19 -0
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbs +34 -0
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_schedule_params.rbs +19 -0
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rbs +34 -0
- data/sig/stigg/models/v1_create_event_params.rbs +80 -0
- data/sig/stigg/models/v1_create_event_response.rbs +13 -0
- data/sig/stigg/models/v1_create_usage_params.rbs +90 -0
- data/sig/stigg/models/v1_create_usage_response.rbs +85 -0
- data/sig/stigg/models.rbs +7 -0
- data/sig/stigg/request_options.rbs +34 -0
- data/sig/stigg/resources/v1/coupons.rbs +32 -0
- data/sig/stigg/resources/v1/customers/payment_method.rbs +25 -0
- data/sig/stigg/resources/v1/customers/promotional.rbs +23 -0
- data/sig/stigg/resources/v1/customers/usage.rbs +21 -0
- data/sig/stigg/resources/v1/customers.rbs +58 -0
- data/sig/stigg/resources/v1/subscriptions/future_update.rbs +21 -0
- data/sig/stigg/resources/v1/subscriptions.rbs +76 -0
- data/sig/stigg/resources/v1.rbs +23 -0
- data/sig/stigg/version.rbs +3 -0
- metadata +301 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
# @see Stigg::Resources::V1#create_event
|
|
6
|
+
class V1CreateEventParams < Stigg::Internal::Type::BaseModel
|
|
7
|
+
extend Stigg::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Stigg::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute events
|
|
11
|
+
# A list of usage events to report
|
|
12
|
+
#
|
|
13
|
+
# @return [Array<Stigg::Models::V1CreateEventParams::Event>]
|
|
14
|
+
required :events, -> { Stigg::Internal::Type::ArrayOf[Stigg::V1CreateEventParams::Event] }
|
|
15
|
+
|
|
16
|
+
# @!method initialize(events:, request_options: {})
|
|
17
|
+
# @param events [Array<Stigg::Models::V1CreateEventParams::Event>] A list of usage events to report
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
|
|
21
|
+
class Event < Stigg::Internal::Type::BaseModel
|
|
22
|
+
# @!attribute customer_id
|
|
23
|
+
# Customer id
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
required :customer_id, String, api_name: :customerId
|
|
27
|
+
|
|
28
|
+
# @!attribute event_name
|
|
29
|
+
# The name of the usage event
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
required :event_name, String, api_name: :eventName
|
|
33
|
+
|
|
34
|
+
# @!attribute idempotency_key
|
|
35
|
+
# Idempotency key
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
required :idempotency_key, String, api_name: :idempotencyKey
|
|
39
|
+
|
|
40
|
+
# @!attribute dimensions
|
|
41
|
+
# Dimensions associated with the usage event
|
|
42
|
+
#
|
|
43
|
+
# @return [Hash{Symbol=>String, Float, Boolean}, nil]
|
|
44
|
+
optional :dimensions,
|
|
45
|
+
-> { Stigg::Internal::Type::HashOf[union: Stigg::V1CreateEventParams::Event::Dimension] }
|
|
46
|
+
|
|
47
|
+
# @!attribute resource_id
|
|
48
|
+
# Resource id
|
|
49
|
+
#
|
|
50
|
+
# @return [String, nil]
|
|
51
|
+
optional :resource_id, String, api_name: :resourceId, nil?: true
|
|
52
|
+
|
|
53
|
+
# @!attribute timestamp
|
|
54
|
+
# Timestamp
|
|
55
|
+
#
|
|
56
|
+
# @return [Time, nil]
|
|
57
|
+
optional :timestamp, Time
|
|
58
|
+
|
|
59
|
+
# @!method initialize(customer_id:, event_name:, idempotency_key:, dimensions: nil, resource_id: nil, timestamp: nil)
|
|
60
|
+
# @param customer_id [String] Customer id
|
|
61
|
+
#
|
|
62
|
+
# @param event_name [String] The name of the usage event
|
|
63
|
+
#
|
|
64
|
+
# @param idempotency_key [String] Idempotency key
|
|
65
|
+
#
|
|
66
|
+
# @param dimensions [Hash{Symbol=>String, Float, Boolean}] Dimensions associated with the usage event
|
|
67
|
+
#
|
|
68
|
+
# @param resource_id [String, nil] Resource id
|
|
69
|
+
#
|
|
70
|
+
# @param timestamp [Time] Timestamp
|
|
71
|
+
|
|
72
|
+
module Dimension
|
|
73
|
+
extend Stigg::Internal::Type::Union
|
|
74
|
+
|
|
75
|
+
variant String
|
|
76
|
+
|
|
77
|
+
variant Float
|
|
78
|
+
|
|
79
|
+
variant Stigg::Internal::Type::Boolean
|
|
80
|
+
|
|
81
|
+
# @!method self.variants
|
|
82
|
+
# @return [Array(String, Float, Boolean)]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
# @see Stigg::Resources::V1#create_event
|
|
6
|
+
class V1CreateEventResponse < Stigg::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute data
|
|
8
|
+
#
|
|
9
|
+
# @return [Object]
|
|
10
|
+
required :data, Stigg::Internal::Type::Unknown
|
|
11
|
+
|
|
12
|
+
# @!method initialize(data:)
|
|
13
|
+
# @param data [Object]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
# @see Stigg::Resources::V1#create_usage
|
|
6
|
+
class V1CreateUsageParams < Stigg::Internal::Type::BaseModel
|
|
7
|
+
extend Stigg::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Stigg::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute usages
|
|
11
|
+
# A list of usage reports to be submitted in bulk
|
|
12
|
+
#
|
|
13
|
+
# @return [Array<Stigg::Models::V1CreateUsageParams::Usage>]
|
|
14
|
+
required :usages, -> { Stigg::Internal::Type::ArrayOf[Stigg::V1CreateUsageParams::Usage] }
|
|
15
|
+
|
|
16
|
+
# @!method initialize(usages:, request_options: {})
|
|
17
|
+
# @param usages [Array<Stigg::Models::V1CreateUsageParams::Usage>] A list of usage reports to be submitted in bulk
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
|
|
21
|
+
class Usage < Stigg::Internal::Type::BaseModel
|
|
22
|
+
# @!attribute customer_id
|
|
23
|
+
# Customer id
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
required :customer_id, String, api_name: :customerId
|
|
27
|
+
|
|
28
|
+
# @!attribute feature_id
|
|
29
|
+
# Feature id
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
required :feature_id, String, api_name: :featureId
|
|
33
|
+
|
|
34
|
+
# @!attribute value
|
|
35
|
+
# The value to report for usage
|
|
36
|
+
#
|
|
37
|
+
# @return [Integer]
|
|
38
|
+
required :value, Integer
|
|
39
|
+
|
|
40
|
+
# @!attribute created_at
|
|
41
|
+
# Timestamp of when the record was created
|
|
42
|
+
#
|
|
43
|
+
# @return [Time, nil]
|
|
44
|
+
optional :created_at, Time, api_name: :createdAt
|
|
45
|
+
|
|
46
|
+
# @!attribute dimensions
|
|
47
|
+
# Additional dimensions for the usage report
|
|
48
|
+
#
|
|
49
|
+
# @return [Hash{Symbol=>String}, nil]
|
|
50
|
+
optional :dimensions, Stigg::Internal::Type::HashOf[String]
|
|
51
|
+
|
|
52
|
+
# @!attribute resource_id
|
|
53
|
+
# Resource id
|
|
54
|
+
#
|
|
55
|
+
# @return [String, nil]
|
|
56
|
+
optional :resource_id, String, api_name: :resourceId, nil?: true
|
|
57
|
+
|
|
58
|
+
# @!attribute update_behavior
|
|
59
|
+
# The method by which the usage value should be updated
|
|
60
|
+
#
|
|
61
|
+
# @return [Symbol, Stigg::Models::V1CreateUsageParams::Usage::UpdateBehavior, nil]
|
|
62
|
+
optional :update_behavior,
|
|
63
|
+
enum: -> { Stigg::V1CreateUsageParams::Usage::UpdateBehavior },
|
|
64
|
+
api_name: :updateBehavior
|
|
65
|
+
|
|
66
|
+
# @!method initialize(customer_id:, feature_id:, value:, created_at: nil, dimensions: nil, resource_id: nil, update_behavior: nil)
|
|
67
|
+
# @param customer_id [String] Customer id
|
|
68
|
+
#
|
|
69
|
+
# @param feature_id [String] Feature id
|
|
70
|
+
#
|
|
71
|
+
# @param value [Integer] The value to report for usage
|
|
72
|
+
#
|
|
73
|
+
# @param created_at [Time] Timestamp of when the record was created
|
|
74
|
+
#
|
|
75
|
+
# @param dimensions [Hash{Symbol=>String}] Additional dimensions for the usage report
|
|
76
|
+
#
|
|
77
|
+
# @param resource_id [String, nil] Resource id
|
|
78
|
+
#
|
|
79
|
+
# @param update_behavior [Symbol, Stigg::Models::V1CreateUsageParams::Usage::UpdateBehavior] The method by which the usage value should be updated
|
|
80
|
+
|
|
81
|
+
# The method by which the usage value should be updated
|
|
82
|
+
#
|
|
83
|
+
# @see Stigg::Models::V1CreateUsageParams::Usage#update_behavior
|
|
84
|
+
module UpdateBehavior
|
|
85
|
+
extend Stigg::Internal::Type::Enum
|
|
86
|
+
|
|
87
|
+
DELTA = :DELTA
|
|
88
|
+
SET = :SET
|
|
89
|
+
|
|
90
|
+
# @!method self.values
|
|
91
|
+
# @return [Array<Symbol>]
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Models
|
|
5
|
+
# @see Stigg::Resources::V1#create_usage
|
|
6
|
+
class V1CreateUsageResponse < Stigg::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute data
|
|
8
|
+
#
|
|
9
|
+
# @return [Array<Stigg::Models::V1CreateUsageResponse::Data>]
|
|
10
|
+
required :data, -> { Stigg::Internal::Type::ArrayOf[Stigg::Models::V1CreateUsageResponse::Data] }
|
|
11
|
+
|
|
12
|
+
# @!method initialize(data:)
|
|
13
|
+
# @param data [Array<Stigg::Models::V1CreateUsageResponse::Data>]
|
|
14
|
+
|
|
15
|
+
class Data < Stigg::Internal::Type::BaseModel
|
|
16
|
+
# @!attribute id
|
|
17
|
+
# Unique identifier for the entity
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :id, String
|
|
21
|
+
|
|
22
|
+
# @!attribute created_at
|
|
23
|
+
# Timestamp of when the record was created
|
|
24
|
+
#
|
|
25
|
+
# @return [Time]
|
|
26
|
+
required :created_at, Time, api_name: :createdAt
|
|
27
|
+
|
|
28
|
+
# @!attribute customer_id
|
|
29
|
+
# Customer id
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
required :customer_id, String, api_name: :customerId
|
|
33
|
+
|
|
34
|
+
# @!attribute feature_id
|
|
35
|
+
# Feature id
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
required :feature_id, String, api_name: :featureId
|
|
39
|
+
|
|
40
|
+
# @!attribute timestamp
|
|
41
|
+
# Timestamp
|
|
42
|
+
#
|
|
43
|
+
# @return [Time]
|
|
44
|
+
required :timestamp, Time
|
|
45
|
+
|
|
46
|
+
# @!attribute value
|
|
47
|
+
# The usage measurement record
|
|
48
|
+
#
|
|
49
|
+
# @return [Float]
|
|
50
|
+
required :value, Float
|
|
51
|
+
|
|
52
|
+
# @!attribute current_usage
|
|
53
|
+
# The current measured usage value
|
|
54
|
+
#
|
|
55
|
+
# @return [Float, nil]
|
|
56
|
+
optional :current_usage, Float, api_name: :currentUsage, nil?: true
|
|
57
|
+
|
|
58
|
+
# @!attribute next_reset_date
|
|
59
|
+
# The date when the next usage reset will occur
|
|
60
|
+
#
|
|
61
|
+
# @return [Time, nil]
|
|
62
|
+
optional :next_reset_date, Time, api_name: :nextResetDate, nil?: true
|
|
63
|
+
|
|
64
|
+
# @!attribute resource_id
|
|
65
|
+
# Resource id
|
|
66
|
+
#
|
|
67
|
+
# @return [String, nil]
|
|
68
|
+
optional :resource_id, String, api_name: :resourceId, nil?: true
|
|
69
|
+
|
|
70
|
+
# @!attribute usage_period_end
|
|
71
|
+
# The end date of the usage period in which this measurement resides (for
|
|
72
|
+
# entitlements with a reset period)
|
|
73
|
+
#
|
|
74
|
+
# @return [Time, nil]
|
|
75
|
+
optional :usage_period_end, Time, api_name: :usagePeriodEnd, nil?: true
|
|
76
|
+
|
|
77
|
+
# @!attribute usage_period_start
|
|
78
|
+
# The start date of the usage period in which this measurement resides (for
|
|
79
|
+
# entitlements with a reset period)
|
|
80
|
+
#
|
|
81
|
+
# @return [Time, nil]
|
|
82
|
+
optional :usage_period_start, Time, api_name: :usagePeriodStart, nil?: true
|
|
83
|
+
|
|
84
|
+
# @!method initialize(id:, created_at:, customer_id:, feature_id:, timestamp:, value:, current_usage: nil, next_reset_date: nil, resource_id: nil, usage_period_end: nil, usage_period_start: nil)
|
|
85
|
+
# Some parameter documentations has been truncated, see
|
|
86
|
+
# {Stigg::Models::V1CreateUsageResponse::Data} for more details.
|
|
87
|
+
#
|
|
88
|
+
# @param id [String] Unique identifier for the entity
|
|
89
|
+
#
|
|
90
|
+
# @param created_at [Time] Timestamp of when the record was created
|
|
91
|
+
#
|
|
92
|
+
# @param customer_id [String] Customer id
|
|
93
|
+
#
|
|
94
|
+
# @param feature_id [String] Feature id
|
|
95
|
+
#
|
|
96
|
+
# @param timestamp [Time] Timestamp
|
|
97
|
+
#
|
|
98
|
+
# @param value [Float] The usage measurement record
|
|
99
|
+
#
|
|
100
|
+
# @param current_usage [Float, nil] The current measured usage value
|
|
101
|
+
#
|
|
102
|
+
# @param next_reset_date [Time, nil] The date when the next usage reset will occur
|
|
103
|
+
#
|
|
104
|
+
# @param resource_id [String, nil] Resource id
|
|
105
|
+
#
|
|
106
|
+
# @param usage_period_end [Time, nil] The end date of the usage period in which this measurement resides (for entitlem
|
|
107
|
+
#
|
|
108
|
+
# @param usage_period_start [Time, nil] The start date of the usage period in which this measurement resides (for entitl
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
data/lib/stigg/models.rb
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
[Stigg::Internal::Type::BaseModel, *Stigg::Internal::Type::BaseModel.subclasses].each do |cls|
|
|
5
|
+
cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Stigg::Internal::AnyHash) } }
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
Stigg::Internal::Util.walk_namespaces(Stigg::Models).each do |mod|
|
|
9
|
+
case mod
|
|
10
|
+
in Stigg::Internal::Type::Enum | Stigg::Internal::Type::Union
|
|
11
|
+
mod.constants.each do |name|
|
|
12
|
+
case mod.const_get(name)
|
|
13
|
+
in true | false
|
|
14
|
+
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
|
|
15
|
+
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
|
16
|
+
in Integer
|
|
17
|
+
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
|
|
18
|
+
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
|
19
|
+
in Float
|
|
20
|
+
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
|
|
21
|
+
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
|
22
|
+
in Symbol
|
|
23
|
+
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
|
|
24
|
+
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
|
25
|
+
else
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Stigg::Internal::Util.walk_namespaces(Stigg::Models)
|
|
33
|
+
.lazy
|
|
34
|
+
.grep(Stigg::Internal::Type::Union)
|
|
35
|
+
.each do |mod|
|
|
36
|
+
const = :Variants
|
|
37
|
+
next if mod.sorbet_constant_defined?(const)
|
|
38
|
+
|
|
39
|
+
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
V1 = Stigg::Models::V1
|
|
43
|
+
|
|
44
|
+
V1CreateEventParams = Stigg::Models::V1CreateEventParams
|
|
45
|
+
|
|
46
|
+
V1CreateUsageParams = Stigg::Models::V1CreateUsageParams
|
|
47
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
# Specify HTTP behaviour to use for a specific request. These options supplement
|
|
5
|
+
# or override those provided at the client level.
|
|
6
|
+
#
|
|
7
|
+
# When making a request, you can pass an actual {RequestOptions} instance, or
|
|
8
|
+
# simply pass a Hash with symbol keys matching the attributes on this class.
|
|
9
|
+
class RequestOptions < Stigg::Internal::Type::BaseModel
|
|
10
|
+
# @api private
|
|
11
|
+
#
|
|
12
|
+
# @param opts [Stigg::RequestOptions, Hash{Symbol=>Object}]
|
|
13
|
+
#
|
|
14
|
+
# @raise [ArgumentError]
|
|
15
|
+
def self.validate!(opts)
|
|
16
|
+
case opts
|
|
17
|
+
in Stigg::RequestOptions | Hash
|
|
18
|
+
opts.to_h.each_key do |k|
|
|
19
|
+
unless fields.include?(k)
|
|
20
|
+
raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @!attribute idempotency_key
|
|
29
|
+
# Idempotency key to send with request and all associated retries. Will only be
|
|
30
|
+
# sent for write requests.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :idempotency_key, String
|
|
34
|
+
|
|
35
|
+
# @!attribute extra_query
|
|
36
|
+
# Extra query params to send with the request. These are `.merge`’d into any
|
|
37
|
+
# `query` given at the client level.
|
|
38
|
+
#
|
|
39
|
+
# @return [Hash{String=>Array<String>, String, nil}, nil]
|
|
40
|
+
optional :extra_query, Stigg::Internal::Type::HashOf[Stigg::Internal::Type::ArrayOf[String]]
|
|
41
|
+
|
|
42
|
+
# @!attribute extra_headers
|
|
43
|
+
# Extra headers to send with the request. These are `.merged`’d into any
|
|
44
|
+
# `extra_headers` given at the client level.
|
|
45
|
+
#
|
|
46
|
+
# @return [Hash{String=>String, nil}, nil]
|
|
47
|
+
optional :extra_headers, Stigg::Internal::Type::HashOf[String, nil?: true]
|
|
48
|
+
|
|
49
|
+
# @!attribute extra_body
|
|
50
|
+
# Extra data to send with the request. These are deep merged into any data
|
|
51
|
+
# generated as part of the normal request.
|
|
52
|
+
#
|
|
53
|
+
# @return [Object, nil]
|
|
54
|
+
optional :extra_body, Stigg::Internal::Type::HashOf[Stigg::Internal::Type::Unknown]
|
|
55
|
+
|
|
56
|
+
# @!attribute max_retries
|
|
57
|
+
# Maximum number of retries to attempt after a failed initial request.
|
|
58
|
+
#
|
|
59
|
+
# @return [Integer, nil]
|
|
60
|
+
optional :max_retries, Integer
|
|
61
|
+
|
|
62
|
+
# @!attribute timeout
|
|
63
|
+
# Request timeout in seconds.
|
|
64
|
+
#
|
|
65
|
+
# @return [Float, nil]
|
|
66
|
+
optional :timeout, Float
|
|
67
|
+
|
|
68
|
+
# @!method initialize(values = {})
|
|
69
|
+
# Returns a new instance of RequestOptions.
|
|
70
|
+
#
|
|
71
|
+
# @param values [Hash{Symbol=>Object}]
|
|
72
|
+
|
|
73
|
+
define_sorbet_constant!(:OrHash) do
|
|
74
|
+
T.type_alias { T.any(Stigg::RequestOptions, Stigg::Internal::AnyHash) }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Coupons
|
|
7
|
+
# Create a new Coupon
|
|
8
|
+
#
|
|
9
|
+
# @overload create(id:, amounts_off:, description:, duration_in_months:, name:, percent_off:, additional_meta_data: nil, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param id [String] The unique identifier for the entity
|
|
12
|
+
#
|
|
13
|
+
# @param amounts_off [Array<Stigg::Models::V1::CouponCreateParams::AmountsOff>, nil] Fixed amount discounts in different currencies
|
|
14
|
+
#
|
|
15
|
+
# @param description [String, nil] Description of the coupon
|
|
16
|
+
#
|
|
17
|
+
# @param duration_in_months [Integer, nil] Duration of the coupon validity in months
|
|
18
|
+
#
|
|
19
|
+
# @param name [String] Name of the coupon
|
|
20
|
+
#
|
|
21
|
+
# @param percent_off [Float, nil] Percentage discount off the original price
|
|
22
|
+
#
|
|
23
|
+
# @param additional_meta_data [Object] Metadata associated with the entity
|
|
24
|
+
#
|
|
25
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
26
|
+
#
|
|
27
|
+
# @return [Stigg::Models::V1::CouponCreateResponse]
|
|
28
|
+
#
|
|
29
|
+
# @see Stigg::Models::V1::CouponCreateParams
|
|
30
|
+
def create(params)
|
|
31
|
+
parsed, options = Stigg::V1::CouponCreateParams.dump_request(params)
|
|
32
|
+
@client.request(
|
|
33
|
+
method: :post,
|
|
34
|
+
path: "api/v1/coupons",
|
|
35
|
+
body: parsed,
|
|
36
|
+
model: Stigg::Models::V1::CouponCreateResponse,
|
|
37
|
+
options: options
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Get a single Coupon by id
|
|
42
|
+
#
|
|
43
|
+
# @overload retrieve(id, request_options: {})
|
|
44
|
+
#
|
|
45
|
+
# @param id [String]
|
|
46
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
47
|
+
#
|
|
48
|
+
# @return [Stigg::Models::V1::CouponRetrieveResponse]
|
|
49
|
+
#
|
|
50
|
+
# @see Stigg::Models::V1::CouponRetrieveParams
|
|
51
|
+
def retrieve(id, params = {})
|
|
52
|
+
@client.request(
|
|
53
|
+
method: :get,
|
|
54
|
+
path: ["api/v1/coupons/%1$s", id],
|
|
55
|
+
model: Stigg::Models::V1::CouponRetrieveResponse,
|
|
56
|
+
options: params[:request_options]
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Get a list of Coupons
|
|
61
|
+
#
|
|
62
|
+
# @overload list(ending_before: nil, limit: nil, starting_after: nil, request_options: {})
|
|
63
|
+
#
|
|
64
|
+
# @param ending_before [String] Ending before this UUID for pagination
|
|
65
|
+
#
|
|
66
|
+
# @param limit [Integer] Items per page
|
|
67
|
+
#
|
|
68
|
+
# @param starting_after [String] Starting after this UUID for pagination
|
|
69
|
+
#
|
|
70
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
71
|
+
#
|
|
72
|
+
# @return [Stigg::Models::V1::CouponListResponse]
|
|
73
|
+
#
|
|
74
|
+
# @see Stigg::Models::V1::CouponListParams
|
|
75
|
+
def list(params = {})
|
|
76
|
+
parsed, options = Stigg::V1::CouponListParams.dump_request(params)
|
|
77
|
+
@client.request(
|
|
78
|
+
method: :get,
|
|
79
|
+
path: "api/v1/coupons",
|
|
80
|
+
query: parsed.transform_keys(ending_before: "endingBefore", starting_after: "startingAfter"),
|
|
81
|
+
model: Stigg::Models::V1::CouponListResponse,
|
|
82
|
+
options: options
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @api private
|
|
87
|
+
#
|
|
88
|
+
# @param client [Stigg::Client]
|
|
89
|
+
def initialize(client:)
|
|
90
|
+
@client = client
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Customers
|
|
7
|
+
class PaymentMethod
|
|
8
|
+
# Perform payment-method attachment on a Customer
|
|
9
|
+
#
|
|
10
|
+
# @overload attach(id, integration_id:, payment_method_id:, vendor_identifier:, billing_currency: nil, request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param id [String]
|
|
13
|
+
#
|
|
14
|
+
# @param integration_id [String] Integration details
|
|
15
|
+
#
|
|
16
|
+
# @param payment_method_id [String] Billing provider payment method id
|
|
17
|
+
#
|
|
18
|
+
# @param vendor_identifier [Symbol, Stigg::Models::V1::Customers::PaymentMethodAttachParams::VendorIdentifier] The vendor identifier of integration
|
|
19
|
+
#
|
|
20
|
+
# @param billing_currency [Symbol, Stigg::Models::V1::Customers::PaymentMethodAttachParams::BillingCurrency, nil]
|
|
21
|
+
#
|
|
22
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
23
|
+
#
|
|
24
|
+
# @return [Stigg::Models::V1::CustomerResponse]
|
|
25
|
+
#
|
|
26
|
+
# @see Stigg::Models::V1::Customers::PaymentMethodAttachParams
|
|
27
|
+
def attach(id, params)
|
|
28
|
+
parsed, options = Stigg::V1::Customers::PaymentMethodAttachParams.dump_request(params)
|
|
29
|
+
@client.request(
|
|
30
|
+
method: :post,
|
|
31
|
+
path: ["api/v1/customers/%1$s/payment-method", id],
|
|
32
|
+
body: parsed,
|
|
33
|
+
model: Stigg::V1::CustomerResponse,
|
|
34
|
+
options: options
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Perform payment-method detachment on a Customer
|
|
39
|
+
#
|
|
40
|
+
# @overload detach(id, request_options: {})
|
|
41
|
+
#
|
|
42
|
+
# @param id [String]
|
|
43
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
44
|
+
#
|
|
45
|
+
# @return [Stigg::Models::V1::CustomerResponse]
|
|
46
|
+
#
|
|
47
|
+
# @see Stigg::Models::V1::Customers::PaymentMethodDetachParams
|
|
48
|
+
def detach(id, params = {})
|
|
49
|
+
@client.request(
|
|
50
|
+
method: :delete,
|
|
51
|
+
path: ["api/v1/customers/%1$s/payment-method", id],
|
|
52
|
+
model: Stigg::V1::CustomerResponse,
|
|
53
|
+
options: params[:request_options]
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# @api private
|
|
58
|
+
#
|
|
59
|
+
# @param client [Stigg::Client]
|
|
60
|
+
def initialize(client:)
|
|
61
|
+
@client = client
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Customers
|
|
7
|
+
class Promotional
|
|
8
|
+
# Create a new Promotional Entitlements
|
|
9
|
+
#
|
|
10
|
+
# @overload create(customer_id, promotional_entitlements:, request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param customer_id [String] The unique identifier of the entitlement customer
|
|
13
|
+
#
|
|
14
|
+
# @param promotional_entitlements [Array<Stigg::Models::V1::Customers::PromotionalCreateParams::PromotionalEntitlement>] Promotional entitlements to grant
|
|
15
|
+
#
|
|
16
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
17
|
+
#
|
|
18
|
+
# @return [Stigg::Models::V1::Customers::PromotionalCreateResponse]
|
|
19
|
+
#
|
|
20
|
+
# @see Stigg::Models::V1::Customers::PromotionalCreateParams
|
|
21
|
+
def create(customer_id, params)
|
|
22
|
+
parsed, options = Stigg::V1::Customers::PromotionalCreateParams.dump_request(params)
|
|
23
|
+
@client.request(
|
|
24
|
+
method: :post,
|
|
25
|
+
path: ["api/v1/customers/%1$s/promotional", customer_id],
|
|
26
|
+
body: parsed,
|
|
27
|
+
model: Stigg::Models::V1::Customers::PromotionalCreateResponse,
|
|
28
|
+
options: options
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Perform revocation on a Promotional Entitlement
|
|
33
|
+
#
|
|
34
|
+
# @overload revoke(feature_id, customer_id:, request_options: {})
|
|
35
|
+
#
|
|
36
|
+
# @param feature_id [String] The unique identifier of the entitlement feature
|
|
37
|
+
#
|
|
38
|
+
# @param customer_id [String] The unique identifier of the entitlement customer
|
|
39
|
+
#
|
|
40
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
41
|
+
#
|
|
42
|
+
# @return [Stigg::Models::V1::Customers::PromotionalRevokeResponse]
|
|
43
|
+
#
|
|
44
|
+
# @see Stigg::Models::V1::Customers::PromotionalRevokeParams
|
|
45
|
+
def revoke(feature_id, params)
|
|
46
|
+
parsed, options = Stigg::V1::Customers::PromotionalRevokeParams.dump_request(params)
|
|
47
|
+
customer_id =
|
|
48
|
+
parsed.delete(:customer_id) do
|
|
49
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
50
|
+
end
|
|
51
|
+
@client.request(
|
|
52
|
+
method: :delete,
|
|
53
|
+
path: ["api/v1/customers/%1$s/promotional/featureId/%2$s", customer_id, feature_id],
|
|
54
|
+
model: Stigg::Models::V1::Customers::PromotionalRevokeResponse,
|
|
55
|
+
options: options
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @api private
|
|
60
|
+
#
|
|
61
|
+
# @param client [Stigg::Client]
|
|
62
|
+
def initialize(client:)
|
|
63
|
+
@client = client
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|