pingram 1.0.31 → 1.0.32

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/pingram/api/broadcasts_api.rb +912 -0
  4. data/lib/pingram/api/library_api.rb +161 -0
  5. data/lib/pingram/api_client.rb +1 -1
  6. data/lib/pingram/client_wrapper.rb +20 -0
  7. data/lib/pingram/models/broadcast_metrics_response.rb +480 -0
  8. data/lib/pingram/models/broadcast_response.rb +525 -0
  9. data/lib/pingram/models/broadcast_response_audience.rb +161 -0
  10. data/lib/pingram/models/create_broadcast_request.rb +366 -0
  11. data/lib/pingram/models/create_library_request.rb +192 -0
  12. data/lib/pingram/models/create_library_response.rb +346 -0
  13. data/lib/pingram/models/get_users_response_users_inner.rb +13 -1
  14. data/lib/pingram/models/get_users_response_users_inner_properties_value.rb +104 -0
  15. data/lib/pingram/models/list_broadcast_recipients_response.rb +175 -0
  16. data/lib/pingram/models/list_broadcast_recipients_response_recipients_inner.rb +324 -0
  17. data/lib/pingram/models/list_broadcasts_response.rb +175 -0
  18. data/lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb +487 -0
  19. data/lib/pingram/models/list_library_response.rb +175 -0
  20. data/lib/pingram/models/list_library_response_items_inner.rb +344 -0
  21. data/lib/pingram/models/logs_get_response_logs_inner.rb +4 -4
  22. data/lib/pingram/models/mfa_status_response.rb +1 -1
  23. data/lib/pingram/models/post_user_request.rb +16 -4
  24. data/lib/pingram/models/schedule_broadcast_request.rb +165 -0
  25. data/lib/pingram/models/sender_post_body_to.rb +13 -1
  26. data/lib/pingram/models/sender_post_body_user.rb +13 -1
  27. data/lib/pingram/models/update_broadcast_request.rb +264 -0
  28. data/lib/pingram/models/user.rb +13 -1
  29. data/lib/pingram/version.rb +1 -1
  30. data/lib/pingram.rb +17 -0
  31. data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.3.gem +0 -0
  32. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
  33. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
  34. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.3}/gem_make.out +11 -10
  35. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.3/io/console.so +0 -0
  36. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.3}/mkmf.log +10 -6
  37. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  38. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.5.0/gem_make.out +5 -5
  39. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
  40. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
  41. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/ext/io/console/Makefile +2 -2
  42. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/ext/io/console/console.c +98 -13
  43. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/ext/io/console/extconf.rb +15 -1
  44. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/lib/io/console/size.rb +4 -2
  45. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.3/lib/io/console.so +0 -0
  46. data/vendor/bundle/ruby/3.2.0/specifications/{io-console-0.9.2.gemspec → io-console-0.9.3.gemspec} +3 -3
  47. metadata +35 -18
  48. data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.2.gem +0 -0
  49. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/io/console.so +0 -0
  50. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.2/lib/io/console.so +0 -0
  51. /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.3}/gem.build_complete +0 -0
  52. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/.document +0 -0
  53. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/BSDL +0 -0
  54. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/COPYING +0 -0
  55. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/README.md +0 -0
  56. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.3}/ext/io/console/win32_vk.inc +0 -0
@@ -0,0 +1,346 @@
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
+ class CreateLibraryResponse < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :use_case
21
+
22
+ attr_accessor :filename
23
+
24
+ attr_accessor :key
25
+
26
+ # Public URL to use in emails after the file is uploaded to uploadUrl.
27
+ attr_accessor :url
28
+
29
+ # Time-limited upload URL. PUT the file bytes with the same Content-Type.
30
+ attr_accessor :upload_url
31
+
32
+ attr_accessor :content_type
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
+ :'id' => :'id',
60
+ :'use_case' => :'useCase',
61
+ :'filename' => :'filename',
62
+ :'key' => :'key',
63
+ :'url' => :'url',
64
+ :'upload_url' => :'uploadUrl',
65
+ :'content_type' => :'contentType'
66
+ }
67
+ end
68
+
69
+ # Returns attribute mapping this model knows about
70
+ def self.acceptable_attribute_map
71
+ attribute_map
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ acceptable_attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'id' => :'String',
83
+ :'use_case' => :'String',
84
+ :'filename' => :'String',
85
+ :'key' => :'String',
86
+ :'url' => :'String',
87
+ :'upload_url' => :'String',
88
+ :'content_type' => :'String'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ if (!attributes.is_a?(Hash))
102
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::CreateLibraryResponse` initialize method"
103
+ end
104
+
105
+ # check to see if the attribute exists and convert string to symbol for hash key
106
+ acceptable_attribute_map = self.class.acceptable_attribute_map
107
+ attributes = attributes.each_with_object({}) { |(k, v), h|
108
+ if (!acceptable_attribute_map.key?(k.to_sym))
109
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::CreateLibraryResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
110
+ end
111
+ h[k.to_sym] = v
112
+ }
113
+
114
+ if attributes.key?(:'id')
115
+ self.id = attributes[:'id']
116
+ else
117
+ self.id = nil
118
+ end
119
+
120
+ if attributes.key?(:'use_case')
121
+ self.use_case = attributes[:'use_case']
122
+ else
123
+ self.use_case = nil
124
+ end
125
+
126
+ if attributes.key?(:'filename')
127
+ self.filename = attributes[:'filename']
128
+ else
129
+ self.filename = nil
130
+ end
131
+
132
+ if attributes.key?(:'key')
133
+ self.key = attributes[:'key']
134
+ else
135
+ self.key = nil
136
+ end
137
+
138
+ if attributes.key?(:'url')
139
+ self.url = attributes[:'url']
140
+ else
141
+ self.url = nil
142
+ end
143
+
144
+ if attributes.key?(:'upload_url')
145
+ self.upload_url = attributes[:'upload_url']
146
+ else
147
+ self.upload_url = nil
148
+ end
149
+
150
+ if attributes.key?(:'content_type')
151
+ self.content_type = attributes[:'content_type']
152
+ else
153
+ self.content_type = nil
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
161
+ invalid_properties = Array.new
162
+ if @id.nil?
163
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
164
+ end
165
+
166
+ if @use_case.nil?
167
+ invalid_properties.push('invalid value for "use_case", use_case cannot be nil.')
168
+ end
169
+
170
+ if @filename.nil?
171
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
172
+ end
173
+
174
+ if @key.nil?
175
+ invalid_properties.push('invalid value for "key", key cannot be nil.')
176
+ end
177
+
178
+ if @url.nil?
179
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
180
+ end
181
+
182
+ if @upload_url.nil?
183
+ invalid_properties.push('invalid value for "upload_url", upload_url cannot be nil.')
184
+ end
185
+
186
+ if @content_type.nil?
187
+ invalid_properties.push('invalid value for "content_type", content_type cannot be nil.')
188
+ end
189
+
190
+ invalid_properties
191
+ end
192
+
193
+ # Check to see if the all the properties in the model are valid
194
+ # @return true if the model is valid
195
+ def valid?
196
+ warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ return false if @id.nil?
198
+ return false if @use_case.nil?
199
+ use_case_validator = EnumAttributeValidator.new('String', ["media", "logos"])
200
+ return false unless use_case_validator.valid?(@use_case)
201
+ return false if @filename.nil?
202
+ return false if @key.nil?
203
+ return false if @url.nil?
204
+ return false if @upload_url.nil?
205
+ return false if @content_type.nil?
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] id Value to be assigned
211
+ def id=(id)
212
+ if id.nil?
213
+ fail ArgumentError, 'id cannot be nil'
214
+ end
215
+
216
+ @id = id
217
+ end
218
+
219
+ # Custom attribute writer method checking allowed values (enum).
220
+ # @param [Object] use_case Object to be assigned
221
+ def use_case=(use_case)
222
+ validator = EnumAttributeValidator.new('String', ["media", "logos"])
223
+ unless validator.valid?(use_case)
224
+ fail ArgumentError, "invalid value for \"use_case\", must be one of #{validator.allowable_values}."
225
+ end
226
+ @use_case = use_case
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] filename Value to be assigned
231
+ def filename=(filename)
232
+ if filename.nil?
233
+ fail ArgumentError, 'filename cannot be nil'
234
+ end
235
+
236
+ @filename = filename
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] key Value to be assigned
241
+ def key=(key)
242
+ if key.nil?
243
+ fail ArgumentError, 'key cannot be nil'
244
+ end
245
+
246
+ @key = key
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] url Value to be assigned
251
+ def url=(url)
252
+ if url.nil?
253
+ fail ArgumentError, 'url cannot be nil'
254
+ end
255
+
256
+ @url = url
257
+ end
258
+
259
+ # Custom attribute writer method with validation
260
+ # @param [Object] upload_url Value to be assigned
261
+ def upload_url=(upload_url)
262
+ if upload_url.nil?
263
+ fail ArgumentError, 'upload_url cannot be nil'
264
+ end
265
+
266
+ @upload_url = upload_url
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] content_type Value to be assigned
271
+ def content_type=(content_type)
272
+ if content_type.nil?
273
+ fail ArgumentError, 'content_type cannot be nil'
274
+ end
275
+
276
+ @content_type = content_type
277
+ end
278
+
279
+ # Checks equality by comparing each attribute.
280
+ # @param [Object] Object to be compared
281
+ def ==(o)
282
+ return true if self.equal?(o)
283
+ self.class == o.class &&
284
+ id == o.id &&
285
+ use_case == o.use_case &&
286
+ filename == o.filename &&
287
+ key == o.key &&
288
+ url == o.url &&
289
+ upload_url == o.upload_url &&
290
+ content_type == o.content_type
291
+ end
292
+
293
+ # @see the `==` method
294
+ # @param [Object] Object to be compared
295
+ def eql?(o)
296
+ self == o
297
+ end
298
+
299
+ # Calculates hash code according to all attributes.
300
+ # @return [Integer] Hash code
301
+ def hash
302
+ [id, use_case, filename, key, url, upload_url, content_type].hash
303
+ end
304
+
305
+ # Builds the object from hash
306
+ # @param [Hash] attributes Model attributes in the form of hash
307
+ # @return [Object] Returns the model itself
308
+ def self.build_from_hash(attributes)
309
+ return nil unless attributes.is_a?(Hash)
310
+ attributes = attributes.transform_keys(&:to_sym)
311
+ transformed_hash = {}
312
+ openapi_types.each_pair do |key, type|
313
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
314
+ transformed_hash["#{key}"] = nil
315
+ elsif type =~ /\AArray<(.*)>/i
316
+ # check to ensure the input is an array given that the attribute
317
+ # is documented as an array but the input is not
318
+ if attributes[attribute_map[key]].is_a?(Array)
319
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
320
+ end
321
+ elsif !attributes[attribute_map[key]].nil?
322
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
323
+ end
324
+ end
325
+ new(transformed_hash)
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ self.class.attribute_map.each_pair do |attr, param|
333
+ value = self.send(attr)
334
+ if value.nil?
335
+ is_nullable = self.class.openapi_nullable.include?(attr)
336
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
337
+ end
338
+
339
+ hash[param] = _to_hash(value)
340
+ end
341
+ hash
342
+ end
343
+
344
+ end
345
+
346
+ end
@@ -38,6 +38,9 @@ module Pingram
38
38
 
39
39
  attr_accessor :slack_token
40
40
 
41
+ # Custom key-value properties synced by the developer, used for audience segmentation (e.g. broadcast filters on user.properties.plan). Incremental identify calls shallow-merge keys (unset keys are preserved). Limits: max 25 keys, key length <= 64, string values <= 256 chars, serialized size <= 1KB.
42
+ attr_accessor :properties
43
+
41
44
  # Last activity timestamp. Updated automatically. Read-only.
42
45
  attr_accessor :last_seen_time
43
46
 
@@ -60,6 +63,7 @@ module Pingram
60
63
  :'timezone' => :'timezone',
61
64
  :'slack_channel' => :'slackChannel',
62
65
  :'slack_token' => :'slackToken',
66
+ :'properties' => :'properties',
63
67
  :'last_seen_time' => :'lastSeenTime',
64
68
  :'updated_at' => :'updatedAt',
65
69
  :'created_at' => :'createdAt',
@@ -88,6 +92,7 @@ module Pingram
88
92
  :'timezone' => :'String',
89
93
  :'slack_channel' => :'String',
90
94
  :'slack_token' => :'GetUsersResponseUsersInnerSlackToken',
95
+ :'properties' => :'Hash<String, GetUsersResponseUsersInnerPropertiesValue>',
91
96
  :'last_seen_time' => :'String',
92
97
  :'updated_at' => :'String',
93
98
  :'created_at' => :'String',
@@ -155,6 +160,12 @@ module Pingram
155
160
  self.slack_token = attributes[:'slack_token']
156
161
  end
157
162
 
163
+ if attributes.key?(:'properties')
164
+ if (value = attributes[:'properties']).is_a?(Hash)
165
+ self.properties = value
166
+ end
167
+ end
168
+
158
169
  if attributes.key?(:'last_seen_time')
159
170
  self.last_seen_time = attributes[:'last_seen_time']
160
171
  end
@@ -215,6 +226,7 @@ module Pingram
215
226
  timezone == o.timezone &&
216
227
  slack_channel == o.slack_channel &&
217
228
  slack_token == o.slack_token &&
229
+ properties == o.properties &&
218
230
  last_seen_time == o.last_seen_time &&
219
231
  updated_at == o.updated_at &&
220
232
  created_at == o.created_at &&
@@ -230,7 +242,7 @@ module Pingram
230
242
  # Calculates hash code according to all attributes.
231
243
  # @return [Integer] Hash code
232
244
  def hash
233
- [id, email, number, push_tokens, web_push_tokens, timezone, slack_channel, slack_token, last_seen_time, updated_at, created_at, email_suppression_status].hash
245
+ [id, email, number, push_tokens, web_push_tokens, timezone, slack_channel, slack_token, properties, last_seen_time, updated_at, created_at, email_suppression_status].hash
234
246
  end
235
247
 
236
248
  # Builds the object from hash
@@ -0,0 +1,104 @@
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
+ module GetUsersResponseUsersInnerPropertiesValue
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Boolean',
23
+ :'Float',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_any_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = Pingram.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,175 @@
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
+ class ListBroadcastRecipientsResponse < ApiModelBase
18
+ attr_accessor :recipients
19
+
20
+ attr_accessor :next_token
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'recipients' => :'recipients',
26
+ :'next_token' => :'nextToken'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'recipients' => :'Array<ListBroadcastRecipientsResponseRecipientsInner>',
44
+ :'next_token' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::ListBroadcastRecipientsResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::ListBroadcastRecipientsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'recipients')
71
+ if (value = attributes[:'recipients']).is_a?(Array)
72
+ self.recipients = value
73
+ end
74
+ else
75
+ self.recipients = nil
76
+ end
77
+
78
+ if attributes.key?(:'next_token')
79
+ self.next_token = attributes[:'next_token']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @recipients.nil?
89
+ invalid_properties.push('invalid value for "recipients", recipients cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @recipients.nil?
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] recipients Value to be assigned
105
+ def recipients=(recipients)
106
+ if recipients.nil?
107
+ fail ArgumentError, 'recipients cannot be nil'
108
+ end
109
+
110
+ @recipients = recipients
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ recipients == o.recipients &&
119
+ next_token == o.next_token
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [recipients, next_token].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ transformed_hash = {}
141
+ openapi_types.each_pair do |key, type|
142
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = nil
144
+ elsif type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[attribute_map[key]].is_a?(Array)
148
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
149
+ end
150
+ elsif !attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
152
+ end
153
+ end
154
+ new(transformed_hash)
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ if value.nil?
164
+ is_nullable = self.class.openapi_nullable.include?(attr)
165
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
166
+ end
167
+
168
+ hash[param] = _to_hash(value)
169
+ end
170
+ hash
171
+ end
172
+
173
+ end
174
+
175
+ end