license_manager 0.1.1 → 0.2.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +95 -0
  3. data/README.md +2 -2
  4. data/docs/CancelLicense.md +22 -0
  5. data/docs/CancellationReason.md +15 -0
  6. data/docs/CancellationStats.md +30 -0
  7. data/docs/CancellationStatsByReasonInner.md +20 -0
  8. data/docs/ConnectStripe.md +1 -1
  9. data/docs/CreateLicense.md +2 -0
  10. data/docs/CreatePolicy.md +3 -1
  11. data/docs/CreateProductWithPolicy.md +1 -1
  12. data/docs/CreateToken.md +1 -1
  13. data/docs/EventActorOneOf.md +1 -1
  14. data/docs/Integration.md +5 -1
  15. data/docs/IntegrationsApi.md +74 -0
  16. data/docs/License.md +10 -0
  17. data/docs/LicensesApi.md +80 -3
  18. data/docs/Machine.md +3 -1
  19. data/docs/MachinesApi.md +1 -1
  20. data/docs/Policy.md +2 -0
  21. data/docs/PolicySettings.md +3 -1
  22. data/docs/PortalApi.md +1 -1
  23. data/docs/PortalLink.md +2 -2
  24. data/docs/Product.md +2 -0
  25. data/docs/ProductStats.md +6 -4
  26. data/docs/ProductsApi.md +2 -2
  27. data/docs/Revenue.md +6 -2
  28. data/docs/StripeIntegration.md +1 -1
  29. data/docs/StripePermission.md +3 -1
  30. data/docs/UpdateIntegration.md +18 -0
  31. data/docs/UpdateLicense.md +3 -1
  32. data/docs/UpdatePolicy.md +3 -1
  33. data/docs/UpdateProduct.md +3 -1
  34. data/lib/license_manager/api/integrations_api.rb +74 -0
  35. data/lib/license_manager/api/licenses_api.rb +80 -6
  36. data/lib/license_manager/api/machines_api.rb +3 -3
  37. data/lib/license_manager/api/portal_api.rb +2 -2
  38. data/lib/license_manager/api/products_api.rb +4 -4
  39. data/lib/license_manager/models/cancel_license.rb +238 -0
  40. data/lib/license_manager/models/cancellation_reason.rb +45 -0
  41. data/lib/license_manager/models/cancellation_stats.rb +347 -0
  42. data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
  43. data/lib/license_manager/models/connect_stripe.rb +1 -1
  44. data/lib/license_manager/models/create_license.rb +12 -1
  45. data/lib/license_manager/models/create_policy.rb +40 -5
  46. data/lib/license_manager/models/create_product_with_policy.rb +1 -1
  47. data/lib/license_manager/models/create_token.rb +1 -1
  48. data/lib/license_manager/models/event_type.rb +4 -1
  49. data/lib/license_manager/models/integration.rb +55 -1
  50. data/lib/license_manager/models/license.rb +79 -1
  51. data/lib/license_manager/models/license_status.rb +2 -1
  52. data/lib/license_manager/models/machine.rb +17 -4
  53. data/lib/license_manager/models/policy.rb +14 -1
  54. data/lib/license_manager/models/policy_settings.rb +40 -5
  55. data/lib/license_manager/models/portal_link.rb +1 -1
  56. data/lib/license_manager/models/product.rb +28 -1
  57. data/lib/license_manager/models/product_stats.rb +18 -5
  58. data/lib/license_manager/models/revenue.rb +58 -4
  59. data/lib/license_manager/models/stripe_integration.rb +1 -1
  60. data/lib/license_manager/models/stripe_permission.rb +31 -4
  61. data/lib/license_manager/models/update_integration.rb +161 -0
  62. data/lib/license_manager/models/update_license.rb +16 -5
  63. data/lib/license_manager/models/update_policy.rb +40 -5
  64. data/lib/license_manager/models/update_product.rb +14 -4
  65. data/lib/license_manager/version.rb +1 -1
  66. data/lib/license_manager.rb +5 -0
  67. data/openapi.json +566 -32
  68. data/spec/api/integrations_api_spec.rb +13 -0
  69. data/spec/api/licenses_api_spec.rb +16 -3
  70. data/spec/api/machines_api_spec.rb +1 -1
  71. data/spec/api/portal_api_spec.rb +1 -1
  72. data/spec/api/products_api_spec.rb +2 -2
  73. data/spec/models/cancel_license_spec.rb +48 -0
  74. data/spec/models/cancellation_reason_spec.rb +30 -0
  75. data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
  76. data/spec/models/cancellation_stats_spec.rb +72 -0
  77. data/spec/models/create_license_spec.rb +6 -0
  78. data/spec/models/create_policy_spec.rb +6 -0
  79. data/spec/models/create_token_spec.rb +1 -1
  80. data/spec/models/integration_spec.rb +12 -0
  81. data/spec/models/license_spec.rb +30 -0
  82. data/spec/models/machine_spec.rb +7 -1
  83. data/spec/models/policy_settings_spec.rb +6 -0
  84. data/spec/models/policy_spec.rb +6 -0
  85. data/spec/models/product_spec.rb +6 -0
  86. data/spec/models/product_stats_spec.rb +6 -0
  87. data/spec/models/revenue_spec.rb +12 -0
  88. data/spec/models/stripe_permission_spec.rb +6 -0
  89. data/spec/models/token_spec.rb +1 -1
  90. data/spec/models/update_integration_spec.rb +36 -0
  91. data/spec/models/update_license_spec.rb +6 -0
  92. data/spec/models/update_policy_spec.rb +6 -0
  93. data/spec/models/update_product_spec.rb +6 -0
  94. metadata +21 -1
@@ -0,0 +1,238 @@
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 CancelLicense < ApiModelBase
18
+ attr_accessor :reason
19
+
20
+ # What the customer said about the cancellation.
21
+ attr_accessor :comment
22
+
23
+ # Whether to refund the license's Stripe payment, when it was bought through the Stripe integration. Defaults to the integration's `autoRefund`. Ignored for tokens, which always follow `autoRefund`, and when the integration's `canRefund` is false: its API key can't create refunds.
24
+ attr_accessor :refund
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'reason' => :'reason',
52
+ :'comment' => :'comment',
53
+ :'refund' => :'refund'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'reason' => :'CancellationReason',
71
+ :'comment' => :'String',
72
+ :'refund' => :'Boolean'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Returns attribute type mapping
83
+ def self.acceptable_openapi_types
84
+ openapi_types
85
+ end
86
+
87
+ # Returns the nullable attributes
88
+ def self.acceptable_openapi_nullable
89
+ openapi_nullable
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CancelLicense` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ acceptable_attribute_map = self.class.acceptable_attribute_map
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!acceptable_attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CancelLicense`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'reason')
109
+ self.reason = attributes[:'reason']
110
+ else
111
+ self.reason = nil
112
+ end
113
+
114
+ if attributes.key?(:'comment')
115
+ self.comment = attributes[:'comment']
116
+ end
117
+
118
+ if attributes.key?(:'refund')
119
+ self.refund = attributes[:'refund']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ if @reason.nil?
129
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
130
+ end
131
+
132
+ if !@comment.nil? && @comment.to_s.length > 2000
133
+ invalid_properties.push('invalid value for "comment", the character length must be smaller than or equal to 2000.')
134
+ end
135
+
136
+ invalid_properties
137
+ end
138
+
139
+ # Check to see if the all the properties in the model are valid
140
+ # @return true if the model is valid
141
+ def valid?
142
+ warn '[DEPRECATED] the `valid?` method is obsolete'
143
+ return false if @reason.nil?
144
+ return false if !@comment.nil? && @comment.to_s.length > 2000
145
+ true
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] reason Value to be assigned
150
+ def reason=(reason)
151
+ if reason.nil?
152
+ fail ArgumentError, 'reason cannot be nil'
153
+ end
154
+
155
+ @reason = reason
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] comment Value to be assigned
160
+ def comment=(comment)
161
+ if comment.nil?
162
+ fail ArgumentError, 'comment cannot be nil'
163
+ end
164
+
165
+ if comment.to_s.length > 2000
166
+ fail ArgumentError, 'invalid value for "comment", the character length must be smaller than or equal to 2000.'
167
+ end
168
+
169
+ @comment = comment
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ reason == o.reason &&
178
+ comment == o.comment &&
179
+ refund == o.refund
180
+ end
181
+
182
+ # @see the `==` method
183
+ # @param [Object] Object to be compared
184
+ def eql?(o)
185
+ self == o
186
+ end
187
+
188
+ # Calculates hash code according to all attributes.
189
+ # @return [Integer] Hash code
190
+ def hash
191
+ [reason, comment, refund].hash
192
+ end
193
+
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def self.build_from_hash(attributes)
198
+ return nil unless attributes.is_a?(Hash)
199
+ attributes = attributes.transform_keys(&:to_sym)
200
+ # include attributes inherited from allOf parents (the nearest declaration wins)
201
+ map = acceptable_attribute_map
202
+ transformed_hash = {}
203
+ acceptable_openapi_types.each_pair do |key, type|
204
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
205
+ transformed_hash["#{key}"] = nil
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[map[key]].is_a?(Array)
210
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
211
+ end
212
+ elsif !attributes[map[key]].nil?
213
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
214
+ end
215
+ end
216
+ new(transformed_hash)
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ # include attributes inherited from allOf parents (the nearest declaration wins)
224
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,45 @@
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 CancellationReason
18
+ TOO_EXPENSIVE = "too_expensive".freeze
19
+ MISSING_FEATURES = "missing_features".freeze
20
+ NOT_WORKING = "not_working".freeze
21
+ SWITCHED = "switched".freeze
22
+ UNUSED = "unused".freeze
23
+ OTHER = "other".freeze
24
+ UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
25
+
26
+ def self.all_vars
27
+ @all_vars ||= [TOO_EXPENSIVE, MISSING_FEATURES, NOT_WORKING, SWITCHED, UNUSED, OTHER, UNKNOWN_DEFAULT_OPEN_API].freeze
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def self.build_from_hash(value)
34
+ new.build_from_hash(value)
35
+ end
36
+
37
+ # Builds the enum from string
38
+ # @param [String] The enum value in the form of the string
39
+ # @return [String] The enum value
40
+ def build_from_hash(value)
41
+ return value if CancellationReason.all_vars.include?(value)
42
+ UNKNOWN_DEFAULT_OPEN_API
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,347 @@
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
+ # Cancellations of the licenses with a money back guarantee. Licenses canceled without one are left out.
18
+ class CancellationStats < ApiModelBase
19
+ # Number of licenses with a money back guarantee: a `cancellableUntil`.
20
+ attr_accessor :license_count
21
+
22
+ # Number of them that were canceled.
23
+ attr_accessor :canceled_license_count
24
+
25
+ # Number of them whose money back guarantee hasn't ended, and that weren't canceled: they can still be.
26
+ attr_accessor :cancellable_license_count
27
+
28
+ # Share of them that were canceled, from 0 to 1: `canceledLicenseCount` over `licenseCount`.
29
+ attr_accessor :rate
30
+
31
+ # Number of them canceled each day, aligned on `days`, on the day of their cancellation.
32
+ attr_accessor :canceled_by_day
33
+
34
+ # Number of them canceled each month, aligned on `months`, on the month of their cancellation.
35
+ attr_accessor :canceled_by_month
36
+
37
+ # Number of them canceled for each reason, from the most given one. Reasons never given are left out.
38
+ attr_accessor :by_reason
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'license_count' => :'licenseCount',
44
+ :'canceled_license_count' => :'canceledLicenseCount',
45
+ :'cancellable_license_count' => :'cancellableLicenseCount',
46
+ :'rate' => :'rate',
47
+ :'canceled_by_day' => :'canceledByDay',
48
+ :'canceled_by_month' => :'canceledByMonth',
49
+ :'by_reason' => :'byReason'
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
+ :'license_count' => :'Integer',
67
+ :'canceled_license_count' => :'Integer',
68
+ :'cancellable_license_count' => :'Integer',
69
+ :'rate' => :'Float',
70
+ :'canceled_by_day' => :'Array<Integer>',
71
+ :'canceled_by_month' => :'Array<Integer>',
72
+ :'by_reason' => :'Array<CancellationStatsByReasonInner>'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Returns attribute type mapping
83
+ def self.acceptable_openapi_types
84
+ openapi_types
85
+ end
86
+
87
+ # Returns the nullable attributes
88
+ def self.acceptable_openapi_nullable
89
+ openapi_nullable
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CancellationStats` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ acceptable_attribute_map = self.class.acceptable_attribute_map
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!acceptable_attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CancellationStats`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'license_count')
109
+ self.license_count = attributes[:'license_count']
110
+ else
111
+ self.license_count = nil
112
+ end
113
+
114
+ if attributes.key?(:'canceled_license_count')
115
+ self.canceled_license_count = attributes[:'canceled_license_count']
116
+ else
117
+ self.canceled_license_count = nil
118
+ end
119
+
120
+ if attributes.key?(:'cancellable_license_count')
121
+ self.cancellable_license_count = attributes[:'cancellable_license_count']
122
+ else
123
+ self.cancellable_license_count = nil
124
+ end
125
+
126
+ if attributes.key?(:'rate')
127
+ self.rate = attributes[:'rate']
128
+ else
129
+ self.rate = nil
130
+ end
131
+
132
+ if attributes.key?(:'canceled_by_day')
133
+ if (value = attributes[:'canceled_by_day']).is_a?(Array)
134
+ self.canceled_by_day = value
135
+ end
136
+ else
137
+ self.canceled_by_day = nil
138
+ end
139
+
140
+ if attributes.key?(:'canceled_by_month')
141
+ if (value = attributes[:'canceled_by_month']).is_a?(Array)
142
+ self.canceled_by_month = value
143
+ end
144
+ else
145
+ self.canceled_by_month = nil
146
+ end
147
+
148
+ if attributes.key?(:'by_reason')
149
+ if (value = attributes[:'by_reason']).is_a?(Array)
150
+ self.by_reason = value
151
+ end
152
+ else
153
+ self.by_reason = nil
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
161
+ invalid_properties = Array.new
162
+ if @license_count.nil?
163
+ invalid_properties.push('invalid value for "license_count", license_count cannot be nil.')
164
+ end
165
+
166
+ if @canceled_license_count.nil?
167
+ invalid_properties.push('invalid value for "canceled_license_count", canceled_license_count cannot be nil.')
168
+ end
169
+
170
+ if @cancellable_license_count.nil?
171
+ invalid_properties.push('invalid value for "cancellable_license_count", cancellable_license_count cannot be nil.')
172
+ end
173
+
174
+ if @rate.nil?
175
+ invalid_properties.push('invalid value for "rate", rate cannot be nil.')
176
+ end
177
+
178
+ if @canceled_by_day.nil?
179
+ invalid_properties.push('invalid value for "canceled_by_day", canceled_by_day cannot be nil.')
180
+ end
181
+
182
+ if @canceled_by_month.nil?
183
+ invalid_properties.push('invalid value for "canceled_by_month", canceled_by_month cannot be nil.')
184
+ end
185
+
186
+ if @by_reason.nil?
187
+ invalid_properties.push('invalid value for "by_reason", by_reason cannot be nil.')
188
+ end
189
+
190
+ invalid_properties
191
+ end
192
+
193
+ # Check to see if the all the properties in the model are valid
194
+ # @return true if the model is valid
195
+ def valid?
196
+ warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ return false if @license_count.nil?
198
+ return false if @canceled_license_count.nil?
199
+ return false if @cancellable_license_count.nil?
200
+ return false if @rate.nil?
201
+ return false if @canceled_by_day.nil?
202
+ return false if @canceled_by_month.nil?
203
+ return false if @by_reason.nil?
204
+ true
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] license_count Value to be assigned
209
+ def license_count=(license_count)
210
+ if license_count.nil?
211
+ fail ArgumentError, 'license_count cannot be nil'
212
+ end
213
+
214
+ @license_count = license_count
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] canceled_license_count Value to be assigned
219
+ def canceled_license_count=(canceled_license_count)
220
+ if canceled_license_count.nil?
221
+ fail ArgumentError, 'canceled_license_count cannot be nil'
222
+ end
223
+
224
+ @canceled_license_count = canceled_license_count
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] cancellable_license_count Value to be assigned
229
+ def cancellable_license_count=(cancellable_license_count)
230
+ if cancellable_license_count.nil?
231
+ fail ArgumentError, 'cancellable_license_count cannot be nil'
232
+ end
233
+
234
+ @cancellable_license_count = cancellable_license_count
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] rate Value to be assigned
239
+ def rate=(rate)
240
+ if rate.nil?
241
+ fail ArgumentError, 'rate cannot be nil'
242
+ end
243
+
244
+ @rate = rate
245
+ end
246
+
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] canceled_by_day Value to be assigned
249
+ def canceled_by_day=(canceled_by_day)
250
+ if canceled_by_day.nil?
251
+ fail ArgumentError, 'canceled_by_day cannot be nil'
252
+ end
253
+
254
+ @canceled_by_day = canceled_by_day
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] canceled_by_month Value to be assigned
259
+ def canceled_by_month=(canceled_by_month)
260
+ if canceled_by_month.nil?
261
+ fail ArgumentError, 'canceled_by_month cannot be nil'
262
+ end
263
+
264
+ @canceled_by_month = canceled_by_month
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] by_reason Value to be assigned
269
+ def by_reason=(by_reason)
270
+ if by_reason.nil?
271
+ fail ArgumentError, 'by_reason cannot be nil'
272
+ end
273
+
274
+ @by_reason = by_reason
275
+ end
276
+
277
+ # Checks equality by comparing each attribute.
278
+ # @param [Object] Object to be compared
279
+ def ==(o)
280
+ return true if self.equal?(o)
281
+ self.class == o.class &&
282
+ license_count == o.license_count &&
283
+ canceled_license_count == o.canceled_license_count &&
284
+ cancellable_license_count == o.cancellable_license_count &&
285
+ rate == o.rate &&
286
+ canceled_by_day == o.canceled_by_day &&
287
+ canceled_by_month == o.canceled_by_month &&
288
+ by_reason == o.by_reason
289
+ end
290
+
291
+ # @see the `==` method
292
+ # @param [Object] Object to be compared
293
+ def eql?(o)
294
+ self == o
295
+ end
296
+
297
+ # Calculates hash code according to all attributes.
298
+ # @return [Integer] Hash code
299
+ def hash
300
+ [license_count, canceled_license_count, cancellable_license_count, rate, canceled_by_day, canceled_by_month, by_reason].hash
301
+ end
302
+
303
+ # Builds the object from hash
304
+ # @param [Hash] attributes Model attributes in the form of hash
305
+ # @return [Object] Returns the model itself
306
+ def self.build_from_hash(attributes)
307
+ return nil unless attributes.is_a?(Hash)
308
+ attributes = attributes.transform_keys(&:to_sym)
309
+ # include attributes inherited from allOf parents (the nearest declaration wins)
310
+ map = acceptable_attribute_map
311
+ transformed_hash = {}
312
+ acceptable_openapi_types.each_pair do |key, type|
313
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
314
+ transformed_hash["#{key}"] = nil
315
+ elsif type =~ /\AArray<(.*)>/i
316
+ # check to ensure the input is an array given that the attribute
317
+ # is documented as an array but the input is not
318
+ if attributes[map[key]].is_a?(Array)
319
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
320
+ end
321
+ elsif !attributes[map[key]].nil?
322
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
323
+ end
324
+ end
325
+ new(transformed_hash)
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ # include attributes inherited from allOf parents (the nearest declaration wins)
333
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
334
+ value = self.send(attr)
335
+ if value.nil?
336
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
337
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
338
+ end
339
+
340
+ hash[param] = _to_hash(value)
341
+ end
342
+ hash
343
+ end
344
+
345
+ end
346
+
347
+ end