pingram 0.1.0 → 0.1.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,431 @@
1
+ =begin
2
+ #NotificationAPI
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
+ class GetTemplatesListResponseInnerAnyOf1 < ApiModelBase
18
+ attr_accessor :title
19
+
20
+ attr_accessor :redirect_url
21
+
22
+ attr_accessor :image_url
23
+
24
+ attr_accessor :instant
25
+
26
+ attr_accessor :batch
27
+
28
+ attr_accessor :env_id
29
+
30
+ attr_accessor :notification_id
31
+
32
+ attr_accessor :template_id
33
+
34
+ attr_accessor :channel
35
+
36
+ attr_accessor :default
37
+
38
+ attr_accessor :is_default_for
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'title' => :'title',
66
+ :'redirect_url' => :'redirectURL',
67
+ :'image_url' => :'imageURL',
68
+ :'instant' => :'instant',
69
+ :'batch' => :'batch',
70
+ :'env_id' => :'envId',
71
+ :'notification_id' => :'notificationId',
72
+ :'template_id' => :'templateId',
73
+ :'channel' => :'channel',
74
+ :'default' => :'default',
75
+ :'is_default_for' => :'isDefaultFor'
76
+ }
77
+ end
78
+
79
+ # Returns attribute mapping this model knows about
80
+ def self.acceptable_attribute_map
81
+ attribute_map
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ acceptable_attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'title' => :'String',
93
+ :'redirect_url' => :'String',
94
+ :'image_url' => :'String',
95
+ :'instant' => :'GetTemplatesListResponseInnerAnyOf1Instant',
96
+ :'batch' => :'GetTemplatesListResponseInnerAnyOf1Instant',
97
+ :'env_id' => :'String',
98
+ :'notification_id' => :'String',
99
+ :'template_id' => :'String',
100
+ :'channel' => :'ChannelsEnum',
101
+ :'default' => :'Boolean',
102
+ :'is_default_for' => :'Hash<String, Boolean>'
103
+ }
104
+ end
105
+
106
+ # List of attributes with nullable: true
107
+ def self.openapi_nullable
108
+ Set.new([
109
+ ])
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ if (!attributes.is_a?(Hash))
116
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::GetTemplatesListResponseInnerAnyOf1` initialize method"
117
+ end
118
+
119
+ # check to see if the attribute exists and convert string to symbol for hash key
120
+ acceptable_attribute_map = self.class.acceptable_attribute_map
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!acceptable_attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::GetTemplatesListResponseInnerAnyOf1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'title')
129
+ self.title = attributes[:'title']
130
+ else
131
+ self.title = nil
132
+ end
133
+
134
+ if attributes.key?(:'redirect_url')
135
+ self.redirect_url = attributes[:'redirect_url']
136
+ else
137
+ self.redirect_url = nil
138
+ end
139
+
140
+ if attributes.key?(:'image_url')
141
+ self.image_url = attributes[:'image_url']
142
+ else
143
+ self.image_url = nil
144
+ end
145
+
146
+ if attributes.key?(:'instant')
147
+ self.instant = attributes[:'instant']
148
+ else
149
+ self.instant = nil
150
+ end
151
+
152
+ if attributes.key?(:'batch')
153
+ self.batch = attributes[:'batch']
154
+ else
155
+ self.batch = nil
156
+ end
157
+
158
+ if attributes.key?(:'env_id')
159
+ self.env_id = attributes[:'env_id']
160
+ else
161
+ self.env_id = nil
162
+ end
163
+
164
+ if attributes.key?(:'notification_id')
165
+ self.notification_id = attributes[:'notification_id']
166
+ else
167
+ self.notification_id = nil
168
+ end
169
+
170
+ if attributes.key?(:'template_id')
171
+ self.template_id = attributes[:'template_id']
172
+ else
173
+ self.template_id = nil
174
+ end
175
+
176
+ if attributes.key?(:'channel')
177
+ self.channel = attributes[:'channel']
178
+ else
179
+ self.channel = nil
180
+ end
181
+
182
+ if attributes.key?(:'default')
183
+ self.default = attributes[:'default']
184
+ else
185
+ self.default = nil
186
+ end
187
+
188
+ if attributes.key?(:'is_default_for')
189
+ if (value = attributes[:'is_default_for']).is_a?(Hash)
190
+ self.is_default_for = value
191
+ end
192
+ end
193
+ end
194
+
195
+ # Show invalid properties with the reasons. Usually used together with valid?
196
+ # @return Array for valid properties with the reasons
197
+ def list_invalid_properties
198
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
199
+ invalid_properties = Array.new
200
+ if @title.nil?
201
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
202
+ end
203
+
204
+ if @redirect_url.nil?
205
+ invalid_properties.push('invalid value for "redirect_url", redirect_url cannot be nil.')
206
+ end
207
+
208
+ if @image_url.nil?
209
+ invalid_properties.push('invalid value for "image_url", image_url cannot be nil.')
210
+ end
211
+
212
+ if @instant.nil?
213
+ invalid_properties.push('invalid value for "instant", instant cannot be nil.')
214
+ end
215
+
216
+ if @batch.nil?
217
+ invalid_properties.push('invalid value for "batch", batch cannot be nil.')
218
+ end
219
+
220
+ if @env_id.nil?
221
+ invalid_properties.push('invalid value for "env_id", env_id cannot be nil.')
222
+ end
223
+
224
+ if @notification_id.nil?
225
+ invalid_properties.push('invalid value for "notification_id", notification_id cannot be nil.')
226
+ end
227
+
228
+ if @template_id.nil?
229
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
230
+ end
231
+
232
+ if @channel.nil?
233
+ invalid_properties.push('invalid value for "channel", channel cannot be nil.')
234
+ end
235
+
236
+ if @default.nil?
237
+ invalid_properties.push('invalid value for "default", default cannot be nil.')
238
+ end
239
+
240
+ invalid_properties
241
+ end
242
+
243
+ # Check to see if the all the properties in the model are valid
244
+ # @return true if the model is valid
245
+ def valid?
246
+ warn '[DEPRECATED] the `valid?` method is obsolete'
247
+ return false if @title.nil?
248
+ return false if @redirect_url.nil?
249
+ return false if @image_url.nil?
250
+ return false if @instant.nil?
251
+ return false if @batch.nil?
252
+ return false if @env_id.nil?
253
+ return false if @notification_id.nil?
254
+ return false if @template_id.nil?
255
+ return false if @channel.nil?
256
+ return false if @default.nil?
257
+ true
258
+ end
259
+
260
+ # Custom attribute writer method with validation
261
+ # @param [Object] title Value to be assigned
262
+ def title=(title)
263
+ if title.nil?
264
+ fail ArgumentError, 'title cannot be nil'
265
+ end
266
+
267
+ @title = title
268
+ end
269
+
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] redirect_url Value to be assigned
272
+ def redirect_url=(redirect_url)
273
+ if redirect_url.nil?
274
+ fail ArgumentError, 'redirect_url cannot be nil'
275
+ end
276
+
277
+ @redirect_url = redirect_url
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] image_url Value to be assigned
282
+ def image_url=(image_url)
283
+ if image_url.nil?
284
+ fail ArgumentError, 'image_url cannot be nil'
285
+ end
286
+
287
+ @image_url = image_url
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] instant Value to be assigned
292
+ def instant=(instant)
293
+ if instant.nil?
294
+ fail ArgumentError, 'instant cannot be nil'
295
+ end
296
+
297
+ @instant = instant
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] batch Value to be assigned
302
+ def batch=(batch)
303
+ if batch.nil?
304
+ fail ArgumentError, 'batch cannot be nil'
305
+ end
306
+
307
+ @batch = batch
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] env_id Value to be assigned
312
+ def env_id=(env_id)
313
+ if env_id.nil?
314
+ fail ArgumentError, 'env_id cannot be nil'
315
+ end
316
+
317
+ @env_id = env_id
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] notification_id Value to be assigned
322
+ def notification_id=(notification_id)
323
+ if notification_id.nil?
324
+ fail ArgumentError, 'notification_id cannot be nil'
325
+ end
326
+
327
+ @notification_id = notification_id
328
+ end
329
+
330
+ # Custom attribute writer method with validation
331
+ # @param [Object] template_id Value to be assigned
332
+ def template_id=(template_id)
333
+ if template_id.nil?
334
+ fail ArgumentError, 'template_id cannot be nil'
335
+ end
336
+
337
+ @template_id = template_id
338
+ end
339
+
340
+ # Custom attribute writer method with validation
341
+ # @param [Object] channel Value to be assigned
342
+ def channel=(channel)
343
+ if channel.nil?
344
+ fail ArgumentError, 'channel cannot be nil'
345
+ end
346
+
347
+ @channel = channel
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] default Value to be assigned
352
+ def default=(default)
353
+ if default.nil?
354
+ fail ArgumentError, 'default cannot be nil'
355
+ end
356
+
357
+ @default = default
358
+ end
359
+
360
+ # Checks equality by comparing each attribute.
361
+ # @param [Object] Object to be compared
362
+ def ==(o)
363
+ return true if self.equal?(o)
364
+ self.class == o.class &&
365
+ title == o.title &&
366
+ redirect_url == o.redirect_url &&
367
+ image_url == o.image_url &&
368
+ instant == o.instant &&
369
+ batch == o.batch &&
370
+ env_id == o.env_id &&
371
+ notification_id == o.notification_id &&
372
+ template_id == o.template_id &&
373
+ channel == o.channel &&
374
+ default == o.default &&
375
+ is_default_for == o.is_default_for
376
+ end
377
+
378
+ # @see the `==` method
379
+ # @param [Object] Object to be compared
380
+ def eql?(o)
381
+ self == o
382
+ end
383
+
384
+ # Calculates hash code according to all attributes.
385
+ # @return [Integer] Hash code
386
+ def hash
387
+ [title, redirect_url, image_url, instant, batch, env_id, notification_id, template_id, channel, default, is_default_for].hash
388
+ end
389
+
390
+ # Builds the object from hash
391
+ # @param [Hash] attributes Model attributes in the form of hash
392
+ # @return [Object] Returns the model itself
393
+ def self.build_from_hash(attributes)
394
+ return nil unless attributes.is_a?(Hash)
395
+ attributes = attributes.transform_keys(&:to_sym)
396
+ transformed_hash = {}
397
+ openapi_types.each_pair do |key, type|
398
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
399
+ transformed_hash["#{key}"] = nil
400
+ elsif type =~ /\AArray<(.*)>/i
401
+ # check to ensure the input is an array given that the attribute
402
+ # is documented as an array but the input is not
403
+ if attributes[attribute_map[key]].is_a?(Array)
404
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
405
+ end
406
+ elsif !attributes[attribute_map[key]].nil?
407
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
408
+ end
409
+ end
410
+ new(transformed_hash)
411
+ end
412
+
413
+ # Returns the object in the form of hash
414
+ # @return [Hash] Returns the object in the form of hash
415
+ def to_hash
416
+ hash = {}
417
+ self.class.attribute_map.each_pair do |attr, param|
418
+ value = self.send(attr)
419
+ if value.nil?
420
+ is_nullable = self.class.openapi_nullable.include?(attr)
421
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
422
+ end
423
+
424
+ hash[param] = _to_hash(value)
425
+ end
426
+ hash
427
+ end
428
+
429
+ end
430
+
431
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #NotificationAPI
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
+ class GetTemplatesListResponseInnerAnyOf1Instant < ApiModelBase
18
+ attr_accessor :title
19
+
20
+ attr_accessor :redirect_url
21
+
22
+ attr_accessor :image_url
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'title' => :'title',
28
+ :'redirect_url' => :'redirectURL',
29
+ :'image_url' => :'imageURL'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'title' => :'String',
47
+ :'redirect_url' => :'String',
48
+ :'image_url' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::GetTemplatesListResponseInnerAnyOf1Instant` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::GetTemplatesListResponseInnerAnyOf1Instant`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'title')
75
+ self.title = attributes[:'title']
76
+ else
77
+ self.title = nil
78
+ end
79
+
80
+ if attributes.key?(:'redirect_url')
81
+ self.redirect_url = attributes[:'redirect_url']
82
+ else
83
+ self.redirect_url = nil
84
+ end
85
+
86
+ if attributes.key?(:'image_url')
87
+ self.image_url = attributes[:'image_url']
88
+ else
89
+ self.image_url = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @title.nil?
99
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
100
+ end
101
+
102
+ if @redirect_url.nil?
103
+ invalid_properties.push('invalid value for "redirect_url", redirect_url cannot be nil.')
104
+ end
105
+
106
+ if @image_url.nil?
107
+ invalid_properties.push('invalid value for "image_url", image_url 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 @title.nil?
118
+ return false if @redirect_url.nil?
119
+ return false if @image_url.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] title Value to be assigned
125
+ def title=(title)
126
+ if title.nil?
127
+ fail ArgumentError, 'title cannot be nil'
128
+ end
129
+
130
+ @title = title
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] redirect_url Value to be assigned
135
+ def redirect_url=(redirect_url)
136
+ if redirect_url.nil?
137
+ fail ArgumentError, 'redirect_url cannot be nil'
138
+ end
139
+
140
+ @redirect_url = redirect_url
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] image_url Value to be assigned
145
+ def image_url=(image_url)
146
+ if image_url.nil?
147
+ fail ArgumentError, 'image_url cannot be nil'
148
+ end
149
+
150
+ @image_url = image_url
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ title == o.title &&
159
+ redirect_url == o.redirect_url &&
160
+ image_url == o.image_url
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [title, redirect_url, image_url].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ end
215
+
216
+ end