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