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