pingram 1.0.0 → 1.0.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,590 @@
1
+ =begin
2
+ #Pingram
3
+
4
+ #Internal API for notification delivery and management
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pingram
17
+ # Organization document in organizations table. Holds usage caps; one org can have multiple accounts.
18
+ class Organization < ApiModelBase
19
+ attr_accessor :organization_id
20
+
21
+ attr_accessor :organization_type
22
+
23
+ attr_accessor :creator
24
+
25
+ attr_accessor :messages_cap
26
+
27
+ attr_accessor :cost_cap
28
+
29
+ attr_accessor :created_at
30
+
31
+ attr_accessor :updated_at
32
+
33
+ # ISO date (YYYY-MM-DD) when the billing cycle resets.
34
+ attr_accessor :anniversary_date
35
+
36
+ attr_accessor :allow_overage
37
+
38
+ attr_accessor :name
39
+
40
+ attr_accessor :sms_cap
41
+
42
+ attr_accessor :call_cap
43
+
44
+ # Stripe subscription ID.
45
+ attr_accessor :stripe_customer_id
46
+
47
+ attr_accessor :stripe_subscription_id
48
+
49
+ attr_accessor :subscription_status
50
+
51
+ # Verification status; internalCap applies when not 'verified'.
52
+ attr_accessor :status
53
+
54
+ # Unverified account cap (per-channel message limit).
55
+ attr_accessor :internal_cap
56
+
57
+ attr_accessor :pending_downgrade_cost_cap
58
+
59
+ attr_accessor :pending_downgrade_messages_cap
60
+
61
+ attr_accessor :pending_downgrade_sms_cap
62
+
63
+ attr_accessor :pending_downgrade_call_cap
64
+
65
+ attr_accessor :pending_downgrade_internal_cap
66
+
67
+ attr_accessor :pending_downgrade_effective_date
68
+
69
+ attr_accessor :pending_downgrade_account_type
70
+
71
+ class EnumAttributeValidator
72
+ attr_reader :datatype
73
+ attr_reader :allowable_values
74
+
75
+ def initialize(datatype, allowable_values)
76
+ @allowable_values = allowable_values.map do |value|
77
+ case datatype.to_s
78
+ when /Integer/i
79
+ value.to_i
80
+ when /Float/i
81
+ value.to_f
82
+ else
83
+ value
84
+ end
85
+ end
86
+ end
87
+
88
+ def valid?(value)
89
+ !value || allowable_values.include?(value)
90
+ end
91
+ end
92
+
93
+ # Attribute mapping from ruby-style variable name to JSON key.
94
+ def self.attribute_map
95
+ {
96
+ :'organization_id' => :'organizationId',
97
+ :'organization_type' => :'organizationType',
98
+ :'creator' => :'creator',
99
+ :'messages_cap' => :'messagesCap',
100
+ :'cost_cap' => :'costCap',
101
+ :'created_at' => :'createdAt',
102
+ :'updated_at' => :'updatedAt',
103
+ :'anniversary_date' => :'anniversaryDate',
104
+ :'allow_overage' => :'allowOverage',
105
+ :'name' => :'name',
106
+ :'sms_cap' => :'smsCap',
107
+ :'call_cap' => :'callCap',
108
+ :'stripe_customer_id' => :'stripeCustomerId',
109
+ :'stripe_subscription_id' => :'stripeSubscriptionId',
110
+ :'subscription_status' => :'subscriptionStatus',
111
+ :'status' => :'status',
112
+ :'internal_cap' => :'internalCap',
113
+ :'pending_downgrade_cost_cap' => :'pendingDowngradeCostCap',
114
+ :'pending_downgrade_messages_cap' => :'pendingDowngradeMessagesCap',
115
+ :'pending_downgrade_sms_cap' => :'pendingDowngradeSmsCap',
116
+ :'pending_downgrade_call_cap' => :'pendingDowngradeCallCap',
117
+ :'pending_downgrade_internal_cap' => :'pendingDowngradeInternalCap',
118
+ :'pending_downgrade_effective_date' => :'pendingDowngradeEffectiveDate',
119
+ :'pending_downgrade_account_type' => :'pendingDowngradeAccountType'
120
+ }
121
+ end
122
+
123
+ # Returns attribute mapping this model knows about
124
+ def self.acceptable_attribute_map
125
+ attribute_map
126
+ end
127
+
128
+ # Returns all the JSON keys this model knows about
129
+ def self.acceptable_attributes
130
+ acceptable_attribute_map.values
131
+ end
132
+
133
+ # Attribute type mapping.
134
+ def self.openapi_types
135
+ {
136
+ :'organization_id' => :'String',
137
+ :'organization_type' => :'String',
138
+ :'creator' => :'String',
139
+ :'messages_cap' => :'Float',
140
+ :'cost_cap' => :'Float',
141
+ :'created_at' => :'String',
142
+ :'updated_at' => :'String',
143
+ :'anniversary_date' => :'String',
144
+ :'allow_overage' => :'Boolean',
145
+ :'name' => :'String',
146
+ :'sms_cap' => :'Float',
147
+ :'call_cap' => :'Float',
148
+ :'stripe_customer_id' => :'String',
149
+ :'stripe_subscription_id' => :'String',
150
+ :'subscription_status' => :'String',
151
+ :'status' => :'String',
152
+ :'internal_cap' => :'Float',
153
+ :'pending_downgrade_cost_cap' => :'Float',
154
+ :'pending_downgrade_messages_cap' => :'Float',
155
+ :'pending_downgrade_sms_cap' => :'Float',
156
+ :'pending_downgrade_call_cap' => :'Float',
157
+ :'pending_downgrade_internal_cap' => :'Float',
158
+ :'pending_downgrade_effective_date' => :'String',
159
+ :'pending_downgrade_account_type' => :'String'
160
+ }
161
+ end
162
+
163
+ # List of attributes with nullable: true
164
+ def self.openapi_nullable
165
+ Set.new([
166
+ :'subscription_status',
167
+ ])
168
+ end
169
+
170
+ # Initializes the object
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ def initialize(attributes = {})
173
+ if (!attributes.is_a?(Hash))
174
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::Organization` initialize method"
175
+ end
176
+
177
+ # check to see if the attribute exists and convert string to symbol for hash key
178
+ acceptable_attribute_map = self.class.acceptable_attribute_map
179
+ attributes = attributes.each_with_object({}) { |(k, v), h|
180
+ if (!acceptable_attribute_map.key?(k.to_sym))
181
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::Organization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
182
+ end
183
+ h[k.to_sym] = v
184
+ }
185
+
186
+ if attributes.key?(:'organization_id')
187
+ self.organization_id = attributes[:'organization_id']
188
+ else
189
+ self.organization_id = nil
190
+ end
191
+
192
+ if attributes.key?(:'organization_type')
193
+ self.organization_type = attributes[:'organization_type']
194
+ else
195
+ self.organization_type = nil
196
+ end
197
+
198
+ if attributes.key?(:'creator')
199
+ self.creator = attributes[:'creator']
200
+ else
201
+ self.creator = nil
202
+ end
203
+
204
+ if attributes.key?(:'messages_cap')
205
+ self.messages_cap = attributes[:'messages_cap']
206
+ else
207
+ self.messages_cap = nil
208
+ end
209
+
210
+ if attributes.key?(:'cost_cap')
211
+ self.cost_cap = attributes[:'cost_cap']
212
+ else
213
+ self.cost_cap = nil
214
+ end
215
+
216
+ if attributes.key?(:'created_at')
217
+ self.created_at = attributes[:'created_at']
218
+ else
219
+ self.created_at = nil
220
+ end
221
+
222
+ if attributes.key?(:'updated_at')
223
+ self.updated_at = attributes[:'updated_at']
224
+ else
225
+ self.updated_at = nil
226
+ end
227
+
228
+ if attributes.key?(:'anniversary_date')
229
+ self.anniversary_date = attributes[:'anniversary_date']
230
+ else
231
+ self.anniversary_date = nil
232
+ end
233
+
234
+ if attributes.key?(:'allow_overage')
235
+ self.allow_overage = attributes[:'allow_overage']
236
+ else
237
+ self.allow_overage = nil
238
+ end
239
+
240
+ if attributes.key?(:'name')
241
+ self.name = attributes[:'name']
242
+ else
243
+ self.name = nil
244
+ end
245
+
246
+ if attributes.key?(:'sms_cap')
247
+ self.sms_cap = attributes[:'sms_cap']
248
+ end
249
+
250
+ if attributes.key?(:'call_cap')
251
+ self.call_cap = attributes[:'call_cap']
252
+ end
253
+
254
+ if attributes.key?(:'stripe_customer_id')
255
+ self.stripe_customer_id = attributes[:'stripe_customer_id']
256
+ end
257
+
258
+ if attributes.key?(:'stripe_subscription_id')
259
+ self.stripe_subscription_id = attributes[:'stripe_subscription_id']
260
+ end
261
+
262
+ if attributes.key?(:'subscription_status')
263
+ self.subscription_status = attributes[:'subscription_status']
264
+ end
265
+
266
+ if attributes.key?(:'status')
267
+ self.status = attributes[:'status']
268
+ end
269
+
270
+ if attributes.key?(:'internal_cap')
271
+ self.internal_cap = attributes[:'internal_cap']
272
+ end
273
+
274
+ if attributes.key?(:'pending_downgrade_cost_cap')
275
+ self.pending_downgrade_cost_cap = attributes[:'pending_downgrade_cost_cap']
276
+ end
277
+
278
+ if attributes.key?(:'pending_downgrade_messages_cap')
279
+ self.pending_downgrade_messages_cap = attributes[:'pending_downgrade_messages_cap']
280
+ end
281
+
282
+ if attributes.key?(:'pending_downgrade_sms_cap')
283
+ self.pending_downgrade_sms_cap = attributes[:'pending_downgrade_sms_cap']
284
+ end
285
+
286
+ if attributes.key?(:'pending_downgrade_call_cap')
287
+ self.pending_downgrade_call_cap = attributes[:'pending_downgrade_call_cap']
288
+ end
289
+
290
+ if attributes.key?(:'pending_downgrade_internal_cap')
291
+ self.pending_downgrade_internal_cap = attributes[:'pending_downgrade_internal_cap']
292
+ end
293
+
294
+ if attributes.key?(:'pending_downgrade_effective_date')
295
+ self.pending_downgrade_effective_date = attributes[:'pending_downgrade_effective_date']
296
+ end
297
+
298
+ if attributes.key?(:'pending_downgrade_account_type')
299
+ self.pending_downgrade_account_type = attributes[:'pending_downgrade_account_type']
300
+ end
301
+ end
302
+
303
+ # Show invalid properties with the reasons. Usually used together with valid?
304
+ # @return Array for valid properties with the reasons
305
+ def list_invalid_properties
306
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
307
+ invalid_properties = Array.new
308
+ if @organization_id.nil?
309
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
310
+ end
311
+
312
+ if @organization_type.nil?
313
+ invalid_properties.push('invalid value for "organization_type", organization_type cannot be nil.')
314
+ end
315
+
316
+ if @creator.nil?
317
+ invalid_properties.push('invalid value for "creator", creator cannot be nil.')
318
+ end
319
+
320
+ if @messages_cap.nil?
321
+ invalid_properties.push('invalid value for "messages_cap", messages_cap cannot be nil.')
322
+ end
323
+
324
+ if @cost_cap.nil?
325
+ invalid_properties.push('invalid value for "cost_cap", cost_cap cannot be nil.')
326
+ end
327
+
328
+ if @created_at.nil?
329
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
330
+ end
331
+
332
+ if @updated_at.nil?
333
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
334
+ end
335
+
336
+ if @anniversary_date.nil?
337
+ invalid_properties.push('invalid value for "anniversary_date", anniversary_date cannot be nil.')
338
+ end
339
+
340
+ if @allow_overage.nil?
341
+ invalid_properties.push('invalid value for "allow_overage", allow_overage cannot be nil.')
342
+ end
343
+
344
+ if @name.nil?
345
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
346
+ end
347
+
348
+ invalid_properties
349
+ end
350
+
351
+ # Check to see if the all the properties in the model are valid
352
+ # @return true if the model is valid
353
+ def valid?
354
+ warn '[DEPRECATED] the `valid?` method is obsolete'
355
+ return false if @organization_id.nil?
356
+ return false if @organization_type.nil?
357
+ organization_type_validator = EnumAttributeValidator.new('String', ["free", "paid"])
358
+ return false unless organization_type_validator.valid?(@organization_type)
359
+ return false if @creator.nil?
360
+ return false if @messages_cap.nil?
361
+ return false if @cost_cap.nil?
362
+ return false if @created_at.nil?
363
+ return false if @updated_at.nil?
364
+ return false if @anniversary_date.nil?
365
+ return false if @allow_overage.nil?
366
+ return false if @name.nil?
367
+ subscription_status_validator = EnumAttributeValidator.new('String', ["active", "canceled", "past_due", "paused"])
368
+ return false unless subscription_status_validator.valid?(@subscription_status)
369
+ status_validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
370
+ return false unless status_validator.valid?(@status)
371
+ pending_downgrade_account_type_validator = EnumAttributeValidator.new('String', ["free"])
372
+ return false unless pending_downgrade_account_type_validator.valid?(@pending_downgrade_account_type)
373
+ true
374
+ end
375
+
376
+ # Custom attribute writer method with validation
377
+ # @param [Object] organization_id Value to be assigned
378
+ def organization_id=(organization_id)
379
+ if organization_id.nil?
380
+ fail ArgumentError, 'organization_id cannot be nil'
381
+ end
382
+
383
+ @organization_id = organization_id
384
+ end
385
+
386
+ # Custom attribute writer method checking allowed values (enum).
387
+ # @param [Object] organization_type Object to be assigned
388
+ def organization_type=(organization_type)
389
+ validator = EnumAttributeValidator.new('String', ["free", "paid"])
390
+ unless validator.valid?(organization_type)
391
+ fail ArgumentError, "invalid value for \"organization_type\", must be one of #{validator.allowable_values}."
392
+ end
393
+ @organization_type = organization_type
394
+ end
395
+
396
+ # Custom attribute writer method with validation
397
+ # @param [Object] creator Value to be assigned
398
+ def creator=(creator)
399
+ if creator.nil?
400
+ fail ArgumentError, 'creator cannot be nil'
401
+ end
402
+
403
+ @creator = creator
404
+ end
405
+
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] messages_cap Value to be assigned
408
+ def messages_cap=(messages_cap)
409
+ if messages_cap.nil?
410
+ fail ArgumentError, 'messages_cap cannot be nil'
411
+ end
412
+
413
+ @messages_cap = messages_cap
414
+ end
415
+
416
+ # Custom attribute writer method with validation
417
+ # @param [Object] cost_cap Value to be assigned
418
+ def cost_cap=(cost_cap)
419
+ if cost_cap.nil?
420
+ fail ArgumentError, 'cost_cap cannot be nil'
421
+ end
422
+
423
+ @cost_cap = cost_cap
424
+ end
425
+
426
+ # Custom attribute writer method with validation
427
+ # @param [Object] created_at Value to be assigned
428
+ def created_at=(created_at)
429
+ if created_at.nil?
430
+ fail ArgumentError, 'created_at cannot be nil'
431
+ end
432
+
433
+ @created_at = created_at
434
+ end
435
+
436
+ # Custom attribute writer method with validation
437
+ # @param [Object] updated_at Value to be assigned
438
+ def updated_at=(updated_at)
439
+ if updated_at.nil?
440
+ fail ArgumentError, 'updated_at cannot be nil'
441
+ end
442
+
443
+ @updated_at = updated_at
444
+ end
445
+
446
+ # Custom attribute writer method with validation
447
+ # @param [Object] anniversary_date Value to be assigned
448
+ def anniversary_date=(anniversary_date)
449
+ if anniversary_date.nil?
450
+ fail ArgumentError, 'anniversary_date cannot be nil'
451
+ end
452
+
453
+ @anniversary_date = anniversary_date
454
+ end
455
+
456
+ # Custom attribute writer method with validation
457
+ # @param [Object] allow_overage Value to be assigned
458
+ def allow_overage=(allow_overage)
459
+ if allow_overage.nil?
460
+ fail ArgumentError, 'allow_overage cannot be nil'
461
+ end
462
+
463
+ @allow_overage = allow_overage
464
+ end
465
+
466
+ # Custom attribute writer method with validation
467
+ # @param [Object] name Value to be assigned
468
+ def name=(name)
469
+ if name.nil?
470
+ fail ArgumentError, 'name cannot be nil'
471
+ end
472
+
473
+ @name = name
474
+ end
475
+
476
+ # Custom attribute writer method checking allowed values (enum).
477
+ # @param [Object] subscription_status Object to be assigned
478
+ def subscription_status=(subscription_status)
479
+ validator = EnumAttributeValidator.new('String', ["active", "canceled", "past_due", "paused"])
480
+ unless validator.valid?(subscription_status)
481
+ fail ArgumentError, "invalid value for \"subscription_status\", must be one of #{validator.allowable_values}."
482
+ end
483
+ @subscription_status = subscription_status
484
+ end
485
+
486
+ # Custom attribute writer method checking allowed values (enum).
487
+ # @param [Object] status Object to be assigned
488
+ def status=(status)
489
+ validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
490
+ unless validator.valid?(status)
491
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
492
+ end
493
+ @status = status
494
+ end
495
+
496
+ # Custom attribute writer method checking allowed values (enum).
497
+ # @param [Object] pending_downgrade_account_type Object to be assigned
498
+ def pending_downgrade_account_type=(pending_downgrade_account_type)
499
+ validator = EnumAttributeValidator.new('String', ["free"])
500
+ unless validator.valid?(pending_downgrade_account_type)
501
+ fail ArgumentError, "invalid value for \"pending_downgrade_account_type\", must be one of #{validator.allowable_values}."
502
+ end
503
+ @pending_downgrade_account_type = pending_downgrade_account_type
504
+ end
505
+
506
+ # Checks equality by comparing each attribute.
507
+ # @param [Object] Object to be compared
508
+ def ==(o)
509
+ return true if self.equal?(o)
510
+ self.class == o.class &&
511
+ organization_id == o.organization_id &&
512
+ organization_type == o.organization_type &&
513
+ creator == o.creator &&
514
+ messages_cap == o.messages_cap &&
515
+ cost_cap == o.cost_cap &&
516
+ created_at == o.created_at &&
517
+ updated_at == o.updated_at &&
518
+ anniversary_date == o.anniversary_date &&
519
+ allow_overage == o.allow_overage &&
520
+ name == o.name &&
521
+ sms_cap == o.sms_cap &&
522
+ call_cap == o.call_cap &&
523
+ stripe_customer_id == o.stripe_customer_id &&
524
+ stripe_subscription_id == o.stripe_subscription_id &&
525
+ subscription_status == o.subscription_status &&
526
+ status == o.status &&
527
+ internal_cap == o.internal_cap &&
528
+ pending_downgrade_cost_cap == o.pending_downgrade_cost_cap &&
529
+ pending_downgrade_messages_cap == o.pending_downgrade_messages_cap &&
530
+ pending_downgrade_sms_cap == o.pending_downgrade_sms_cap &&
531
+ pending_downgrade_call_cap == o.pending_downgrade_call_cap &&
532
+ pending_downgrade_internal_cap == o.pending_downgrade_internal_cap &&
533
+ pending_downgrade_effective_date == o.pending_downgrade_effective_date &&
534
+ pending_downgrade_account_type == o.pending_downgrade_account_type
535
+ end
536
+
537
+ # @see the `==` method
538
+ # @param [Object] Object to be compared
539
+ def eql?(o)
540
+ self == o
541
+ end
542
+
543
+ # Calculates hash code according to all attributes.
544
+ # @return [Integer] Hash code
545
+ def hash
546
+ [organization_id, organization_type, creator, messages_cap, cost_cap, created_at, updated_at, anniversary_date, allow_overage, name, sms_cap, call_cap, stripe_customer_id, stripe_subscription_id, subscription_status, status, internal_cap, pending_downgrade_cost_cap, pending_downgrade_messages_cap, pending_downgrade_sms_cap, pending_downgrade_call_cap, pending_downgrade_internal_cap, pending_downgrade_effective_date, pending_downgrade_account_type].hash
547
+ end
548
+
549
+ # Builds the object from hash
550
+ # @param [Hash] attributes Model attributes in the form of hash
551
+ # @return [Object] Returns the model itself
552
+ def self.build_from_hash(attributes)
553
+ return nil unless attributes.is_a?(Hash)
554
+ attributes = attributes.transform_keys(&:to_sym)
555
+ transformed_hash = {}
556
+ openapi_types.each_pair do |key, type|
557
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
558
+ transformed_hash["#{key}"] = nil
559
+ elsif type =~ /\AArray<(.*)>/i
560
+ # check to ensure the input is an array given that the attribute
561
+ # is documented as an array but the input is not
562
+ if attributes[attribute_map[key]].is_a?(Array)
563
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
564
+ end
565
+ elsif !attributes[attribute_map[key]].nil?
566
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
567
+ end
568
+ end
569
+ new(transformed_hash)
570
+ end
571
+
572
+ # Returns the object in the form of hash
573
+ # @return [Hash] Returns the object in the form of hash
574
+ def to_hash
575
+ hash = {}
576
+ self.class.attribute_map.each_pair do |attr, param|
577
+ value = self.send(attr)
578
+ if value.nil?
579
+ is_nullable = self.class.openapi_nullable.include?(attr)
580
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
581
+ end
582
+
583
+ hash[param] = _to_hash(value)
584
+ end
585
+ hash
586
+ end
587
+
588
+ end
589
+
590
+ end