license_manager 0.3.1 → 0.3.2

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.
@@ -0,0 +1,387 @@
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 SlackConnection < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :team_id
21
+
22
+ attr_accessor :team_name
23
+
24
+ attr_accessor :channel_id
25
+
26
+ # Name of the channel when it was connected, with its `#`.
27
+ attr_accessor :channel_name
28
+
29
+ # Page of the installation in Slack.
30
+ attr_accessor :configuration_url
31
+
32
+ # Notifications the channel gets: `purchased` (a license bought through Stripe), `renewed` (a subscription renewal paid), `payment_failed` (a subscription payment failed) and `canceled` (a license canceled, or its subscription ended).
33
+ attr_accessor :events
34
+
35
+ # `revoked` once Slack refuses the messages, like when the app was removed from the workspace or the channel deleted: remove it and add it again.
36
+ attr_accessor :status
37
+
38
+ attr_accessor :status_reason
39
+
40
+ attr_accessor :last_sent_at
41
+
42
+ attr_accessor :created_at
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'id' => :'id',
70
+ :'team_id' => :'teamId',
71
+ :'team_name' => :'teamName',
72
+ :'channel_id' => :'channelId',
73
+ :'channel_name' => :'channelName',
74
+ :'configuration_url' => :'configurationUrl',
75
+ :'events' => :'events',
76
+ :'status' => :'status',
77
+ :'status_reason' => :'statusReason',
78
+ :'last_sent_at' => :'lastSentAt',
79
+ :'created_at' => :'createdAt'
80
+ }
81
+ end
82
+
83
+ # Returns attribute mapping this model knows about
84
+ def self.acceptable_attribute_map
85
+ attribute_map
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ acceptable_attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+ :'id' => :'String',
97
+ :'team_id' => :'String',
98
+ :'team_name' => :'String',
99
+ :'channel_id' => :'String',
100
+ :'channel_name' => :'String',
101
+ :'configuration_url' => :'String',
102
+ :'events' => :'Array<String>',
103
+ :'status' => :'String',
104
+ :'status_reason' => :'String',
105
+ :'last_sent_at' => :'Time',
106
+ :'created_at' => :'Time'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ :'team_name',
114
+ :'channel_name',
115
+ :'configuration_url',
116
+ :'status_reason',
117
+ :'last_sent_at',
118
+ ])
119
+ end
120
+
121
+ # Returns attribute type mapping
122
+ def self.acceptable_openapi_types
123
+ openapi_types
124
+ end
125
+
126
+ # Returns the nullable attributes
127
+ def self.acceptable_openapi_nullable
128
+ openapi_nullable
129
+ end
130
+
131
+ # Initializes the object
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ def initialize(attributes = {})
134
+ if (!attributes.is_a?(Hash))
135
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::SlackConnection` initialize method"
136
+ end
137
+
138
+ # check to see if the attribute exists and convert string to symbol for hash key
139
+ acceptable_attribute_map = self.class.acceptable_attribute_map
140
+ attributes = attributes.each_with_object({}) { |(k, v), h|
141
+ if (!acceptable_attribute_map.key?(k.to_sym))
142
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::SlackConnection`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
143
+ end
144
+ h[k.to_sym] = v
145
+ }
146
+
147
+ if attributes.key?(:'id')
148
+ self.id = attributes[:'id']
149
+ else
150
+ self.id = nil
151
+ end
152
+
153
+ if attributes.key?(:'team_id')
154
+ self.team_id = attributes[:'team_id']
155
+ else
156
+ self.team_id = nil
157
+ end
158
+
159
+ if attributes.key?(:'team_name')
160
+ self.team_name = attributes[:'team_name']
161
+ else
162
+ self.team_name = nil
163
+ end
164
+
165
+ if attributes.key?(:'channel_id')
166
+ self.channel_id = attributes[:'channel_id']
167
+ else
168
+ self.channel_id = nil
169
+ end
170
+
171
+ if attributes.key?(:'channel_name')
172
+ self.channel_name = attributes[:'channel_name']
173
+ else
174
+ self.channel_name = nil
175
+ end
176
+
177
+ if attributes.key?(:'configuration_url')
178
+ self.configuration_url = attributes[:'configuration_url']
179
+ else
180
+ self.configuration_url = nil
181
+ end
182
+
183
+ if attributes.key?(:'events')
184
+ if (value = attributes[:'events']).is_a?(Array)
185
+ self.events = value
186
+ end
187
+ else
188
+ self.events = nil
189
+ end
190
+
191
+ if attributes.key?(:'status')
192
+ self.status = attributes[:'status']
193
+ else
194
+ self.status = nil
195
+ end
196
+
197
+ if attributes.key?(:'status_reason')
198
+ self.status_reason = attributes[:'status_reason']
199
+ else
200
+ self.status_reason = nil
201
+ end
202
+
203
+ if attributes.key?(:'last_sent_at')
204
+ self.last_sent_at = attributes[:'last_sent_at']
205
+ else
206
+ self.last_sent_at = nil
207
+ end
208
+
209
+ if attributes.key?(:'created_at')
210
+ self.created_at = attributes[:'created_at']
211
+ else
212
+ self.created_at = nil
213
+ end
214
+ end
215
+
216
+ # Show invalid properties with the reasons. Usually used together with valid?
217
+ # @return Array for valid properties with the reasons
218
+ def list_invalid_properties
219
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
220
+ invalid_properties = Array.new
221
+ if @id.nil?
222
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
223
+ end
224
+
225
+ if @team_id.nil?
226
+ invalid_properties.push('invalid value for "team_id", team_id cannot be nil.')
227
+ end
228
+
229
+ if @channel_id.nil?
230
+ invalid_properties.push('invalid value for "channel_id", channel_id cannot be nil.')
231
+ end
232
+
233
+ if @events.nil?
234
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
235
+ end
236
+
237
+ if @status.nil?
238
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
239
+ end
240
+
241
+ if @created_at.nil?
242
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
243
+ end
244
+
245
+ invalid_properties
246
+ end
247
+
248
+ # Check to see if the all the properties in the model are valid
249
+ # @return true if the model is valid
250
+ def valid?
251
+ warn '[DEPRECATED] the `valid?` method is obsolete'
252
+ return false if @id.nil?
253
+ return false if @team_id.nil?
254
+ return false if @channel_id.nil?
255
+ return false if @events.nil?
256
+ return false if @status.nil?
257
+ status_validator = EnumAttributeValidator.new('String', ["active", "revoked", "unknown_default_open_api"])
258
+ return false unless status_validator.valid?(@status)
259
+ return false if @created_at.nil?
260
+ true
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] id Value to be assigned
265
+ def id=(id)
266
+ if id.nil?
267
+ fail ArgumentError, 'id cannot be nil'
268
+ end
269
+
270
+ @id = id
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] team_id Value to be assigned
275
+ def team_id=(team_id)
276
+ if team_id.nil?
277
+ fail ArgumentError, 'team_id cannot be nil'
278
+ end
279
+
280
+ @team_id = team_id
281
+ end
282
+
283
+ # Custom attribute writer method with validation
284
+ # @param [Object] channel_id Value to be assigned
285
+ def channel_id=(channel_id)
286
+ if channel_id.nil?
287
+ fail ArgumentError, 'channel_id cannot be nil'
288
+ end
289
+
290
+ @channel_id = channel_id
291
+ end
292
+
293
+ # Custom attribute writer method checking allowed values (enum).
294
+ # @param [Object] status Object to be assigned
295
+ def status=(status)
296
+ validator = EnumAttributeValidator.new('String', ["active", "revoked", "unknown_default_open_api"])
297
+ unless validator.valid?(status)
298
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
299
+ end
300
+ @status = status
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] created_at Value to be assigned
305
+ def created_at=(created_at)
306
+ if created_at.nil?
307
+ fail ArgumentError, 'created_at cannot be nil'
308
+ end
309
+
310
+ @created_at = created_at
311
+ end
312
+
313
+ # Checks equality by comparing each attribute.
314
+ # @param [Object] Object to be compared
315
+ def ==(o)
316
+ return true if self.equal?(o)
317
+ self.class == o.class &&
318
+ id == o.id &&
319
+ team_id == o.team_id &&
320
+ team_name == o.team_name &&
321
+ channel_id == o.channel_id &&
322
+ channel_name == o.channel_name &&
323
+ configuration_url == o.configuration_url &&
324
+ events == o.events &&
325
+ status == o.status &&
326
+ status_reason == o.status_reason &&
327
+ last_sent_at == o.last_sent_at &&
328
+ created_at == o.created_at
329
+ end
330
+
331
+ # @see the `==` method
332
+ # @param [Object] Object to be compared
333
+ def eql?(o)
334
+ self == o
335
+ end
336
+
337
+ # Calculates hash code according to all attributes.
338
+ # @return [Integer] Hash code
339
+ def hash
340
+ [id, team_id, team_name, channel_id, channel_name, configuration_url, events, status, status_reason, last_sent_at, created_at].hash
341
+ end
342
+
343
+ # Builds the object from hash
344
+ # @param [Hash] attributes Model attributes in the form of hash
345
+ # @return [Object] Returns the model itself
346
+ def self.build_from_hash(attributes)
347
+ return nil unless attributes.is_a?(Hash)
348
+ attributes = attributes.transform_keys(&:to_sym)
349
+ # include attributes inherited from allOf parents (the nearest declaration wins)
350
+ map = acceptable_attribute_map
351
+ transformed_hash = {}
352
+ acceptable_openapi_types.each_pair do |key, type|
353
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
354
+ transformed_hash["#{key}"] = nil
355
+ elsif type =~ /\AArray<(.*)>/i
356
+ # check to ensure the input is an array given that the attribute
357
+ # is documented as an array but the input is not
358
+ if attributes[map[key]].is_a?(Array)
359
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
360
+ end
361
+ elsif !attributes[map[key]].nil?
362
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
363
+ end
364
+ end
365
+ new(transformed_hash)
366
+ end
367
+
368
+ # Returns the object in the form of hash
369
+ # @return [Hash] Returns the object in the form of hash
370
+ def to_hash
371
+ hash = {}
372
+ # include attributes inherited from allOf parents (the nearest declaration wins)
373
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
374
+ value = self.send(attr)
375
+ if value.nil?
376
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
377
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
378
+ end
379
+
380
+ hash[param] = _to_hash(value)
381
+ end
382
+ hash
383
+ end
384
+
385
+ end
386
+
387
+ end
@@ -0,0 +1,207 @@
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 SlackIntegration < ApiModelBase
18
+ # Whether the server has a Slack app to connect channels with: `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` are set.
19
+ attr_accessor :configured
20
+
21
+ # Slack channels getting the product's notifications.
22
+ attr_accessor :connections
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'configured' => :'configured',
28
+ :'connections' => :'connections'
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
+ :'configured' => :'Boolean',
46
+ :'connections' => :'Array<SlackConnection>'
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::SlackIntegration` 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::SlackIntegration`. 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?(:'configured')
83
+ self.configured = attributes[:'configured']
84
+ else
85
+ self.configured = nil
86
+ end
87
+
88
+ if attributes.key?(:'connections')
89
+ if (value = attributes[:'connections']).is_a?(Array)
90
+ self.connections = value
91
+ end
92
+ else
93
+ self.connections = nil
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @configured.nil?
103
+ invalid_properties.push('invalid value for "configured", configured cannot be nil.')
104
+ end
105
+
106
+ if @connections.nil?
107
+ invalid_properties.push('invalid value for "connections", connections cannot be nil.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
117
+ return false if @configured.nil?
118
+ return false if @connections.nil?
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] configured Value to be assigned
124
+ def configured=(configured)
125
+ if configured.nil?
126
+ fail ArgumentError, 'configured cannot be nil'
127
+ end
128
+
129
+ @configured = configured
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] connections Value to be assigned
134
+ def connections=(connections)
135
+ if connections.nil?
136
+ fail ArgumentError, 'connections cannot be nil'
137
+ end
138
+
139
+ @connections = connections
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ configured == o.configured &&
148
+ connections == o.connections
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [configured, connections].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ # include attributes inherited from allOf parents (the nearest declaration wins)
170
+ map = acceptable_attribute_map
171
+ transformed_hash = {}
172
+ acceptable_openapi_types.each_pair do |key, type|
173
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
174
+ transformed_hash["#{key}"] = nil
175
+ elsif type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[map[key]].is_a?(Array)
179
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
180
+ end
181
+ elsif !attributes[map[key]].nil?
182
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
183
+ end
184
+ end
185
+ new(transformed_hash)
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ # include attributes inherited from allOf parents (the nearest declaration wins)
193
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ end
206
+
207
+ end