stigg 0.1.0.pre.alpha.2 → 0.1.0.pre.alpha.3
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/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/stigg/internal/type/base_model.rb +2 -2
- data/lib/stigg/models/v1/{coupon_create_response.rb → coupon.rb} +24 -24
- data/lib/stigg/models/v1/customer_import_params.rb +75 -0
- data/lib/stigg/models/v1/customer_import_response.rb +35 -0
- data/lib/stigg/models/v1/{customer_create_params.rb → customer_provision_params.rb} +16 -16
- data/lib/stigg/models/v1/customer_response.rb +1 -1
- data/lib/stigg/models/v1/customers/promotional_entitlement_grant_params.rb +296 -0
- data/lib/stigg/models/v1/customers/promotional_entitlement_grant_response.rb +341 -0
- data/lib/stigg/models/v1/customers/promotional_entitlement_revoke_params.rb +24 -0
- data/lib/stigg/models/v1/customers/promotional_entitlement_revoke_response.rb +342 -0
- data/lib/stigg/models/v1/event_report_params.rb +91 -0
- data/lib/stigg/models/v1/event_report_response.rb +25 -0
- data/lib/stigg/models/v1/{subscription_retrieve_response.rb → subscription.rb} +30 -29
- data/lib/stigg/models/v1/subscription_cancel_params.rb +75 -0
- data/lib/stigg/models/v1/subscription_import_params.rb +92 -0
- data/lib/stigg/models/v1/subscription_import_response.rb +32 -0
- data/lib/stigg/models/v1/{subscription_create_params.rb → subscription_provision_params.rb} +118 -118
- data/lib/stigg/models/v1/{subscription_create_response.rb → subscription_provision_response.rb} +76 -75
- data/lib/stigg/models/v1/subscription_update_params.rb +1114 -0
- data/lib/stigg/models/v1/subscriptions/{future_update_cancel_pending_payment_response.rb → cancel_subscription.rb} +7 -5
- data/lib/stigg/models/v1/usage_history_params.rb +54 -0
- data/lib/stigg/models/v1/usage_history_response.rb +155 -0
- data/lib/stigg/models/v1/usage_report_params.rb +114 -0
- data/lib/stigg/models/v1/usage_report_response.rb +120 -0
- data/lib/stigg/models.rb +0 -4
- data/lib/stigg/resources/v1/coupons.rb +4 -4
- data/lib/stigg/resources/v1/customers/promotional_entitlements.rb +69 -0
- data/lib/stigg/resources/v1/customers.rb +59 -37
- data/lib/stigg/resources/v1/events.rb +38 -0
- data/lib/stigg/resources/v1/subscriptions/future_update.rb +4 -4
- data/lib/stigg/resources/v1/subscriptions.rb +166 -64
- data/lib/stigg/resources/v1/usage.rb +79 -0
- data/lib/stigg/resources/v1.rb +6 -42
- data/lib/stigg/version.rb +1 -1
- data/lib/stigg.rb +25 -16
- data/rbi/stigg/models/v1/{coupon_create_response.rbi → coupon.rbi} +156 -252
- data/rbi/stigg/models/v1/customer_import_params.rbi +130 -0
- data/rbi/stigg/models/v1/customer_import_response.rbi +76 -0
- data/rbi/stigg/models/v1/{customer_create_params.rbi → customer_provision_params.rbi} +35 -35
- data/rbi/stigg/models/v1/customers/promotional_entitlement_grant_params.rbi +640 -0
- data/rbi/stigg/models/v1/customers/promotional_entitlement_grant_response.rbi +690 -0
- data/rbi/stigg/models/v1/customers/promotional_entitlement_revoke_params.rbi +42 -0
- data/rbi/stigg/models/v1/customers/promotional_entitlement_revoke_response.rbi +696 -0
- data/rbi/stigg/models/v1/event_report_params.rbi +168 -0
- data/rbi/stigg/models/v1/event_report_response.rbi +35 -0
- data/rbi/stigg/models/v1/{subscription_migrate_response.rbi → subscription.rbi} +66 -117
- data/rbi/stigg/models/v1/subscription_cancel_params.rbi +182 -0
- data/rbi/stigg/models/v1/subscription_import_params.rbi +148 -0
- data/rbi/stigg/models/v1/subscription_import_response.rbi +69 -0
- data/rbi/stigg/models/v1/{subscription_create_params.rbi → subscription_provision_params.rbi} +794 -773
- data/rbi/stigg/models/v1/{subscription_create_response.rbi → subscription_provision_response.rbi} +481 -481
- data/rbi/stigg/models/v1/subscription_update_params.rbi +3578 -0
- data/rbi/stigg/models/v1/subscriptions/{future_update_cancel_schedule_response.rbi → cancel_subscription.rbi} +9 -16
- data/rbi/stigg/models/v1/usage_history_params.rbi +79 -0
- data/rbi/stigg/models/v1/usage_history_response.rbi +347 -0
- data/rbi/stigg/models/v1/usage_report_params.rbi +227 -0
- data/rbi/stigg/models/v1/usage_report_response.rbi +162 -0
- data/rbi/stigg/models.rbi +0 -4
- data/rbi/stigg/resources/v1/coupons.rbi +2 -2
- data/rbi/stigg/resources/v1/customers/promotional_entitlements.rbi +57 -0
- data/rbi/stigg/resources/v1/customers.rbi +53 -36
- data/rbi/stigg/resources/v1/events.rbi +28 -0
- data/rbi/stigg/resources/v1/subscriptions/future_update.rbi +2 -6
- data/rbi/stigg/resources/v1/subscriptions.rbi +179 -74
- data/rbi/stigg/resources/v1/usage.rbi +57 -0
- data/rbi/stigg/resources/v1.rbi +4 -26
- data/sig/stigg/models/v1/{coupon_create_response.rbs → coupon.rbs} +29 -32
- data/sig/stigg/models/v1/customer_import_params.rbs +74 -0
- data/sig/stigg/models/v1/customer_import_response.rbs +30 -0
- data/sig/stigg/models/v1/{customer_create_params.rbs → customer_provision_params.rbs} +22 -22
- data/sig/stigg/models/v1/customers/promotional_entitlement_grant_params.rbs +234 -0
- data/sig/stigg/models/v1/customers/promotional_entitlement_grant_response.rbs +281 -0
- data/sig/stigg/models/v1/customers/promotional_entitlement_revoke_params.rbs +27 -0
- data/sig/stigg/models/v1/customers/promotional_entitlement_revoke_response.rbs +281 -0
- data/sig/stigg/models/v1/event_report_params.rbs +82 -0
- data/sig/stigg/models/v1/event_report_response.rbs +15 -0
- data/sig/stigg/models/v1/{subscription_retrieve_response.rbs → subscription.rbs} +36 -41
- data/sig/stigg/models/v1/subscription_cancel_params.rbs +79 -0
- data/sig/stigg/models/v1/subscription_import_params.rbs +84 -0
- data/sig/stigg/models/v1/subscription_import_response.rbs +30 -0
- data/sig/stigg/models/v1/{subscription_create_params.rbs → subscription_provision_params.rbs} +200 -200
- data/sig/stigg/models/v1/{subscription_create_response.rbs → subscription_provision_response.rbs} +106 -106
- data/sig/stigg/models/v1/subscription_update_params.rbs +1544 -0
- data/sig/stigg/models/v1/subscriptions/cancel_subscription.rbs +34 -0
- data/sig/stigg/models/v1/usage_history_params.rbs +52 -0
- data/sig/stigg/models/v1/usage_history_response.rbs +129 -0
- data/sig/stigg/models/v1/usage_report_params.rbs +102 -0
- data/sig/stigg/models/v1/usage_report_response.rbs +87 -0
- data/sig/stigg/models.rbs +0 -4
- data/sig/stigg/resources/v1/coupons.rbs +2 -2
- data/sig/stigg/resources/v1/customers/promotional_entitlements.rbs +23 -0
- data/sig/stigg/resources/v1/customers.rbs +17 -12
- data/sig/stigg/resources/v1/events.rbs +14 -0
- data/sig/stigg/resources/v1/subscriptions/future_update.rbs +2 -2
- data/sig/stigg/resources/v1/subscriptions.rbs +65 -32
- data/sig/stigg/resources/v1/usage.rbs +24 -0
- data/sig/stigg/resources/v1.rbs +2 -8
- metadata +77 -50
- data/lib/stigg/models/v1/coupon_retrieve_response.rb +0 -322
- data/lib/stigg/models/v1/subscription_delegate_response.rb +0 -314
- data/lib/stigg/models/v1/subscription_migrate_response.rb +0 -314
- data/lib/stigg/models/v1/subscription_transfer_response.rb +0 -314
- data/lib/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rb +0 -34
- data/lib/stigg/models/v1_create_event_params.rb +0 -89
- data/lib/stigg/models/v1_create_event_response.rb +0 -23
- data/lib/stigg/models/v1_create_usage_params.rb +0 -112
- data/lib/stigg/models/v1_create_usage_response.rb +0 -118
- data/lib/stigg/resources/v1/customers/usage.rb +0 -18
- data/rbi/stigg/models/v1/coupon_retrieve_response.rbi +0 -987
- data/rbi/stigg/models/v1/subscription_delegate_response.rbi +0 -618
- data/rbi/stigg/models/v1/subscription_retrieve_response.rbi +0 -618
- data/rbi/stigg/models/v1/subscription_transfer_response.rbi +0 -618
- data/rbi/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbi +0 -80
- data/rbi/stigg/models/v1_create_event_params.rbi +0 -161
- data/rbi/stigg/models/v1_create_event_response.rbi +0 -30
- data/rbi/stigg/models/v1_create_usage_params.rbi +0 -217
- data/rbi/stigg/models/v1_create_usage_response.rbi +0 -157
- data/rbi/stigg/resources/v1/customers/usage.rbi +0 -16
- data/sig/stigg/models/v1/coupon_retrieve_response.rbs +0 -394
- data/sig/stigg/models/v1/subscription_delegate_response.rbs +0 -255
- data/sig/stigg/models/v1/subscription_migrate_response.rbs +0 -255
- data/sig/stigg/models/v1/subscription_transfer_response.rbs +0 -255
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_pending_payment_response.rbs +0 -34
- data/sig/stigg/models/v1/subscriptions/future_update_cancel_schedule_response.rbs +0 -34
- data/sig/stigg/models/v1_create_event_params.rbs +0 -80
- data/sig/stigg/models/v1_create_event_response.rbs +0 -13
- data/sig/stigg/models/v1_create_usage_params.rbs +0 -100
- data/sig/stigg/models/v1_create_usage_response.rbs +0 -85
- data/sig/stigg/resources/v1/customers/usage.rbs +0 -11
|
@@ -7,42 +7,8 @@ module Stigg
|
|
|
7
7
|
# @return [Stigg::Resources::V1::Customers::PaymentMethod]
|
|
8
8
|
attr_reader :payment_method
|
|
9
9
|
|
|
10
|
-
# @return [Stigg::Resources::V1::Customers::
|
|
11
|
-
attr_reader :
|
|
12
|
-
|
|
13
|
-
# Provision customer
|
|
14
|
-
#
|
|
15
|
-
# @overload create(id:, coupon_id: nil, default_payment_method: nil, email: nil, integrations: nil, metadata: nil, name: nil, request_options: {})
|
|
16
|
-
#
|
|
17
|
-
# @param id [String] Customer slug
|
|
18
|
-
#
|
|
19
|
-
# @param coupon_id [String, nil] Customer level coupon
|
|
20
|
-
#
|
|
21
|
-
# @param default_payment_method [Stigg::Models::V1::CustomerCreateParams::DefaultPaymentMethod, nil] The default payment method details
|
|
22
|
-
#
|
|
23
|
-
# @param email [String, nil] The email of the customer
|
|
24
|
-
#
|
|
25
|
-
# @param integrations [Array<Stigg::Models::V1::CustomerCreateParams::Integration>] List of integrations
|
|
26
|
-
#
|
|
27
|
-
# @param metadata [Hash{Symbol=>String}] Additional metadata
|
|
28
|
-
#
|
|
29
|
-
# @param name [String, nil] The name of the customer
|
|
30
|
-
#
|
|
31
|
-
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
32
|
-
#
|
|
33
|
-
# @return [Stigg::Models::V1::CustomerResponse]
|
|
34
|
-
#
|
|
35
|
-
# @see Stigg::Models::V1::CustomerCreateParams
|
|
36
|
-
def create(params)
|
|
37
|
-
parsed, options = Stigg::V1::CustomerCreateParams.dump_request(params)
|
|
38
|
-
@client.request(
|
|
39
|
-
method: :post,
|
|
40
|
-
path: "api/v1/customers",
|
|
41
|
-
body: parsed,
|
|
42
|
-
model: Stigg::V1::CustomerResponse,
|
|
43
|
-
options: options
|
|
44
|
-
)
|
|
45
|
-
end
|
|
10
|
+
# @return [Stigg::Resources::V1::Customers::PromotionalEntitlements]
|
|
11
|
+
attr_reader :promotional_entitlements
|
|
46
12
|
|
|
47
13
|
# Get a single customer by ID
|
|
48
14
|
#
|
|
@@ -143,6 +109,62 @@ module Stigg
|
|
|
143
109
|
)
|
|
144
110
|
end
|
|
145
111
|
|
|
112
|
+
# Bulk import customers
|
|
113
|
+
#
|
|
114
|
+
# @overload import(customers:, request_options: {})
|
|
115
|
+
#
|
|
116
|
+
# @param customers [Array<Stigg::Models::V1::CustomerImportParams::Customer>] List of customer objects to import
|
|
117
|
+
#
|
|
118
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
119
|
+
#
|
|
120
|
+
# @return [Stigg::Models::V1::CustomerImportResponse]
|
|
121
|
+
#
|
|
122
|
+
# @see Stigg::Models::V1::CustomerImportParams
|
|
123
|
+
def import(params)
|
|
124
|
+
parsed, options = Stigg::V1::CustomerImportParams.dump_request(params)
|
|
125
|
+
@client.request(
|
|
126
|
+
method: :post,
|
|
127
|
+
path: "api/v1/customers/import",
|
|
128
|
+
body: parsed,
|
|
129
|
+
model: Stigg::Models::V1::CustomerImportResponse,
|
|
130
|
+
options: options
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Provision customer
|
|
135
|
+
#
|
|
136
|
+
# @overload provision(id:, coupon_id: nil, default_payment_method: nil, email: nil, integrations: nil, metadata: nil, name: nil, request_options: {})
|
|
137
|
+
#
|
|
138
|
+
# @param id [String] Customer slug
|
|
139
|
+
#
|
|
140
|
+
# @param coupon_id [String, nil] Customer level coupon
|
|
141
|
+
#
|
|
142
|
+
# @param default_payment_method [Stigg::Models::V1::CustomerProvisionParams::DefaultPaymentMethod, nil] The default payment method details
|
|
143
|
+
#
|
|
144
|
+
# @param email [String, nil] The email of the customer
|
|
145
|
+
#
|
|
146
|
+
# @param integrations [Array<Stigg::Models::V1::CustomerProvisionParams::Integration>] List of integrations
|
|
147
|
+
#
|
|
148
|
+
# @param metadata [Hash{Symbol=>String}] Additional metadata
|
|
149
|
+
#
|
|
150
|
+
# @param name [String, nil] The name of the customer
|
|
151
|
+
#
|
|
152
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
153
|
+
#
|
|
154
|
+
# @return [Stigg::Models::V1::CustomerResponse]
|
|
155
|
+
#
|
|
156
|
+
# @see Stigg::Models::V1::CustomerProvisionParams
|
|
157
|
+
def provision(params)
|
|
158
|
+
parsed, options = Stigg::V1::CustomerProvisionParams.dump_request(params)
|
|
159
|
+
@client.request(
|
|
160
|
+
method: :post,
|
|
161
|
+
path: "api/v1/customers",
|
|
162
|
+
body: parsed,
|
|
163
|
+
model: Stigg::V1::CustomerResponse,
|
|
164
|
+
options: options
|
|
165
|
+
)
|
|
166
|
+
end
|
|
167
|
+
|
|
146
168
|
# Unarchive customer
|
|
147
169
|
#
|
|
148
170
|
# @overload unarchive(id, request_options: {})
|
|
@@ -169,7 +191,7 @@ module Stigg
|
|
|
169
191
|
def initialize(client:)
|
|
170
192
|
@client = client
|
|
171
193
|
@payment_method = Stigg::Resources::V1::Customers::PaymentMethod.new(client: client)
|
|
172
|
-
@
|
|
194
|
+
@promotional_entitlements = Stigg::Resources::V1::Customers::PromotionalEntitlements.new(client: client)
|
|
173
195
|
end
|
|
174
196
|
end
|
|
175
197
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Events
|
|
7
|
+
# Report usage events
|
|
8
|
+
#
|
|
9
|
+
# @overload report(events:, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param events [Array<Stigg::Models::V1::EventReportParams::Event>] A list of usage events to report
|
|
12
|
+
#
|
|
13
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
14
|
+
#
|
|
15
|
+
# @return [Stigg::Models::V1::EventReportResponse]
|
|
16
|
+
#
|
|
17
|
+
# @see Stigg::Models::V1::EventReportParams
|
|
18
|
+
def report(params)
|
|
19
|
+
parsed, options = Stigg::V1::EventReportParams.dump_request(params)
|
|
20
|
+
@client.request(
|
|
21
|
+
method: :post,
|
|
22
|
+
path: "api/v1/events",
|
|
23
|
+
body: parsed,
|
|
24
|
+
model: Stigg::Models::V1::EventReportResponse,
|
|
25
|
+
options: options
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# @api private
|
|
30
|
+
#
|
|
31
|
+
# @param client [Stigg::Client]
|
|
32
|
+
def initialize(client:)
|
|
33
|
+
@client = client
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -13,14 +13,14 @@ module Stigg
|
|
|
13
13
|
#
|
|
14
14
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
15
15
|
#
|
|
16
|
-
# @return [Stigg::Models::V1::Subscriptions::
|
|
16
|
+
# @return [Stigg::Models::V1::Subscriptions::CancelSubscription]
|
|
17
17
|
#
|
|
18
18
|
# @see Stigg::Models::V1::Subscriptions::FutureUpdateCancelPendingPaymentParams
|
|
19
19
|
def cancel_pending_payment(id, params = {})
|
|
20
20
|
@client.request(
|
|
21
21
|
method: :delete,
|
|
22
22
|
path: ["api/v1/subscriptions/%1$s/future-update/pending-payment", id],
|
|
23
|
-
model: Stigg::
|
|
23
|
+
model: Stigg::V1::Subscriptions::CancelSubscription,
|
|
24
24
|
options: params[:request_options]
|
|
25
25
|
)
|
|
26
26
|
end
|
|
@@ -33,14 +33,14 @@ module Stigg
|
|
|
33
33
|
#
|
|
34
34
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
35
35
|
#
|
|
36
|
-
# @return [Stigg::Models::V1::Subscriptions::
|
|
36
|
+
# @return [Stigg::Models::V1::Subscriptions::CancelSubscription]
|
|
37
37
|
#
|
|
38
38
|
# @see Stigg::Models::V1::Subscriptions::FutureUpdateCancelScheduleParams
|
|
39
39
|
def cancel_schedule(id, params = {})
|
|
40
40
|
@client.request(
|
|
41
41
|
method: :delete,
|
|
42
42
|
path: ["api/v1/subscriptions/%1$s/future-update/schedule", id],
|
|
43
|
-
model: Stigg::
|
|
43
|
+
model: Stigg::V1::Subscriptions::CancelSubscription,
|
|
44
44
|
options: params[:request_options]
|
|
45
45
|
)
|
|
46
46
|
end
|
|
@@ -7,96 +7,76 @@ module Stigg
|
|
|
7
7
|
# @return [Stigg::Resources::V1::Subscriptions::FutureUpdate]
|
|
8
8
|
attr_reader :future_update
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# Get a single subscription by ID
|
|
11
11
|
#
|
|
12
|
-
# @overload
|
|
12
|
+
# @overload retrieve(id, request_options: {})
|
|
13
13
|
#
|
|
14
|
-
# @param
|
|
14
|
+
# @param id [String] The unique identifier of the entity
|
|
15
15
|
#
|
|
16
|
-
# @param
|
|
16
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
17
17
|
#
|
|
18
|
-
# @
|
|
18
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
19
19
|
#
|
|
20
|
-
# @
|
|
20
|
+
# @see Stigg::Models::V1::SubscriptionRetrieveParams
|
|
21
|
+
def retrieve(id, params = {})
|
|
22
|
+
@client.request(
|
|
23
|
+
method: :get,
|
|
24
|
+
path: ["api/v1/subscriptions/%1$s", id],
|
|
25
|
+
model: Stigg::V1::Subscription,
|
|
26
|
+
options: params[:request_options]
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Update a subscription
|
|
21
31
|
#
|
|
22
|
-
# @
|
|
32
|
+
# @overload update(id, addons: nil, applied_coupon: nil, await_payment_confirmation: nil, billing_information: nil, billing_period: nil, budget: nil, charges: nil, metadata: nil, minimum_spend: nil, price_overrides: nil, promotion_code: nil, schedule_strategy: nil, subscription_entitlements: nil, trial_end_date: nil, request_options: {})
|
|
23
33
|
#
|
|
24
|
-
# @param
|
|
34
|
+
# @param id [String] The unique identifier of the entity
|
|
25
35
|
#
|
|
26
|
-
# @param
|
|
36
|
+
# @param addons [Array<Stigg::Models::V1::SubscriptionUpdateParams::Addon>]
|
|
27
37
|
#
|
|
28
|
-
# @param
|
|
38
|
+
# @param applied_coupon [Stigg::Models::V1::SubscriptionUpdateParams::AppliedCoupon]
|
|
29
39
|
#
|
|
30
|
-
# @param
|
|
40
|
+
# @param await_payment_confirmation [Boolean]
|
|
31
41
|
#
|
|
32
|
-
# @param
|
|
42
|
+
# @param billing_information [Stigg::Models::V1::SubscriptionUpdateParams::BillingInformation]
|
|
33
43
|
#
|
|
34
|
-
# @param
|
|
44
|
+
# @param billing_period [Symbol, Stigg::Models::V1::SubscriptionUpdateParams::BillingPeriod]
|
|
35
45
|
#
|
|
36
|
-
# @param
|
|
46
|
+
# @param budget [Stigg::Models::V1::SubscriptionUpdateParams::Budget, nil]
|
|
37
47
|
#
|
|
38
|
-
# @param
|
|
48
|
+
# @param charges [Array<Stigg::Models::V1::SubscriptionUpdateParams::Charge>]
|
|
39
49
|
#
|
|
40
50
|
# @param metadata [Hash{Symbol=>String}] Additional metadata for the subscription
|
|
41
51
|
#
|
|
42
|
-
# @param minimum_spend [Stigg::Models::V1::
|
|
52
|
+
# @param minimum_spend [Stigg::Models::V1::SubscriptionUpdateParams::MinimumSpend, nil]
|
|
43
53
|
#
|
|
44
|
-
# @param
|
|
54
|
+
# @param price_overrides [Array<Stigg::Models::V1::SubscriptionUpdateParams::PriceOverride>]
|
|
45
55
|
#
|
|
46
|
-
# @param
|
|
56
|
+
# @param promotion_code [String]
|
|
47
57
|
#
|
|
48
|
-
# @param
|
|
58
|
+
# @param schedule_strategy [Symbol, Stigg::Models::V1::SubscriptionUpdateParams::ScheduleStrategy]
|
|
49
59
|
#
|
|
50
|
-
# @param
|
|
51
|
-
#
|
|
52
|
-
# @param salesforce_id [String, nil] Salesforce ID
|
|
60
|
+
# @param subscription_entitlements [Array<Stigg::Models::V1::SubscriptionUpdateParams::SubscriptionEntitlement>]
|
|
53
61
|
#
|
|
54
|
-
# @param
|
|
55
|
-
#
|
|
56
|
-
# @param start_date [Time] Subscription start date
|
|
57
|
-
#
|
|
58
|
-
# @param subscription_entitlements [Array<Stigg::Models::V1::SubscriptionCreateParams::SubscriptionEntitlement>]
|
|
59
|
-
#
|
|
60
|
-
# @param trial_override_configuration [Stigg::Models::V1::SubscriptionCreateParams::TrialOverrideConfiguration] Trial period override settings
|
|
61
|
-
#
|
|
62
|
-
# @param unit_quantity [Float]
|
|
62
|
+
# @param trial_end_date [Time] Subscription trial end date
|
|
63
63
|
#
|
|
64
64
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
65
65
|
#
|
|
66
|
-
# @return [Stigg::Models::V1::
|
|
66
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
67
67
|
#
|
|
68
|
-
# @see Stigg::Models::V1::
|
|
69
|
-
def
|
|
70
|
-
parsed, options = Stigg::V1::
|
|
68
|
+
# @see Stigg::Models::V1::SubscriptionUpdateParams
|
|
69
|
+
def update(id, params = {})
|
|
70
|
+
parsed, options = Stigg::V1::SubscriptionUpdateParams.dump_request(params)
|
|
71
71
|
@client.request(
|
|
72
|
-
method: :
|
|
73
|
-
path: "api/v1/subscriptions",
|
|
72
|
+
method: :patch,
|
|
73
|
+
path: ["api/v1/subscriptions/%1$s", id],
|
|
74
74
|
body: parsed,
|
|
75
|
-
model: Stigg::
|
|
75
|
+
model: Stigg::V1::Subscription,
|
|
76
76
|
options: options
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
# Get a single subscription by ID
|
|
81
|
-
#
|
|
82
|
-
# @overload retrieve(id, request_options: {})
|
|
83
|
-
#
|
|
84
|
-
# @param id [String] The unique identifier of the entity
|
|
85
|
-
#
|
|
86
|
-
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
87
|
-
#
|
|
88
|
-
# @return [Stigg::Models::V1::SubscriptionRetrieveResponse]
|
|
89
|
-
#
|
|
90
|
-
# @see Stigg::Models::V1::SubscriptionRetrieveParams
|
|
91
|
-
def retrieve(id, params = {})
|
|
92
|
-
@client.request(
|
|
93
|
-
method: :get,
|
|
94
|
-
path: ["api/v1/subscriptions/%1$s", id],
|
|
95
|
-
model: Stigg::Models::V1::SubscriptionRetrieveResponse,
|
|
96
|
-
options: params[:request_options]
|
|
97
|
-
)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
80
|
# Get a list of subscriptions
|
|
101
81
|
#
|
|
102
82
|
# @overload list(after: nil, before: nil, customer_id: nil, limit: nil, status: nil, request_options: {})
|
|
@@ -128,6 +108,36 @@ module Stigg
|
|
|
128
108
|
)
|
|
129
109
|
end
|
|
130
110
|
|
|
111
|
+
# Cancel subscription
|
|
112
|
+
#
|
|
113
|
+
# @overload cancel(id, cancellation_action: nil, cancellation_time: nil, end_date: nil, prorate: nil, request_options: {})
|
|
114
|
+
#
|
|
115
|
+
# @param id [String] The unique identifier of the entity
|
|
116
|
+
#
|
|
117
|
+
# @param cancellation_action [Symbol, Stigg::Models::V1::SubscriptionCancelParams::CancellationAction] Action on cancellation (downgrade or revoke)
|
|
118
|
+
#
|
|
119
|
+
# @param cancellation_time [Symbol, Stigg::Models::V1::SubscriptionCancelParams::CancellationTime] When to cancel (immediate, period end, or date)
|
|
120
|
+
#
|
|
121
|
+
# @param end_date [Time] Subscription end date
|
|
122
|
+
#
|
|
123
|
+
# @param prorate [Boolean] If set, enables or disables prorating of credits on subscription cancellation.
|
|
124
|
+
#
|
|
125
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
126
|
+
#
|
|
127
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
128
|
+
#
|
|
129
|
+
# @see Stigg::Models::V1::SubscriptionCancelParams
|
|
130
|
+
def cancel(id, params = {})
|
|
131
|
+
parsed, options = Stigg::V1::SubscriptionCancelParams.dump_request(params)
|
|
132
|
+
@client.request(
|
|
133
|
+
method: :post,
|
|
134
|
+
path: ["api/v1/subscriptions/%1$s/cancel", id],
|
|
135
|
+
body: parsed,
|
|
136
|
+
model: Stigg::V1::Subscription,
|
|
137
|
+
options: options
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
131
141
|
# Some parameter documentations has been truncated, see
|
|
132
142
|
# {Stigg::Models::V1::SubscriptionDelegateParams} for more details.
|
|
133
143
|
#
|
|
@@ -141,7 +151,7 @@ module Stigg
|
|
|
141
151
|
#
|
|
142
152
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
143
153
|
#
|
|
144
|
-
# @return [Stigg::Models::V1::
|
|
154
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
145
155
|
#
|
|
146
156
|
# @see Stigg::Models::V1::SubscriptionDelegateParams
|
|
147
157
|
def delegate(id, params)
|
|
@@ -150,7 +160,29 @@ module Stigg
|
|
|
150
160
|
method: :post,
|
|
151
161
|
path: ["api/v1/subscriptions/%1$s/delegate", id],
|
|
152
162
|
body: parsed,
|
|
153
|
-
model: Stigg::
|
|
163
|
+
model: Stigg::V1::Subscription,
|
|
164
|
+
options: options
|
|
165
|
+
)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Bulk import subscriptions
|
|
169
|
+
#
|
|
170
|
+
# @overload import(subscriptions:, request_options: {})
|
|
171
|
+
#
|
|
172
|
+
# @param subscriptions [Array<Stigg::Models::V1::SubscriptionImportParams::Subscription>] List of subscription objects to import
|
|
173
|
+
#
|
|
174
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
175
|
+
#
|
|
176
|
+
# @return [Stigg::Models::V1::SubscriptionImportResponse]
|
|
177
|
+
#
|
|
178
|
+
# @see Stigg::Models::V1::SubscriptionImportParams
|
|
179
|
+
def import(params)
|
|
180
|
+
parsed, options = Stigg::V1::SubscriptionImportParams.dump_request(params)
|
|
181
|
+
@client.request(
|
|
182
|
+
method: :post,
|
|
183
|
+
path: "api/v1/subscriptions/import",
|
|
184
|
+
body: parsed,
|
|
185
|
+
model: Stigg::Models::V1::SubscriptionImportResponse,
|
|
154
186
|
options: options
|
|
155
187
|
)
|
|
156
188
|
end
|
|
@@ -165,7 +197,7 @@ module Stigg
|
|
|
165
197
|
#
|
|
166
198
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
167
199
|
#
|
|
168
|
-
# @return [Stigg::Models::V1::
|
|
200
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
169
201
|
#
|
|
170
202
|
# @see Stigg::Models::V1::SubscriptionMigrateParams
|
|
171
203
|
def migrate(id, params = {})
|
|
@@ -174,7 +206,7 @@ module Stigg
|
|
|
174
206
|
method: :post,
|
|
175
207
|
path: ["api/v1/subscriptions/%1$s/migrate", id],
|
|
176
208
|
body: parsed,
|
|
177
|
-
model: Stigg::
|
|
209
|
+
model: Stigg::V1::Subscription,
|
|
178
210
|
options: options
|
|
179
211
|
)
|
|
180
212
|
end
|
|
@@ -229,6 +261,76 @@ module Stigg
|
|
|
229
261
|
)
|
|
230
262
|
end
|
|
231
263
|
|
|
264
|
+
# Provision subscription
|
|
265
|
+
#
|
|
266
|
+
# @overload provision(customer_id:, plan_id:, id: nil, addons: nil, applied_coupon: nil, await_payment_confirmation: nil, billing_country_code: nil, billing_id: nil, billing_information: nil, billing_period: nil, budget: nil, charges: nil, checkout_options: nil, metadata: nil, minimum_spend: nil, paying_customer_id: nil, payment_collection_method: nil, price_overrides: nil, resource_id: nil, salesforce_id: nil, schedule_strategy: nil, start_date: nil, subscription_entitlements: nil, trial_override_configuration: nil, unit_quantity: nil, request_options: {})
|
|
267
|
+
#
|
|
268
|
+
# @param customer_id [String] Customer ID to provision the subscription for
|
|
269
|
+
#
|
|
270
|
+
# @param plan_id [String] Plan ID to provision
|
|
271
|
+
#
|
|
272
|
+
# @param id [String] Unique identifier for the subscription
|
|
273
|
+
#
|
|
274
|
+
# @param addons [Array<Stigg::Models::V1::SubscriptionProvisionParams::Addon>]
|
|
275
|
+
#
|
|
276
|
+
# @param applied_coupon [Stigg::Models::V1::SubscriptionProvisionParams::AppliedCoupon] Coupon configuration
|
|
277
|
+
#
|
|
278
|
+
# @param await_payment_confirmation [Boolean] Whether to wait for payment confirmation before returning the subscription
|
|
279
|
+
#
|
|
280
|
+
# @param billing_country_code [String, nil] The ISO 3166-1 alpha-2 country code for billing
|
|
281
|
+
#
|
|
282
|
+
# @param billing_id [String, nil] External billing system identifier
|
|
283
|
+
#
|
|
284
|
+
# @param billing_information [Stigg::Models::V1::SubscriptionProvisionParams::BillingInformation]
|
|
285
|
+
#
|
|
286
|
+
# @param billing_period [Symbol, Stigg::Models::V1::SubscriptionProvisionParams::BillingPeriod] Billing period (MONTHLY or ANNUALLY)
|
|
287
|
+
#
|
|
288
|
+
# @param budget [Stigg::Models::V1::SubscriptionProvisionParams::Budget, nil]
|
|
289
|
+
#
|
|
290
|
+
# @param charges [Array<Stigg::Models::V1::SubscriptionProvisionParams::Charge>]
|
|
291
|
+
#
|
|
292
|
+
# @param checkout_options [Stigg::Models::V1::SubscriptionProvisionParams::CheckoutOptions] Checkout page configuration for payment collection
|
|
293
|
+
#
|
|
294
|
+
# @param metadata [Hash{Symbol=>String}] Additional metadata for the subscription
|
|
295
|
+
#
|
|
296
|
+
# @param minimum_spend [Stigg::Models::V1::SubscriptionProvisionParams::MinimumSpend, nil]
|
|
297
|
+
#
|
|
298
|
+
# @param paying_customer_id [String, nil] Optional paying customer ID for split billing scenarios
|
|
299
|
+
#
|
|
300
|
+
# @param payment_collection_method [Symbol, Stigg::Models::V1::SubscriptionProvisionParams::PaymentCollectionMethod] How payments should be collected for this subscription
|
|
301
|
+
#
|
|
302
|
+
# @param price_overrides [Array<Stigg::Models::V1::SubscriptionProvisionParams::PriceOverride>]
|
|
303
|
+
#
|
|
304
|
+
# @param resource_id [String, nil] Optional resource ID for multi-instance subscriptions
|
|
305
|
+
#
|
|
306
|
+
# @param salesforce_id [String, nil] Salesforce ID
|
|
307
|
+
#
|
|
308
|
+
# @param schedule_strategy [Symbol, Stigg::Models::V1::SubscriptionProvisionParams::ScheduleStrategy] Strategy for scheduling subscription changes
|
|
309
|
+
#
|
|
310
|
+
# @param start_date [Time] Subscription start date
|
|
311
|
+
#
|
|
312
|
+
# @param subscription_entitlements [Array<Stigg::Models::V1::SubscriptionProvisionParams::SubscriptionEntitlement>]
|
|
313
|
+
#
|
|
314
|
+
# @param trial_override_configuration [Stigg::Models::V1::SubscriptionProvisionParams::TrialOverrideConfiguration] Trial period override settings
|
|
315
|
+
#
|
|
316
|
+
# @param unit_quantity [Float]
|
|
317
|
+
#
|
|
318
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
319
|
+
#
|
|
320
|
+
# @return [Stigg::Models::V1::SubscriptionProvisionResponse]
|
|
321
|
+
#
|
|
322
|
+
# @see Stigg::Models::V1::SubscriptionProvisionParams
|
|
323
|
+
def provision(params)
|
|
324
|
+
parsed, options = Stigg::V1::SubscriptionProvisionParams.dump_request(params)
|
|
325
|
+
@client.request(
|
|
326
|
+
method: :post,
|
|
327
|
+
path: "api/v1/subscriptions",
|
|
328
|
+
body: parsed,
|
|
329
|
+
model: Stigg::Models::V1::SubscriptionProvisionResponse,
|
|
330
|
+
options: options
|
|
331
|
+
)
|
|
332
|
+
end
|
|
333
|
+
|
|
232
334
|
# Transfer subscription to resource
|
|
233
335
|
#
|
|
234
336
|
# @overload transfer(id, destination_resource_id:, request_options: {})
|
|
@@ -239,7 +341,7 @@ module Stigg
|
|
|
239
341
|
#
|
|
240
342
|
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
241
343
|
#
|
|
242
|
-
# @return [Stigg::Models::V1::
|
|
344
|
+
# @return [Stigg::Models::V1::Subscription]
|
|
243
345
|
#
|
|
244
346
|
# @see Stigg::Models::V1::SubscriptionTransferParams
|
|
245
347
|
def transfer(id, params)
|
|
@@ -248,7 +350,7 @@ module Stigg
|
|
|
248
350
|
method: :post,
|
|
249
351
|
path: ["api/v1/subscriptions/%1$s/transfer", id],
|
|
250
352
|
body: parsed,
|
|
251
|
-
model: Stigg::
|
|
353
|
+
model: Stigg::V1::Subscription,
|
|
252
354
|
options: options
|
|
253
355
|
)
|
|
254
356
|
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stigg
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Usage
|
|
7
|
+
# Get usage history
|
|
8
|
+
#
|
|
9
|
+
# @overload history(feature_id, customer_id:, start_date:, end_date: nil, group_by: nil, resource_id: nil, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param feature_id [String] Path param: Feature id
|
|
12
|
+
#
|
|
13
|
+
# @param customer_id [String] Path param: Customer id
|
|
14
|
+
#
|
|
15
|
+
# @param start_date [Time] Query param: The start date of the range
|
|
16
|
+
#
|
|
17
|
+
# @param end_date [Time] Query param: The end date of the range
|
|
18
|
+
#
|
|
19
|
+
# @param group_by [String] Query param
|
|
20
|
+
#
|
|
21
|
+
# @param resource_id [String, nil] Query param: Resource id
|
|
22
|
+
#
|
|
23
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
24
|
+
#
|
|
25
|
+
# @return [Stigg::Models::V1::UsageHistoryResponse]
|
|
26
|
+
#
|
|
27
|
+
# @see Stigg::Models::V1::UsageHistoryParams
|
|
28
|
+
def history(feature_id, params)
|
|
29
|
+
parsed, options = Stigg::V1::UsageHistoryParams.dump_request(params)
|
|
30
|
+
customer_id =
|
|
31
|
+
parsed.delete(:customer_id) do
|
|
32
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
33
|
+
end
|
|
34
|
+
@client.request(
|
|
35
|
+
method: :get,
|
|
36
|
+
path: ["api/v1/usage/%1$s/history/%2$s", customer_id, feature_id],
|
|
37
|
+
query: parsed.transform_keys(
|
|
38
|
+
start_date: "startDate",
|
|
39
|
+
end_date: "endDate",
|
|
40
|
+
group_by: "groupBy",
|
|
41
|
+
resource_id: "resourceId"
|
|
42
|
+
),
|
|
43
|
+
model: Stigg::Models::V1::UsageHistoryResponse,
|
|
44
|
+
options: options
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Report usage measurements
|
|
49
|
+
#
|
|
50
|
+
# @overload report(usages:, request_options: {})
|
|
51
|
+
#
|
|
52
|
+
# @param usages [Array<Stigg::Models::V1::UsageReportParams::Usage>] A list of usage reports to be submitted in bulk
|
|
53
|
+
#
|
|
54
|
+
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
55
|
+
#
|
|
56
|
+
# @return [Stigg::Models::V1::UsageReportResponse]
|
|
57
|
+
#
|
|
58
|
+
# @see Stigg::Models::V1::UsageReportParams
|
|
59
|
+
def report(params)
|
|
60
|
+
parsed, options = Stigg::V1::UsageReportParams.dump_request(params)
|
|
61
|
+
@client.request(
|
|
62
|
+
method: :post,
|
|
63
|
+
path: "api/v1/usage",
|
|
64
|
+
body: parsed,
|
|
65
|
+
model: Stigg::Models::V1::UsageReportResponse,
|
|
66
|
+
options: options
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# @api private
|
|
71
|
+
#
|
|
72
|
+
# @param client [Stigg::Client]
|
|
73
|
+
def initialize(client:)
|
|
74
|
+
@client = client
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
data/lib/stigg/resources/v1.rb
CHANGED
|
@@ -12,49 +12,11 @@ module Stigg
|
|
|
12
12
|
# @return [Stigg::Resources::V1::Coupons]
|
|
13
13
|
attr_reader :coupons
|
|
14
14
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
# @overload create_event(events:, request_options: {})
|
|
18
|
-
#
|
|
19
|
-
# @param events [Array<Stigg::Models::V1CreateEventParams::Event>] A list of usage events to report
|
|
20
|
-
#
|
|
21
|
-
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
22
|
-
#
|
|
23
|
-
# @return [Stigg::Models::V1CreateEventResponse]
|
|
24
|
-
#
|
|
25
|
-
# @see Stigg::Models::V1CreateEventParams
|
|
26
|
-
def create_event(params)
|
|
27
|
-
parsed, options = Stigg::V1CreateEventParams.dump_request(params)
|
|
28
|
-
@client.request(
|
|
29
|
-
method: :post,
|
|
30
|
-
path: "api/v1/events",
|
|
31
|
-
body: parsed,
|
|
32
|
-
model: Stigg::Models::V1CreateEventResponse,
|
|
33
|
-
options: options
|
|
34
|
-
)
|
|
35
|
-
end
|
|
15
|
+
# @return [Stigg::Resources::V1::Events]
|
|
16
|
+
attr_reader :events
|
|
36
17
|
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
# @overload create_usage(usages:, request_options: {})
|
|
40
|
-
#
|
|
41
|
-
# @param usages [Array<Stigg::Models::V1CreateUsageParams::Usage>] A list of usage reports to be submitted in bulk
|
|
42
|
-
#
|
|
43
|
-
# @param request_options [Stigg::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
44
|
-
#
|
|
45
|
-
# @return [Stigg::Models::V1CreateUsageResponse]
|
|
46
|
-
#
|
|
47
|
-
# @see Stigg::Models::V1CreateUsageParams
|
|
48
|
-
def create_usage(params)
|
|
49
|
-
parsed, options = Stigg::V1CreateUsageParams.dump_request(params)
|
|
50
|
-
@client.request(
|
|
51
|
-
method: :post,
|
|
52
|
-
path: "api/v1/usage",
|
|
53
|
-
body: parsed,
|
|
54
|
-
model: Stigg::Models::V1CreateUsageResponse,
|
|
55
|
-
options: options
|
|
56
|
-
)
|
|
57
|
-
end
|
|
18
|
+
# @return [Stigg::Resources::V1::Usage]
|
|
19
|
+
attr_reader :usage
|
|
58
20
|
|
|
59
21
|
# @api private
|
|
60
22
|
#
|
|
@@ -64,6 +26,8 @@ module Stigg
|
|
|
64
26
|
@customers = Stigg::Resources::V1::Customers.new(client: client)
|
|
65
27
|
@subscriptions = Stigg::Resources::V1::Subscriptions.new(client: client)
|
|
66
28
|
@coupons = Stigg::Resources::V1::Coupons.new(client: client)
|
|
29
|
+
@events = Stigg::Resources::V1::Events.new(client: client)
|
|
30
|
+
@usage = Stigg::Resources::V1::Usage.new(client: client)
|
|
67
31
|
end
|
|
68
32
|
end
|
|
69
33
|
end
|
data/lib/stigg/version.rb
CHANGED