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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +152 -0
  3. data/README.md +3 -3
  4. data/docs/BillingPortalSession.md +18 -0
  5. data/docs/CancelLicense.md +22 -0
  6. data/docs/CancellationReason.md +15 -0
  7. data/docs/CancellationStats.md +30 -0
  8. data/docs/CancellationStatsByReasonInner.md +20 -0
  9. data/docs/ConnectStripe.md +1 -1
  10. data/docs/CreateBillingPortalSession.md +18 -0
  11. data/docs/CreateIntegrationMapping.md +1 -1
  12. data/docs/CreateLicense.md +2 -0
  13. data/docs/CreatePolicy.md +3 -1
  14. data/docs/CreateProductWithPolicy.md +1 -1
  15. data/docs/CreateToken.md +1 -1
  16. data/docs/EventActorOneOf.md +1 -1
  17. data/docs/Integration.md +11 -1
  18. data/docs/IntegrationMapping.md +2 -0
  19. data/docs/IntegrationMappingRecurring.md +20 -0
  20. data/docs/IntegrationsApi.md +74 -0
  21. data/docs/License.md +12 -0
  22. data/docs/LicenseSubscription.md +34 -0
  23. data/docs/LicensesApi.md +80 -3
  24. data/docs/Machine.md +3 -1
  25. data/docs/MachinesApi.md +1 -1
  26. data/docs/Mrr.md +26 -0
  27. data/docs/MrrByIntervalInner.md +24 -0
  28. data/docs/MrrByPolicyInner.md +22 -0
  29. data/docs/Policy.md +2 -0
  30. data/docs/PolicySettings.md +3 -1
  31. data/docs/PortalApi.md +80 -1
  32. data/docs/PortalLink.md +2 -2
  33. data/docs/Product.md +2 -0
  34. data/docs/ProductStats.md +8 -4
  35. data/docs/ProductsApi.md +2 -2
  36. data/docs/Revenue.md +10 -2
  37. data/docs/StripeIntegration.md +1 -1
  38. data/docs/StripePermission.md +5 -1
  39. data/docs/StripePrice.md +2 -0
  40. data/docs/StripePriceRecurring.md +20 -0
  41. data/docs/SubscriptionStats.md +38 -0
  42. data/docs/UpdateIntegration.md +20 -0
  43. data/docs/UpdateLicense.md +3 -1
  44. data/docs/UpdatePolicy.md +3 -1
  45. data/docs/UpdateProduct.md +3 -1
  46. data/lib/license_manager/api/integrations_api.rb +74 -0
  47. data/lib/license_manager/api/licenses_api.rb +80 -6
  48. data/lib/license_manager/api/machines_api.rb +3 -3
  49. data/lib/license_manager/api/portal_api.rb +72 -2
  50. data/lib/license_manager/api/products_api.rb +4 -4
  51. data/lib/license_manager/models/billing_portal_session.rb +178 -0
  52. data/lib/license_manager/models/cancel_license.rb +238 -0
  53. data/lib/license_manager/models/cancellation_reason.rb +45 -0
  54. data/lib/license_manager/models/cancellation_stats.rb +347 -0
  55. data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
  56. data/lib/license_manager/models/connect_stripe.rb +1 -1
  57. data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
  58. data/lib/license_manager/models/create_integration_mapping.rb +1 -1
  59. data/lib/license_manager/models/create_license.rb +12 -1
  60. data/lib/license_manager/models/create_policy.rb +40 -5
  61. data/lib/license_manager/models/create_product_with_policy.rb +1 -1
  62. data/lib/license_manager/models/create_token.rb +1 -1
  63. data/lib/license_manager/models/event_type.rb +7 -1
  64. data/lib/license_manager/models/integration.rb +136 -1
  65. data/lib/license_manager/models/integration_mapping.rb +13 -1
  66. data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
  67. data/lib/license_manager/models/license.rb +91 -1
  68. data/lib/license_manager/models/license_status.rb +2 -1
  69. data/lib/license_manager/models/license_subscription.rb +388 -0
  70. data/lib/license_manager/models/machine.rb +17 -4
  71. data/lib/license_manager/models/mrr.rb +291 -0
  72. data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
  73. data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
  74. data/lib/license_manager/models/policy.rb +14 -1
  75. data/lib/license_manager/models/policy_settings.rb +40 -5
  76. data/lib/license_manager/models/portal_link.rb +1 -1
  77. data/lib/license_manager/models/product.rb +28 -1
  78. data/lib/license_manager/models/product_stats.rb +31 -5
  79. data/lib/license_manager/models/revenue.rb +112 -4
  80. data/lib/license_manager/models/stripe_integration.rb +1 -1
  81. data/lib/license_manager/models/stripe_permission.rb +58 -4
  82. data/lib/license_manager/models/stripe_price.rb +13 -1
  83. data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
  84. data/lib/license_manager/models/subscription_stats.rb +456 -0
  85. data/lib/license_manager/models/update_integration.rb +199 -0
  86. data/lib/license_manager/models/update_license.rb +16 -5
  87. data/lib/license_manager/models/update_policy.rb +40 -5
  88. data/lib/license_manager/models/update_product.rb +14 -4
  89. data/lib/license_manager/version.rb +1 -1
  90. data/lib/license_manager.rb +14 -0
  91. data/openapi.json +1146 -59
  92. data/spec/api/integrations_api_spec.rb +13 -0
  93. data/spec/api/licenses_api_spec.rb +16 -3
  94. data/spec/api/machines_api_spec.rb +1 -1
  95. data/spec/api/portal_api_spec.rb +14 -1
  96. data/spec/api/products_api_spec.rb +2 -2
  97. data/spec/models/billing_portal_session_spec.rb +36 -0
  98. data/spec/models/cancel_license_spec.rb +48 -0
  99. data/spec/models/cancellation_reason_spec.rb +30 -0
  100. data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
  101. data/spec/models/cancellation_stats_spec.rb +72 -0
  102. data/spec/models/create_billing_portal_session_spec.rb +36 -0
  103. data/spec/models/create_license_spec.rb +6 -0
  104. data/spec/models/create_policy_spec.rb +6 -0
  105. data/spec/models/create_token_spec.rb +1 -1
  106. data/spec/models/integration_mapping_recurring_spec.rb +46 -0
  107. data/spec/models/integration_mapping_spec.rb +6 -0
  108. data/spec/models/integration_spec.rb +30 -0
  109. data/spec/models/license_spec.rb +36 -0
  110. data/spec/models/license_subscription_spec.rb +88 -0
  111. data/spec/models/machine_spec.rb +7 -1
  112. data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
  113. data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
  114. data/spec/models/mrr_spec.rb +60 -0
  115. data/spec/models/policy_settings_spec.rb +6 -0
  116. data/spec/models/policy_spec.rb +6 -0
  117. data/spec/models/product_spec.rb +6 -0
  118. data/spec/models/product_stats_spec.rb +12 -0
  119. data/spec/models/revenue_spec.rb +24 -0
  120. data/spec/models/stripe_permission_spec.rb +12 -0
  121. data/spec/models/stripe_price_recurring_spec.rb +46 -0
  122. data/spec/models/stripe_price_spec.rb +6 -0
  123. data/spec/models/subscription_stats_spec.rb +96 -0
  124. data/spec/models/token_spec.rb +1 -1
  125. data/spec/models/update_integration_spec.rb +42 -0
  126. data/spec/models/update_license_spec.rb +6 -0
  127. data/spec/models/update_policy_spec.rb +6 -0
  128. data/spec/models/update_product_spec.rb +6 -0
  129. metadata +57 -1
@@ -0,0 +1,456 @@
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
+ # Subscriptions to recurring Stripe prices, each with its subscription license.
18
+ class SubscriptionStats < ApiModelBase
19
+ # Number of ongoing subscriptions: `active`, `trialing` or `past_due`.
20
+ attr_accessor :active_count
21
+
22
+ attr_accessor :trialing_count
23
+
24
+ # Number of them whose renewal failed, as Stripe retries it: their licenses stay valid for the integration's grace days.
25
+ attr_accessor :past_due_count
26
+
27
+ # Number of them set to end at the end of their period.
28
+ attr_accessor :canceling_count
29
+
30
+ # Number of subscriptions started in the last 30 days.
31
+ attr_accessor :new_count
32
+
33
+ # Number of subscriptions that ended in the last 30 days.
34
+ attr_accessor :ended_count
35
+
36
+ # Share of the subscriptions ongoing 30 days ago that ended since, from 0 to 1.
37
+ attr_accessor :churn_rate
38
+
39
+ # Number of subscriptions started each month, aligned on `months`.
40
+ attr_accessor :new_by_month
41
+
42
+ # Number of subscriptions that ended each month, aligned on `months`.
43
+ attr_accessor :ended_by_month
44
+
45
+ # Number of ongoing subscriptions at the end of each month, aligned on `months`, today for this month.
46
+ attr_accessor :active_by_month
47
+
48
+ # MRR in each currency, from the highest number of subscriptions. Amounts aren't converted between currencies.
49
+ attr_accessor :mrr
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'active_count' => :'activeCount',
55
+ :'trialing_count' => :'trialingCount',
56
+ :'past_due_count' => :'pastDueCount',
57
+ :'canceling_count' => :'cancelingCount',
58
+ :'new_count' => :'newCount',
59
+ :'ended_count' => :'endedCount',
60
+ :'churn_rate' => :'churnRate',
61
+ :'new_by_month' => :'newByMonth',
62
+ :'ended_by_month' => :'endedByMonth',
63
+ :'active_by_month' => :'activeByMonth',
64
+ :'mrr' => :'mrr'
65
+ }
66
+ end
67
+
68
+ # Returns attribute mapping this model knows about
69
+ def self.acceptable_attribute_map
70
+ attribute_map
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ acceptable_attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'active_count' => :'Integer',
82
+ :'trialing_count' => :'Integer',
83
+ :'past_due_count' => :'Integer',
84
+ :'canceling_count' => :'Integer',
85
+ :'new_count' => :'Integer',
86
+ :'ended_count' => :'Integer',
87
+ :'churn_rate' => :'Float',
88
+ :'new_by_month' => :'Array<Integer>',
89
+ :'ended_by_month' => :'Array<Integer>',
90
+ :'active_by_month' => :'Array<Integer>',
91
+ :'mrr' => :'Array<Mrr>'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Returns attribute type mapping
102
+ def self.acceptable_openapi_types
103
+ openapi_types
104
+ end
105
+
106
+ # Returns the nullable attributes
107
+ def self.acceptable_openapi_nullable
108
+ openapi_nullable
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::SubscriptionStats` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::SubscriptionStats`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'active_count')
128
+ self.active_count = attributes[:'active_count']
129
+ else
130
+ self.active_count = nil
131
+ end
132
+
133
+ if attributes.key?(:'trialing_count')
134
+ self.trialing_count = attributes[:'trialing_count']
135
+ else
136
+ self.trialing_count = nil
137
+ end
138
+
139
+ if attributes.key?(:'past_due_count')
140
+ self.past_due_count = attributes[:'past_due_count']
141
+ else
142
+ self.past_due_count = nil
143
+ end
144
+
145
+ if attributes.key?(:'canceling_count')
146
+ self.canceling_count = attributes[:'canceling_count']
147
+ else
148
+ self.canceling_count = nil
149
+ end
150
+
151
+ if attributes.key?(:'new_count')
152
+ self.new_count = attributes[:'new_count']
153
+ else
154
+ self.new_count = nil
155
+ end
156
+
157
+ if attributes.key?(:'ended_count')
158
+ self.ended_count = attributes[:'ended_count']
159
+ else
160
+ self.ended_count = nil
161
+ end
162
+
163
+ if attributes.key?(:'churn_rate')
164
+ self.churn_rate = attributes[:'churn_rate']
165
+ else
166
+ self.churn_rate = nil
167
+ end
168
+
169
+ if attributes.key?(:'new_by_month')
170
+ if (value = attributes[:'new_by_month']).is_a?(Array)
171
+ self.new_by_month = value
172
+ end
173
+ else
174
+ self.new_by_month = nil
175
+ end
176
+
177
+ if attributes.key?(:'ended_by_month')
178
+ if (value = attributes[:'ended_by_month']).is_a?(Array)
179
+ self.ended_by_month = value
180
+ end
181
+ else
182
+ self.ended_by_month = nil
183
+ end
184
+
185
+ if attributes.key?(:'active_by_month')
186
+ if (value = attributes[:'active_by_month']).is_a?(Array)
187
+ self.active_by_month = value
188
+ end
189
+ else
190
+ self.active_by_month = nil
191
+ end
192
+
193
+ if attributes.key?(:'mrr')
194
+ if (value = attributes[:'mrr']).is_a?(Array)
195
+ self.mrr = value
196
+ end
197
+ else
198
+ self.mrr = nil
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
206
+ invalid_properties = Array.new
207
+ if @active_count.nil?
208
+ invalid_properties.push('invalid value for "active_count", active_count cannot be nil.')
209
+ end
210
+
211
+ if @trialing_count.nil?
212
+ invalid_properties.push('invalid value for "trialing_count", trialing_count cannot be nil.')
213
+ end
214
+
215
+ if @past_due_count.nil?
216
+ invalid_properties.push('invalid value for "past_due_count", past_due_count cannot be nil.')
217
+ end
218
+
219
+ if @canceling_count.nil?
220
+ invalid_properties.push('invalid value for "canceling_count", canceling_count cannot be nil.')
221
+ end
222
+
223
+ if @new_count.nil?
224
+ invalid_properties.push('invalid value for "new_count", new_count cannot be nil.')
225
+ end
226
+
227
+ if @ended_count.nil?
228
+ invalid_properties.push('invalid value for "ended_count", ended_count cannot be nil.')
229
+ end
230
+
231
+ if @churn_rate.nil?
232
+ invalid_properties.push('invalid value for "churn_rate", churn_rate cannot be nil.')
233
+ end
234
+
235
+ if @new_by_month.nil?
236
+ invalid_properties.push('invalid value for "new_by_month", new_by_month cannot be nil.')
237
+ end
238
+
239
+ if @ended_by_month.nil?
240
+ invalid_properties.push('invalid value for "ended_by_month", ended_by_month cannot be nil.')
241
+ end
242
+
243
+ if @active_by_month.nil?
244
+ invalid_properties.push('invalid value for "active_by_month", active_by_month cannot be nil.')
245
+ end
246
+
247
+ if @mrr.nil?
248
+ invalid_properties.push('invalid value for "mrr", mrr cannot be nil.')
249
+ end
250
+
251
+ invalid_properties
252
+ end
253
+
254
+ # Check to see if the all the properties in the model are valid
255
+ # @return true if the model is valid
256
+ def valid?
257
+ warn '[DEPRECATED] the `valid?` method is obsolete'
258
+ return false if @active_count.nil?
259
+ return false if @trialing_count.nil?
260
+ return false if @past_due_count.nil?
261
+ return false if @canceling_count.nil?
262
+ return false if @new_count.nil?
263
+ return false if @ended_count.nil?
264
+ return false if @churn_rate.nil?
265
+ return false if @new_by_month.nil?
266
+ return false if @ended_by_month.nil?
267
+ return false if @active_by_month.nil?
268
+ return false if @mrr.nil?
269
+ true
270
+ end
271
+
272
+ # Custom attribute writer method with validation
273
+ # @param [Object] active_count Value to be assigned
274
+ def active_count=(active_count)
275
+ if active_count.nil?
276
+ fail ArgumentError, 'active_count cannot be nil'
277
+ end
278
+
279
+ @active_count = active_count
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] trialing_count Value to be assigned
284
+ def trialing_count=(trialing_count)
285
+ if trialing_count.nil?
286
+ fail ArgumentError, 'trialing_count cannot be nil'
287
+ end
288
+
289
+ @trialing_count = trialing_count
290
+ end
291
+
292
+ # Custom attribute writer method with validation
293
+ # @param [Object] past_due_count Value to be assigned
294
+ def past_due_count=(past_due_count)
295
+ if past_due_count.nil?
296
+ fail ArgumentError, 'past_due_count cannot be nil'
297
+ end
298
+
299
+ @past_due_count = past_due_count
300
+ end
301
+
302
+ # Custom attribute writer method with validation
303
+ # @param [Object] canceling_count Value to be assigned
304
+ def canceling_count=(canceling_count)
305
+ if canceling_count.nil?
306
+ fail ArgumentError, 'canceling_count cannot be nil'
307
+ end
308
+
309
+ @canceling_count = canceling_count
310
+ end
311
+
312
+ # Custom attribute writer method with validation
313
+ # @param [Object] new_count Value to be assigned
314
+ def new_count=(new_count)
315
+ if new_count.nil?
316
+ fail ArgumentError, 'new_count cannot be nil'
317
+ end
318
+
319
+ @new_count = new_count
320
+ end
321
+
322
+ # Custom attribute writer method with validation
323
+ # @param [Object] ended_count Value to be assigned
324
+ def ended_count=(ended_count)
325
+ if ended_count.nil?
326
+ fail ArgumentError, 'ended_count cannot be nil'
327
+ end
328
+
329
+ @ended_count = ended_count
330
+ end
331
+
332
+ # Custom attribute writer method with validation
333
+ # @param [Object] churn_rate Value to be assigned
334
+ def churn_rate=(churn_rate)
335
+ if churn_rate.nil?
336
+ fail ArgumentError, 'churn_rate cannot be nil'
337
+ end
338
+
339
+ @churn_rate = churn_rate
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] new_by_month Value to be assigned
344
+ def new_by_month=(new_by_month)
345
+ if new_by_month.nil?
346
+ fail ArgumentError, 'new_by_month cannot be nil'
347
+ end
348
+
349
+ @new_by_month = new_by_month
350
+ end
351
+
352
+ # Custom attribute writer method with validation
353
+ # @param [Object] ended_by_month Value to be assigned
354
+ def ended_by_month=(ended_by_month)
355
+ if ended_by_month.nil?
356
+ fail ArgumentError, 'ended_by_month cannot be nil'
357
+ end
358
+
359
+ @ended_by_month = ended_by_month
360
+ end
361
+
362
+ # Custom attribute writer method with validation
363
+ # @param [Object] active_by_month Value to be assigned
364
+ def active_by_month=(active_by_month)
365
+ if active_by_month.nil?
366
+ fail ArgumentError, 'active_by_month cannot be nil'
367
+ end
368
+
369
+ @active_by_month = active_by_month
370
+ end
371
+
372
+ # Custom attribute writer method with validation
373
+ # @param [Object] mrr Value to be assigned
374
+ def mrr=(mrr)
375
+ if mrr.nil?
376
+ fail ArgumentError, 'mrr cannot be nil'
377
+ end
378
+
379
+ @mrr = mrr
380
+ end
381
+
382
+ # Checks equality by comparing each attribute.
383
+ # @param [Object] Object to be compared
384
+ def ==(o)
385
+ return true if self.equal?(o)
386
+ self.class == o.class &&
387
+ active_count == o.active_count &&
388
+ trialing_count == o.trialing_count &&
389
+ past_due_count == o.past_due_count &&
390
+ canceling_count == o.canceling_count &&
391
+ new_count == o.new_count &&
392
+ ended_count == o.ended_count &&
393
+ churn_rate == o.churn_rate &&
394
+ new_by_month == o.new_by_month &&
395
+ ended_by_month == o.ended_by_month &&
396
+ active_by_month == o.active_by_month &&
397
+ mrr == o.mrr
398
+ end
399
+
400
+ # @see the `==` method
401
+ # @param [Object] Object to be compared
402
+ def eql?(o)
403
+ self == o
404
+ end
405
+
406
+ # Calculates hash code according to all attributes.
407
+ # @return [Integer] Hash code
408
+ def hash
409
+ [active_count, trialing_count, past_due_count, canceling_count, new_count, ended_count, churn_rate, new_by_month, ended_by_month, active_by_month, mrr].hash
410
+ end
411
+
412
+ # Builds the object from hash
413
+ # @param [Hash] attributes Model attributes in the form of hash
414
+ # @return [Object] Returns the model itself
415
+ def self.build_from_hash(attributes)
416
+ return nil unless attributes.is_a?(Hash)
417
+ attributes = attributes.transform_keys(&:to_sym)
418
+ # include attributes inherited from allOf parents (the nearest declaration wins)
419
+ map = acceptable_attribute_map
420
+ transformed_hash = {}
421
+ acceptable_openapi_types.each_pair do |key, type|
422
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
423
+ transformed_hash["#{key}"] = nil
424
+ elsif type =~ /\AArray<(.*)>/i
425
+ # check to ensure the input is an array given that the attribute
426
+ # is documented as an array but the input is not
427
+ if attributes[map[key]].is_a?(Array)
428
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
429
+ end
430
+ elsif !attributes[map[key]].nil?
431
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
432
+ end
433
+ end
434
+ new(transformed_hash)
435
+ end
436
+
437
+ # Returns the object in the form of hash
438
+ # @return [Hash] Returns the object in the form of hash
439
+ def to_hash
440
+ hash = {}
441
+ # include attributes inherited from allOf parents (the nearest declaration wins)
442
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
443
+ value = self.send(attr)
444
+ if value.nil?
445
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
446
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
447
+ end
448
+
449
+ hash[param] = _to_hash(value)
450
+ end
451
+ hash
452
+ end
453
+
454
+ end
455
+
456
+ end
@@ -0,0 +1,199 @@
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
+ class UpdateIntegration < ApiModelBase
18
+ # Whether canceling a license bought through Stripe refunds its payment. Can only be turned on when the integration's `canRefund` is true: the API key has the Refunds: Write permission.
19
+ attr_accessor :auto_refund
20
+
21
+ # Days a subscription license stays valid after its period ends while its renewal is unpaid, as Stripe retries the payment.
22
+ attr_accessor :subscription_grace_days
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'auto_refund' => :'autoRefund',
28
+ :'subscription_grace_days' => :'subscriptionGraceDays'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'auto_refund' => :'Boolean',
46
+ :'subscription_grace_days' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Returns attribute type mapping
57
+ def self.acceptable_openapi_types
58
+ openapi_types
59
+ end
60
+
61
+ # Returns the nullable attributes
62
+ def self.acceptable_openapi_nullable
63
+ openapi_nullable
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::UpdateIntegration` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::UpdateIntegration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'auto_refund')
83
+ self.auto_refund = attributes[:'auto_refund']
84
+ end
85
+
86
+ if attributes.key?(:'subscription_grace_days')
87
+ self.subscription_grace_days = attributes[:'subscription_grace_days']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if !@subscription_grace_days.nil? && @subscription_grace_days > 60
97
+ invalid_properties.push('invalid value for "subscription_grace_days", must be smaller than or equal to 60.')
98
+ end
99
+
100
+ if !@subscription_grace_days.nil? && @subscription_grace_days < 0
101
+ invalid_properties.push('invalid value for "subscription_grace_days", must be greater than or equal to 0.')
102
+ end
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
+ return false if !@subscription_grace_days.nil? && @subscription_grace_days > 60
112
+ return false if !@subscription_grace_days.nil? && @subscription_grace_days < 0
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] subscription_grace_days Value to be assigned
118
+ def subscription_grace_days=(subscription_grace_days)
119
+ if subscription_grace_days.nil?
120
+ fail ArgumentError, 'subscription_grace_days cannot be nil'
121
+ end
122
+
123
+ if subscription_grace_days > 60
124
+ fail ArgumentError, 'invalid value for "subscription_grace_days", must be smaller than or equal to 60.'
125
+ end
126
+
127
+ if subscription_grace_days < 0
128
+ fail ArgumentError, 'invalid value for "subscription_grace_days", must be greater than or equal to 0.'
129
+ end
130
+
131
+ @subscription_grace_days = subscription_grace_days
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ auto_refund == o.auto_refund &&
140
+ subscription_grace_days == o.subscription_grace_days
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [auto_refund, subscription_grace_days].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
161
+ # include attributes inherited from allOf parents (the nearest declaration wins)
162
+ map = acceptable_attribute_map
163
+ transformed_hash = {}
164
+ acceptable_openapi_types.each_pair do |key, type|
165
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ # include attributes inherited from allOf parents (the nearest declaration wins)
185
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ end
198
+
199
+ end