license_manager 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +152 -0
- data/README.md +3 -3
- data/docs/BillingPortalSession.md +18 -0
- data/docs/CancelLicense.md +22 -0
- data/docs/CancellationReason.md +15 -0
- data/docs/CancellationStats.md +30 -0
- data/docs/CancellationStatsByReasonInner.md +20 -0
- data/docs/ConnectStripe.md +1 -1
- data/docs/CreateBillingPortalSession.md +18 -0
- data/docs/CreateIntegrationMapping.md +1 -1
- data/docs/CreateLicense.md +2 -0
- data/docs/CreatePolicy.md +3 -1
- data/docs/CreateProductWithPolicy.md +1 -1
- data/docs/CreateToken.md +1 -1
- data/docs/EventActorOneOf.md +1 -1
- data/docs/Integration.md +11 -1
- data/docs/IntegrationMapping.md +2 -0
- data/docs/IntegrationMappingRecurring.md +20 -0
- data/docs/IntegrationsApi.md +74 -0
- data/docs/License.md +12 -0
- data/docs/LicenseSubscription.md +34 -0
- data/docs/LicensesApi.md +80 -3
- data/docs/Machine.md +3 -1
- data/docs/MachinesApi.md +1 -1
- data/docs/Mrr.md +26 -0
- data/docs/MrrByIntervalInner.md +24 -0
- data/docs/MrrByPolicyInner.md +22 -0
- data/docs/Policy.md +2 -0
- data/docs/PolicySettings.md +3 -1
- data/docs/PortalApi.md +80 -1
- data/docs/PortalLink.md +2 -2
- data/docs/Product.md +2 -0
- data/docs/ProductStats.md +8 -4
- data/docs/ProductsApi.md +2 -2
- data/docs/Revenue.md +10 -2
- data/docs/StripeIntegration.md +1 -1
- data/docs/StripePermission.md +5 -1
- data/docs/StripePrice.md +2 -0
- data/docs/StripePriceRecurring.md +20 -0
- data/docs/SubscriptionStats.md +38 -0
- data/docs/UpdateIntegration.md +20 -0
- data/docs/UpdateLicense.md +3 -1
- data/docs/UpdatePolicy.md +3 -1
- data/docs/UpdateProduct.md +3 -1
- data/lib/license_manager/api/integrations_api.rb +74 -0
- data/lib/license_manager/api/licenses_api.rb +80 -6
- data/lib/license_manager/api/machines_api.rb +3 -3
- data/lib/license_manager/api/portal_api.rb +72 -2
- data/lib/license_manager/api/products_api.rb +4 -4
- data/lib/license_manager/models/billing_portal_session.rb +178 -0
- data/lib/license_manager/models/cancel_license.rb +238 -0
- data/lib/license_manager/models/cancellation_reason.rb +45 -0
- data/lib/license_manager/models/cancellation_stats.rb +347 -0
- data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
- data/lib/license_manager/models/connect_stripe.rb +1 -1
- data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
- data/lib/license_manager/models/create_integration_mapping.rb +1 -1
- data/lib/license_manager/models/create_license.rb +12 -1
- data/lib/license_manager/models/create_policy.rb +40 -5
- data/lib/license_manager/models/create_product_with_policy.rb +1 -1
- data/lib/license_manager/models/create_token.rb +1 -1
- data/lib/license_manager/models/event_type.rb +7 -1
- data/lib/license_manager/models/integration.rb +136 -1
- data/lib/license_manager/models/integration_mapping.rb +13 -1
- data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
- data/lib/license_manager/models/license.rb +91 -1
- data/lib/license_manager/models/license_status.rb +2 -1
- data/lib/license_manager/models/license_subscription.rb +388 -0
- data/lib/license_manager/models/machine.rb +17 -4
- data/lib/license_manager/models/mrr.rb +291 -0
- data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
- data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
- data/lib/license_manager/models/policy.rb +14 -1
- data/lib/license_manager/models/policy_settings.rb +40 -5
- data/lib/license_manager/models/portal_link.rb +1 -1
- data/lib/license_manager/models/product.rb +28 -1
- data/lib/license_manager/models/product_stats.rb +31 -5
- data/lib/license_manager/models/revenue.rb +112 -4
- data/lib/license_manager/models/stripe_integration.rb +1 -1
- data/lib/license_manager/models/stripe_permission.rb +58 -4
- data/lib/license_manager/models/stripe_price.rb +13 -1
- data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
- data/lib/license_manager/models/subscription_stats.rb +456 -0
- data/lib/license_manager/models/update_integration.rb +199 -0
- data/lib/license_manager/models/update_license.rb +16 -5
- data/lib/license_manager/models/update_policy.rb +40 -5
- data/lib/license_manager/models/update_product.rb +14 -4
- data/lib/license_manager/version.rb +1 -1
- data/lib/license_manager.rb +14 -0
- data/openapi.json +1146 -59
- data/spec/api/integrations_api_spec.rb +13 -0
- data/spec/api/licenses_api_spec.rb +16 -3
- data/spec/api/machines_api_spec.rb +1 -1
- data/spec/api/portal_api_spec.rb +14 -1
- data/spec/api/products_api_spec.rb +2 -2
- data/spec/models/billing_portal_session_spec.rb +36 -0
- data/spec/models/cancel_license_spec.rb +48 -0
- data/spec/models/cancellation_reason_spec.rb +30 -0
- data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
- data/spec/models/cancellation_stats_spec.rb +72 -0
- data/spec/models/create_billing_portal_session_spec.rb +36 -0
- data/spec/models/create_license_spec.rb +6 -0
- data/spec/models/create_policy_spec.rb +6 -0
- data/spec/models/create_token_spec.rb +1 -1
- data/spec/models/integration_mapping_recurring_spec.rb +46 -0
- data/spec/models/integration_mapping_spec.rb +6 -0
- data/spec/models/integration_spec.rb +30 -0
- data/spec/models/license_spec.rb +36 -0
- data/spec/models/license_subscription_spec.rb +88 -0
- data/spec/models/machine_spec.rb +7 -1
- data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
- data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
- data/spec/models/mrr_spec.rb +60 -0
- data/spec/models/policy_settings_spec.rb +6 -0
- data/spec/models/policy_spec.rb +6 -0
- data/spec/models/product_spec.rb +6 -0
- data/spec/models/product_stats_spec.rb +12 -0
- data/spec/models/revenue_spec.rb +24 -0
- data/spec/models/stripe_permission_spec.rb +12 -0
- data/spec/models/stripe_price_recurring_spec.rb +46 -0
- data/spec/models/stripe_price_spec.rb +6 -0
- data/spec/models/subscription_stats_spec.rb +96 -0
- data/spec/models/token_spec.rb +1 -1
- data/spec/models/update_integration_spec.rb +42 -0
- data/spec/models/update_license_spec.rb +6 -0
- data/spec/models/update_policy_spec.rb +6 -0
- data/spec/models/update_product_spec.rb +6 -0
- metadata +57 -1
|
@@ -14,17 +14,29 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module LicenseManager
|
|
17
|
-
# Revenue
|
|
17
|
+
# Revenue in one currency: the licenses sold once, each counting on the day it was created, and the payments of the subscription licenses, each counting on the day it was paid, with the license's policy. Licenses without a price are left out, and so are canceled ones, but in `canceledLicenseCount` and `canceledTotal`.
|
|
18
18
|
class Revenue < ApiModelBase
|
|
19
19
|
# ISO 4217 code of the currency of the revenue.
|
|
20
20
|
attr_accessor :currency
|
|
21
21
|
|
|
22
|
-
# Number of licenses sold in the currency, free ones included.
|
|
22
|
+
# Number of licenses sold once in the currency, free ones included, canceled ones and subscription licenses left out.
|
|
23
23
|
attr_accessor :license_count
|
|
24
24
|
|
|
25
|
-
#
|
|
25
|
+
# Revenue in the currency, in major units: the prices of the licenses sold once, canceled ones left out, plus the payments of the subscriptions, `subscriptionTotal`.
|
|
26
26
|
attr_accessor :total
|
|
27
27
|
|
|
28
|
+
# Sum of the payments of the subscription licenses in the currency, before taxes, in major units.
|
|
29
|
+
attr_accessor :subscription_total
|
|
30
|
+
|
|
31
|
+
# Number of payments of the subscription licenses in the currency.
|
|
32
|
+
attr_accessor :payment_count
|
|
33
|
+
|
|
34
|
+
# Number of canceled licenses sold once in the currency.
|
|
35
|
+
attr_accessor :canceled_license_count
|
|
36
|
+
|
|
37
|
+
# Sum of the prices of the canceled licenses sold once in the currency, in major units: revenue lost to cancellations.
|
|
38
|
+
attr_accessor :canceled_total
|
|
39
|
+
|
|
28
40
|
# Revenue of the current month, in UTC.
|
|
29
41
|
attr_accessor :this_month
|
|
30
42
|
|
|
@@ -49,6 +61,10 @@ module LicenseManager
|
|
|
49
61
|
:'currency' => :'currency',
|
|
50
62
|
:'license_count' => :'licenseCount',
|
|
51
63
|
:'total' => :'total',
|
|
64
|
+
:'subscription_total' => :'subscriptionTotal',
|
|
65
|
+
:'payment_count' => :'paymentCount',
|
|
66
|
+
:'canceled_license_count' => :'canceledLicenseCount',
|
|
67
|
+
:'canceled_total' => :'canceledTotal',
|
|
52
68
|
:'this_month' => :'thisMonth',
|
|
53
69
|
:'last_month' => :'lastMonth',
|
|
54
70
|
:'last30_days' => :'last30Days',
|
|
@@ -74,6 +90,10 @@ module LicenseManager
|
|
|
74
90
|
:'currency' => :'String',
|
|
75
91
|
:'license_count' => :'Integer',
|
|
76
92
|
:'total' => :'Float',
|
|
93
|
+
:'subscription_total' => :'Float',
|
|
94
|
+
:'payment_count' => :'Integer',
|
|
95
|
+
:'canceled_license_count' => :'Integer',
|
|
96
|
+
:'canceled_total' => :'Float',
|
|
77
97
|
:'this_month' => :'Float',
|
|
78
98
|
:'last_month' => :'Float',
|
|
79
99
|
:'last30_days' => :'Float',
|
|
@@ -133,6 +153,30 @@ module LicenseManager
|
|
|
133
153
|
self.total = nil
|
|
134
154
|
end
|
|
135
155
|
|
|
156
|
+
if attributes.key?(:'subscription_total')
|
|
157
|
+
self.subscription_total = attributes[:'subscription_total']
|
|
158
|
+
else
|
|
159
|
+
self.subscription_total = nil
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'payment_count')
|
|
163
|
+
self.payment_count = attributes[:'payment_count']
|
|
164
|
+
else
|
|
165
|
+
self.payment_count = nil
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if attributes.key?(:'canceled_license_count')
|
|
169
|
+
self.canceled_license_count = attributes[:'canceled_license_count']
|
|
170
|
+
else
|
|
171
|
+
self.canceled_license_count = nil
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if attributes.key?(:'canceled_total')
|
|
175
|
+
self.canceled_total = attributes[:'canceled_total']
|
|
176
|
+
else
|
|
177
|
+
self.canceled_total = nil
|
|
178
|
+
end
|
|
179
|
+
|
|
136
180
|
if attributes.key?(:'this_month')
|
|
137
181
|
self.this_month = attributes[:'this_month']
|
|
138
182
|
else
|
|
@@ -193,6 +237,22 @@ module LicenseManager
|
|
|
193
237
|
invalid_properties.push('invalid value for "total", total cannot be nil.')
|
|
194
238
|
end
|
|
195
239
|
|
|
240
|
+
if @subscription_total.nil?
|
|
241
|
+
invalid_properties.push('invalid value for "subscription_total", subscription_total cannot be nil.')
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
if @payment_count.nil?
|
|
245
|
+
invalid_properties.push('invalid value for "payment_count", payment_count cannot be nil.')
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
if @canceled_license_count.nil?
|
|
249
|
+
invalid_properties.push('invalid value for "canceled_license_count", canceled_license_count cannot be nil.')
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
if @canceled_total.nil?
|
|
253
|
+
invalid_properties.push('invalid value for "canceled_total", canceled_total cannot be nil.')
|
|
254
|
+
end
|
|
255
|
+
|
|
196
256
|
if @this_month.nil?
|
|
197
257
|
invalid_properties.push('invalid value for "this_month", this_month cannot be nil.')
|
|
198
258
|
end
|
|
@@ -227,6 +287,10 @@ module LicenseManager
|
|
|
227
287
|
return false if @currency.nil?
|
|
228
288
|
return false if @license_count.nil?
|
|
229
289
|
return false if @total.nil?
|
|
290
|
+
return false if @subscription_total.nil?
|
|
291
|
+
return false if @payment_count.nil?
|
|
292
|
+
return false if @canceled_license_count.nil?
|
|
293
|
+
return false if @canceled_total.nil?
|
|
230
294
|
return false if @this_month.nil?
|
|
231
295
|
return false if @last_month.nil?
|
|
232
296
|
return false if @last30_days.nil?
|
|
@@ -266,6 +330,46 @@ module LicenseManager
|
|
|
266
330
|
@total = total
|
|
267
331
|
end
|
|
268
332
|
|
|
333
|
+
# Custom attribute writer method with validation
|
|
334
|
+
# @param [Object] subscription_total Value to be assigned
|
|
335
|
+
def subscription_total=(subscription_total)
|
|
336
|
+
if subscription_total.nil?
|
|
337
|
+
fail ArgumentError, 'subscription_total cannot be nil'
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
@subscription_total = subscription_total
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Custom attribute writer method with validation
|
|
344
|
+
# @param [Object] payment_count Value to be assigned
|
|
345
|
+
def payment_count=(payment_count)
|
|
346
|
+
if payment_count.nil?
|
|
347
|
+
fail ArgumentError, 'payment_count cannot be nil'
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
@payment_count = payment_count
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Custom attribute writer method with validation
|
|
354
|
+
# @param [Object] canceled_license_count Value to be assigned
|
|
355
|
+
def canceled_license_count=(canceled_license_count)
|
|
356
|
+
if canceled_license_count.nil?
|
|
357
|
+
fail ArgumentError, 'canceled_license_count cannot be nil'
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
@canceled_license_count = canceled_license_count
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Custom attribute writer method with validation
|
|
364
|
+
# @param [Object] canceled_total Value to be assigned
|
|
365
|
+
def canceled_total=(canceled_total)
|
|
366
|
+
if canceled_total.nil?
|
|
367
|
+
fail ArgumentError, 'canceled_total cannot be nil'
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
@canceled_total = canceled_total
|
|
371
|
+
end
|
|
372
|
+
|
|
269
373
|
# Custom attribute writer method with validation
|
|
270
374
|
# @param [Object] this_month Value to be assigned
|
|
271
375
|
def this_month=(this_month)
|
|
@@ -334,6 +438,10 @@ module LicenseManager
|
|
|
334
438
|
currency == o.currency &&
|
|
335
439
|
license_count == o.license_count &&
|
|
336
440
|
total == o.total &&
|
|
441
|
+
subscription_total == o.subscription_total &&
|
|
442
|
+
payment_count == o.payment_count &&
|
|
443
|
+
canceled_license_count == o.canceled_license_count &&
|
|
444
|
+
canceled_total == o.canceled_total &&
|
|
337
445
|
this_month == o.this_month &&
|
|
338
446
|
last_month == o.last_month &&
|
|
339
447
|
last30_days == o.last30_days &&
|
|
@@ -351,7 +459,7 @@ module LicenseManager
|
|
|
351
459
|
# Calculates hash code according to all attributes.
|
|
352
460
|
# @return [Integer] Hash code
|
|
353
461
|
def hash
|
|
354
|
-
[currency, license_count, total, this_month, last_month, last30_days, by_day, by_month, by_policy].hash
|
|
462
|
+
[currency, license_count, total, subscription_total, payment_count, canceled_license_count, canceled_total, this_month, last_month, last30_days, by_day, by_month, by_policy].hash
|
|
355
463
|
end
|
|
356
464
|
|
|
357
465
|
# Builds the object from hash
|
|
@@ -21,7 +21,7 @@ module LicenseManager
|
|
|
21
21
|
# Whether Stripe can reach the API's webhook URL. A local URL can't be: set `WEBHOOK_URL` on the server, like to a tunnel in development.
|
|
22
22
|
attr_accessor :webhook_url_reachable
|
|
23
23
|
|
|
24
|
-
# Permissions the restricted API key needs, and why. Every other permission can stay `None`.
|
|
24
|
+
# Permissions the restricted API key needs, and why, the `optional` ones included. Every other permission can stay `None`.
|
|
25
25
|
attr_accessor :required_permissions
|
|
26
26
|
|
|
27
27
|
# The organization's Stripe connection in this mode, `null` when there's none.
|
|
@@ -21,6 +21,12 @@ module LicenseManager
|
|
|
21
21
|
|
|
22
22
|
attr_accessor :reason
|
|
23
23
|
|
|
24
|
+
# Whether the key can connect without it, losing what it's for, explained by `reason`.
|
|
25
|
+
attr_accessor :optional
|
|
26
|
+
|
|
27
|
+
# Whether it's only needed to sell subscriptions: checked once a recurring price is mapped.
|
|
28
|
+
attr_accessor :subscriptions
|
|
29
|
+
|
|
24
30
|
class EnumAttributeValidator
|
|
25
31
|
attr_reader :datatype
|
|
26
32
|
attr_reader :allowable_values
|
|
@@ -48,7 +54,9 @@ module LicenseManager
|
|
|
48
54
|
{
|
|
49
55
|
:'resource' => :'resource',
|
|
50
56
|
:'access' => :'access',
|
|
51
|
-
:'reason' => :'reason'
|
|
57
|
+
:'reason' => :'reason',
|
|
58
|
+
:'optional' => :'optional',
|
|
59
|
+
:'subscriptions' => :'subscriptions'
|
|
52
60
|
}
|
|
53
61
|
end
|
|
54
62
|
|
|
@@ -67,7 +75,9 @@ module LicenseManager
|
|
|
67
75
|
{
|
|
68
76
|
:'resource' => :'String',
|
|
69
77
|
:'access' => :'String',
|
|
70
|
-
:'reason' => :'String'
|
|
78
|
+
:'reason' => :'String',
|
|
79
|
+
:'optional' => :'Boolean',
|
|
80
|
+
:'subscriptions' => :'Boolean'
|
|
71
81
|
}
|
|
72
82
|
end
|
|
73
83
|
|
|
@@ -120,6 +130,18 @@ module LicenseManager
|
|
|
120
130
|
else
|
|
121
131
|
self.reason = nil
|
|
122
132
|
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'optional')
|
|
135
|
+
self.optional = attributes[:'optional']
|
|
136
|
+
else
|
|
137
|
+
self.optional = nil
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'subscriptions')
|
|
141
|
+
self.subscriptions = attributes[:'subscriptions']
|
|
142
|
+
else
|
|
143
|
+
self.subscriptions = nil
|
|
144
|
+
end
|
|
123
145
|
end
|
|
124
146
|
|
|
125
147
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -139,6 +161,14 @@ module LicenseManager
|
|
|
139
161
|
invalid_properties.push('invalid value for "reason", reason cannot be nil.')
|
|
140
162
|
end
|
|
141
163
|
|
|
164
|
+
if @optional.nil?
|
|
165
|
+
invalid_properties.push('invalid value for "optional", optional cannot be nil.')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if @subscriptions.nil?
|
|
169
|
+
invalid_properties.push('invalid value for "subscriptions", subscriptions cannot be nil.')
|
|
170
|
+
end
|
|
171
|
+
|
|
142
172
|
invalid_properties
|
|
143
173
|
end
|
|
144
174
|
|
|
@@ -151,6 +181,8 @@ module LicenseManager
|
|
|
151
181
|
access_validator = EnumAttributeValidator.new('String', ["Read", "Write", "unknown_default_open_api"])
|
|
152
182
|
return false unless access_validator.valid?(@access)
|
|
153
183
|
return false if @reason.nil?
|
|
184
|
+
return false if @optional.nil?
|
|
185
|
+
return false if @subscriptions.nil?
|
|
154
186
|
true
|
|
155
187
|
end
|
|
156
188
|
|
|
@@ -184,6 +216,26 @@ module LicenseManager
|
|
|
184
216
|
@reason = reason
|
|
185
217
|
end
|
|
186
218
|
|
|
219
|
+
# Custom attribute writer method with validation
|
|
220
|
+
# @param [Object] optional Value to be assigned
|
|
221
|
+
def optional=(optional)
|
|
222
|
+
if optional.nil?
|
|
223
|
+
fail ArgumentError, 'optional cannot be nil'
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
@optional = optional
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Custom attribute writer method with validation
|
|
230
|
+
# @param [Object] subscriptions Value to be assigned
|
|
231
|
+
def subscriptions=(subscriptions)
|
|
232
|
+
if subscriptions.nil?
|
|
233
|
+
fail ArgumentError, 'subscriptions cannot be nil'
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
@subscriptions = subscriptions
|
|
237
|
+
end
|
|
238
|
+
|
|
187
239
|
# Checks equality by comparing each attribute.
|
|
188
240
|
# @param [Object] Object to be compared
|
|
189
241
|
def ==(o)
|
|
@@ -191,7 +243,9 @@ module LicenseManager
|
|
|
191
243
|
self.class == o.class &&
|
|
192
244
|
resource == o.resource &&
|
|
193
245
|
access == o.access &&
|
|
194
|
-
reason == o.reason
|
|
246
|
+
reason == o.reason &&
|
|
247
|
+
optional == o.optional &&
|
|
248
|
+
subscriptions == o.subscriptions
|
|
195
249
|
end
|
|
196
250
|
|
|
197
251
|
# @see the `==` method
|
|
@@ -203,7 +257,7 @@ module LicenseManager
|
|
|
203
257
|
# Calculates hash code according to all attributes.
|
|
204
258
|
# @return [Integer] Hash code
|
|
205
259
|
def hash
|
|
206
|
-
[resource, access, reason].hash
|
|
260
|
+
[resource, access, reason, optional, subscriptions].hash
|
|
207
261
|
end
|
|
208
262
|
|
|
209
263
|
# Builds the object from hash
|
|
@@ -25,6 +25,8 @@ module LicenseManager
|
|
|
25
25
|
|
|
26
26
|
attr_accessor :price
|
|
27
27
|
|
|
28
|
+
attr_accessor :recurring
|
|
29
|
+
|
|
28
30
|
# Whether the price already creates licenses of a product.
|
|
29
31
|
attr_accessor :mapped
|
|
30
32
|
|
|
@@ -36,6 +38,7 @@ module LicenseManager
|
|
|
36
38
|
:'product_name' => :'productName',
|
|
37
39
|
:'nickname' => :'nickname',
|
|
38
40
|
:'price' => :'price',
|
|
41
|
+
:'recurring' => :'recurring',
|
|
39
42
|
:'mapped' => :'mapped'
|
|
40
43
|
}
|
|
41
44
|
end
|
|
@@ -58,6 +61,7 @@ module LicenseManager
|
|
|
58
61
|
:'product_name' => :'String',
|
|
59
62
|
:'nickname' => :'String',
|
|
60
63
|
:'price' => :'Price',
|
|
64
|
+
:'recurring' => :'StripePriceRecurring',
|
|
61
65
|
:'mapped' => :'Boolean'
|
|
62
66
|
}
|
|
63
67
|
end
|
|
@@ -67,6 +71,7 @@ module LicenseManager
|
|
|
67
71
|
Set.new([
|
|
68
72
|
:'nickname',
|
|
69
73
|
:'price',
|
|
74
|
+
:'recurring',
|
|
70
75
|
])
|
|
71
76
|
end
|
|
72
77
|
|
|
@@ -126,6 +131,12 @@ module LicenseManager
|
|
|
126
131
|
self.price = nil
|
|
127
132
|
end
|
|
128
133
|
|
|
134
|
+
if attributes.key?(:'recurring')
|
|
135
|
+
self.recurring = attributes[:'recurring']
|
|
136
|
+
else
|
|
137
|
+
self.recurring = nil
|
|
138
|
+
end
|
|
139
|
+
|
|
129
140
|
if attributes.key?(:'mapped')
|
|
130
141
|
self.mapped = attributes[:'mapped']
|
|
131
142
|
else
|
|
@@ -218,6 +229,7 @@ module LicenseManager
|
|
|
218
229
|
product_name == o.product_name &&
|
|
219
230
|
nickname == o.nickname &&
|
|
220
231
|
price == o.price &&
|
|
232
|
+
recurring == o.recurring &&
|
|
221
233
|
mapped == o.mapped
|
|
222
234
|
end
|
|
223
235
|
|
|
@@ -230,7 +242,7 @@ module LicenseManager
|
|
|
230
242
|
# Calculates hash code according to all attributes.
|
|
231
243
|
# @return [Integer] Hash code
|
|
232
244
|
def hash
|
|
233
|
-
[id, product_id, product_name, nickname, price, mapped].hash
|
|
245
|
+
[id, product_id, product_name, nickname, price, recurring, mapped].hash
|
|
234
246
|
end
|
|
235
247
|
|
|
236
248
|
# Builds the object from hash
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#LicenseManager API
|
|
3
|
+
|
|
4
|
+
#Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module LicenseManager
|
|
17
|
+
# Billing period of a recurring price, `null` for a one-time price.
|
|
18
|
+
class StripePriceRecurring < ApiModelBase
|
|
19
|
+
attr_accessor :interval
|
|
20
|
+
|
|
21
|
+
attr_accessor :interval_count
|
|
22
|
+
|
|
23
|
+
class EnumAttributeValidator
|
|
24
|
+
attr_reader :datatype
|
|
25
|
+
attr_reader :allowable_values
|
|
26
|
+
|
|
27
|
+
def initialize(datatype, allowable_values)
|
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
|
29
|
+
case datatype.to_s
|
|
30
|
+
when /Integer/i
|
|
31
|
+
value.to_i
|
|
32
|
+
when /Float/i
|
|
33
|
+
value.to_f
|
|
34
|
+
else
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?(value)
|
|
41
|
+
!value || allowable_values.include?(value)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
|
+
def self.attribute_map
|
|
47
|
+
{
|
|
48
|
+
:'interval' => :'interval',
|
|
49
|
+
:'interval_count' => :'intervalCount'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns attribute mapping this model knows about
|
|
54
|
+
def self.acceptable_attribute_map
|
|
55
|
+
attribute_map
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns all the JSON keys this model knows about
|
|
59
|
+
def self.acceptable_attributes
|
|
60
|
+
acceptable_attribute_map.values
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.openapi_types
|
|
65
|
+
{
|
|
66
|
+
:'interval' => :'String',
|
|
67
|
+
:'interval_count' => :'Integer'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Returns attribute type mapping
|
|
78
|
+
def self.acceptable_openapi_types
|
|
79
|
+
openapi_types
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns the nullable attributes
|
|
83
|
+
def self.acceptable_openapi_nullable
|
|
84
|
+
openapi_nullable
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Initializes the object
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
def initialize(attributes = {})
|
|
90
|
+
if (!attributes.is_a?(Hash))
|
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::StripePriceRecurring` initialize method"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
97
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
98
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::StripePriceRecurring`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
99
|
+
end
|
|
100
|
+
h[k.to_sym] = v
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'interval')
|
|
104
|
+
self.interval = attributes[:'interval']
|
|
105
|
+
else
|
|
106
|
+
self.interval = nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'interval_count')
|
|
110
|
+
self.interval_count = attributes[:'interval_count']
|
|
111
|
+
else
|
|
112
|
+
self.interval_count = nil
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def list_invalid_properties
|
|
119
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
120
|
+
invalid_properties = Array.new
|
|
121
|
+
if @interval.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "interval", interval cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if @interval_count.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "interval_count", interval_count cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
invalid_properties
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Check to see if the all the properties in the model are valid
|
|
133
|
+
# @return true if the model is valid
|
|
134
|
+
def valid?
|
|
135
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
136
|
+
return false if @interval.nil?
|
|
137
|
+
interval_validator = EnumAttributeValidator.new('String', ["day", "week", "month", "year", "unknown_default_open_api"])
|
|
138
|
+
return false unless interval_validator.valid?(@interval)
|
|
139
|
+
return false if @interval_count.nil?
|
|
140
|
+
true
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
144
|
+
# @param [Object] interval Object to be assigned
|
|
145
|
+
def interval=(interval)
|
|
146
|
+
validator = EnumAttributeValidator.new('String', ["day", "week", "month", "year", "unknown_default_open_api"])
|
|
147
|
+
unless validator.valid?(interval)
|
|
148
|
+
fail ArgumentError, "invalid value for \"interval\", must be one of #{validator.allowable_values}."
|
|
149
|
+
end
|
|
150
|
+
@interval = interval
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Custom attribute writer method with validation
|
|
154
|
+
# @param [Object] interval_count Value to be assigned
|
|
155
|
+
def interval_count=(interval_count)
|
|
156
|
+
if interval_count.nil?
|
|
157
|
+
fail ArgumentError, 'interval_count cannot be nil'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
@interval_count = interval_count
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Checks equality by comparing each attribute.
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def ==(o)
|
|
166
|
+
return true if self.equal?(o)
|
|
167
|
+
self.class == o.class &&
|
|
168
|
+
interval == o.interval &&
|
|
169
|
+
interval_count == o.interval_count
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @see the `==` method
|
|
173
|
+
# @param [Object] Object to be compared
|
|
174
|
+
def eql?(o)
|
|
175
|
+
self == o
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Calculates hash code according to all attributes.
|
|
179
|
+
# @return [Integer] Hash code
|
|
180
|
+
def hash
|
|
181
|
+
[interval, interval_count].hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Builds the object from hash
|
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
186
|
+
# @return [Object] Returns the model itself
|
|
187
|
+
def self.build_from_hash(attributes)
|
|
188
|
+
return nil unless attributes.is_a?(Hash)
|
|
189
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
190
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
191
|
+
map = acceptable_attribute_map
|
|
192
|
+
transformed_hash = {}
|
|
193
|
+
acceptable_openapi_types.each_pair do |key, type|
|
|
194
|
+
if attributes.key?(map[key]) && attributes[map[key]].nil?
|
|
195
|
+
transformed_hash["#{key}"] = nil
|
|
196
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
197
|
+
# check to ensure the input is an array given that the attribute
|
|
198
|
+
# is documented as an array but the input is not
|
|
199
|
+
if attributes[map[key]].is_a?(Array)
|
|
200
|
+
transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
|
|
201
|
+
end
|
|
202
|
+
elsif !attributes[map[key]].nil?
|
|
203
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
new(transformed_hash)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Returns the object in the form of hash
|
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
|
211
|
+
def to_hash
|
|
212
|
+
hash = {}
|
|
213
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
214
|
+
self.class.acceptable_attribute_map.each_pair do |attr, param|
|
|
215
|
+
value = self.send(attr)
|
|
216
|
+
if value.nil?
|
|
217
|
+
is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
|
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
hash[param] = _to_hash(value)
|
|
222
|
+
end
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|