sendpost_ruby_sdk 1.0.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +155 -1
  3. data/config-ruby.json +2 -2
  4. data/docs/CountStat.md +18 -0
  5. data/docs/DeleteResponse.md +20 -0
  6. data/docs/EventMetadata.md +4 -0
  7. data/docs/RDSuppression.md +18 -0
  8. data/docs/RSuppression.md +24 -0
  9. data/docs/Suppression.md +26 -0
  10. data/docs/SuppressionApi.md +293 -0
  11. data/docs/SuppressionEmail.md +18 -0
  12. data/generate-libs.bash +1 -1
  13. data/git_push.sh +2 -2
  14. data/lib/sendpost_ruby_sdk/api/email_api.rb +1 -1
  15. data/lib/sendpost_ruby_sdk/api/suppression_api.rb +305 -0
  16. data/lib/sendpost_ruby_sdk/api_client.rb +1 -1
  17. data/lib/sendpost_ruby_sdk/api_error.rb +1 -1
  18. data/lib/sendpost_ruby_sdk/configuration.rb +12 -10
  19. data/lib/sendpost_ruby_sdk/models/attachment.rb +13 -18
  20. data/lib/sendpost_ruby_sdk/models/city.rb +13 -18
  21. data/lib/sendpost_ruby_sdk/models/copy_to.rb +13 -18
  22. data/lib/sendpost_ruby_sdk/models/count_stat.rb +214 -0
  23. data/lib/sendpost_ruby_sdk/models/delete_response.rb +223 -0
  24. data/lib/sendpost_ruby_sdk/models/device.rb +13 -18
  25. data/lib/sendpost_ruby_sdk/models/email_message.rb +13 -18
  26. data/lib/sendpost_ruby_sdk/models/email_response.rb +13 -18
  27. data/lib/sendpost_ruby_sdk/models/event_metadata.rb +32 -19
  28. data/lib/sendpost_ruby_sdk/models/from.rb +13 -18
  29. data/lib/sendpost_ruby_sdk/models/os.rb +13 -18
  30. data/lib/sendpost_ruby_sdk/models/q_email_message.rb +13 -18
  31. data/lib/sendpost_ruby_sdk/models/q_event.rb +13 -18
  32. data/lib/sendpost_ruby_sdk/models/r_suppression.rb +249 -0
  33. data/lib/sendpost_ruby_sdk/models/rd_suppression.rb +216 -0
  34. data/lib/sendpost_ruby_sdk/models/reply_to.rb +13 -18
  35. data/lib/sendpost_ruby_sdk/models/suppression.rb +250 -0
  36. data/lib/sendpost_ruby_sdk/models/suppression_email.rb +214 -0
  37. data/lib/sendpost_ruby_sdk/models/to.rb +13 -18
  38. data/lib/sendpost_ruby_sdk/models/user_agent.rb +13 -18
  39. data/lib/sendpost_ruby_sdk/models/webhook_event.rb +13 -18
  40. data/lib/sendpost_ruby_sdk/version.rb +2 -2
  41. data/lib/sendpost_ruby_sdk.rb +8 -1
  42. data/sendpost.yaml +230 -2
  43. data/sendpost_ruby_sdk.gemspec +2 -2
  44. data/spec/api/suppression_api_spec.rb +88 -0
  45. data/spec/api_client_spec.rb +1 -1
  46. data/spec/configuration_spec.rb +1 -1
  47. data/spec/models/count_stat_spec.rb +34 -0
  48. data/spec/models/delete_response_spec.rb +40 -0
  49. data/spec/models/r_suppression_spec.rb +52 -0
  50. data/spec/models/rd_suppression_spec.rb +34 -0
  51. data/spec/models/suppression_email_spec.rb +34 -0
  52. data/spec/models/suppression_spec.rb +58 -0
  53. data/spec/spec_helper.rb +1 -1
  54. metadata +37 -9
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -17,6 +17,10 @@ module Sendpost
17
17
  class EventMetadata
18
18
  attr_accessor :clicked_url
19
19
 
20
+ attr_accessor :tracked_ip
21
+
22
+ attr_accessor :raw_user_agent
23
+
20
24
  attr_accessor :device
21
25
 
22
26
  attr_accessor :geo
@@ -33,6 +37,8 @@ module Sendpost
33
37
  def self.attribute_map
34
38
  {
35
39
  :'clicked_url' => :'clickedURL',
40
+ :'tracked_ip' => :'trackedIP',
41
+ :'raw_user_agent' => :'rawUserAgent',
36
42
  :'device' => :'device',
37
43
  :'geo' => :'geo',
38
44
  :'os' => :'os',
@@ -51,6 +57,8 @@ module Sendpost
51
57
  def self.openapi_types
52
58
  {
53
59
  :'clicked_url' => :'String',
60
+ :'tracked_ip' => :'String',
61
+ :'raw_user_agent' => :'String',
54
62
  :'device' => :'Device',
55
63
  :'geo' => :'City',
56
64
  :'os' => :'Os',
@@ -85,6 +93,14 @@ module Sendpost
85
93
  self.clicked_url = attributes[:'clicked_url']
86
94
  end
87
95
 
96
+ if attributes.key?(:'tracked_ip')
97
+ self.tracked_ip = attributes[:'tracked_ip']
98
+ end
99
+
100
+ if attributes.key?(:'raw_user_agent')
101
+ self.raw_user_agent = attributes[:'raw_user_agent']
102
+ end
103
+
88
104
  if attributes.key?(:'device')
89
105
  self.device = attributes[:'device']
90
106
  end
@@ -113,6 +129,7 @@ module Sendpost
113
129
  # Show invalid properties with the reasons. Usually used together with valid?
114
130
  # @return Array for valid properties with the reasons
115
131
  def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
133
  invalid_properties = Array.new
117
134
  invalid_properties
118
135
  end
@@ -120,6 +137,7 @@ module Sendpost
120
137
  # Check to see if the all the properties in the model are valid
121
138
  # @return true if the model is valid
122
139
  def valid?
140
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
141
  true
124
142
  end
125
143
 
@@ -129,6 +147,8 @@ module Sendpost
129
147
  return true if self.equal?(o)
130
148
  self.class == o.class &&
131
149
  clicked_url == o.clicked_url &&
150
+ tracked_ip == o.tracked_ip &&
151
+ raw_user_agent == o.raw_user_agent &&
132
152
  device == o.device &&
133
153
  geo == o.geo &&
134
154
  os == o.os &&
@@ -146,44 +166,37 @@ module Sendpost
146
166
  # Calculates hash code according to all attributes.
147
167
  # @return [Integer] Hash code
148
168
  def hash
149
- [clicked_url, device, geo, os, smtp_code, smtp_description, user_agent].hash
169
+ [clicked_url, tracked_ip, raw_user_agent, device, geo, os, smtp_code, smtp_description, user_agent].hash
150
170
  end
151
171
 
152
172
  # Builds the object from hash
153
173
  # @param [Hash] attributes Model attributes in the form of hash
154
174
  # @return [Object] Returns the model itself
155
175
  def self.build_from_hash(attributes)
156
- new.build_from_hash(attributes)
157
- end
158
-
159
- # Builds the object from hash
160
- # @param [Hash] attributes Model attributes in the form of hash
161
- # @return [Object] Returns the model itself
162
- def build_from_hash(attributes)
163
176
  return nil unless attributes.is_a?(Hash)
164
177
  attributes = attributes.transform_keys(&:to_sym)
165
- self.class.openapi_types.each_pair do |key, type|
166
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
167
- self.send("#{key}=", nil)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
168
182
  elsif type =~ /\AArray<(.*)>/i
169
183
  # check to ensure the input is an array given that the attribute
170
184
  # is documented as an array but the input is not
171
- if attributes[self.class.attribute_map[key]].is_a?(Array)
172
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
187
  end
174
- elsif !attributes[self.class.attribute_map[key]].nil?
175
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
190
  end
177
191
  end
178
-
179
- self
192
+ new(transformed_hash)
180
193
  end
181
194
 
182
195
  # Deserializes the data based on type
183
196
  # @param string type Data type
184
197
  # @param string value Value to be deserialized
185
198
  # @return [Object] Deserialized data
186
- def _deserialize(type, value)
199
+ def self._deserialize(type, value)
187
200
  case type.to_sym
188
201
  when :Time
189
202
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -73,6 +73,7 @@ module Sendpost
73
73
  # Show invalid properties with the reasons. Usually used together with valid?
74
74
  # @return Array for valid properties with the reasons
75
75
  def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
76
77
  invalid_properties = Array.new
77
78
  invalid_properties
78
79
  end
@@ -80,6 +81,7 @@ module Sendpost
80
81
  # Check to see if the all the properties in the model are valid
81
82
  # @return true if the model is valid
82
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
85
  true
84
86
  end
85
87
 
@@ -108,37 +110,30 @@ module Sendpost
108
110
  # @param [Hash] attributes Model attributes in the form of hash
109
111
  # @return [Object] Returns the model itself
110
112
  def self.build_from_hash(attributes)
111
- new.build_from_hash(attributes)
112
- end
113
-
114
- # Builds the object from hash
115
- # @param [Hash] attributes Model attributes in the form of hash
116
- # @return [Object] Returns the model itself
117
- def build_from_hash(attributes)
118
113
  return nil unless attributes.is_a?(Hash)
119
114
  attributes = attributes.transform_keys(&:to_sym)
120
- self.class.openapi_types.each_pair do |key, type|
121
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
- self.send("#{key}=", nil)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
123
119
  elsif type =~ /\AArray<(.*)>/i
124
120
  # check to ensure the input is an array given that the attribute
125
121
  # is documented as an array but the input is not
126
- if attributes[self.class.attribute_map[key]].is_a?(Array)
127
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
128
124
  end
129
- elsif !attributes[self.class.attribute_map[key]].nil?
130
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
131
127
  end
132
128
  end
133
-
134
- self
129
+ new(transformed_hash)
135
130
  end
136
131
 
137
132
  # Deserializes the data based on type
138
133
  # @param string type Data type
139
134
  # @param string value Value to be deserialized
140
135
  # @return [Object] Deserialized data
141
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
142
137
  case type.to_sym
143
138
  when :Time
144
139
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -97,6 +97,7 @@ module Sendpost
97
97
  # Show invalid properties with the reasons. Usually used together with valid?
98
98
  # @return Array for valid properties with the reasons
99
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
101
  invalid_properties = Array.new
101
102
  invalid_properties
102
103
  end
@@ -104,6 +105,7 @@ module Sendpost
104
105
  # Check to see if the all the properties in the model are valid
105
106
  # @return true if the model is valid
106
107
  def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
109
  true
108
110
  end
109
111
 
@@ -135,37 +137,30 @@ module Sendpost
135
137
  # @param [Hash] attributes Model attributes in the form of hash
136
138
  # @return [Object] Returns the model itself
137
139
  def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
140
  return nil unless attributes.is_a?(Hash)
146
141
  attributes = attributes.transform_keys(&:to_sym)
147
- self.class.openapi_types.each_pair do |key, type|
148
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
- self.send("#{key}=", nil)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
150
146
  elsif type =~ /\AArray<(.*)>/i
151
147
  # check to ensure the input is an array given that the attribute
152
148
  # is documented as an array but the input is not
153
- if attributes[self.class.attribute_map[key]].is_a?(Array)
154
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
151
  end
156
- elsif !attributes[self.class.attribute_map[key]].nil?
157
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
154
  end
159
155
  end
160
-
161
- self
156
+ new(transformed_hash)
162
157
  end
163
158
 
164
159
  # Deserializes the data based on type
165
160
  # @param string type Data type
166
161
  # @param string value Value to be deserialized
167
162
  # @return [Object] Deserialized data
168
- def _deserialize(type, value)
163
+ def self._deserialize(type, value)
169
164
  case type.to_sym
170
165
  when :Time
171
166
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -281,6 +281,7 @@ module Sendpost
281
281
  # Show invalid properties with the reasons. Usually used together with valid?
282
282
  # @return Array for valid properties with the reasons
283
283
  def list_invalid_properties
284
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
284
285
  invalid_properties = Array.new
285
286
  invalid_properties
286
287
  end
@@ -288,6 +289,7 @@ module Sendpost
288
289
  # Check to see if the all the properties in the model are valid
289
290
  # @return true if the model is valid
290
291
  def valid?
292
+ warn '[DEPRECATED] the `valid?` method is obsolete'
291
293
  true
292
294
  end
293
295
 
@@ -341,37 +343,30 @@ module Sendpost
341
343
  # @param [Hash] attributes Model attributes in the form of hash
342
344
  # @return [Object] Returns the model itself
343
345
  def self.build_from_hash(attributes)
344
- new.build_from_hash(attributes)
345
- end
346
-
347
- # Builds the object from hash
348
- # @param [Hash] attributes Model attributes in the form of hash
349
- # @return [Object] Returns the model itself
350
- def build_from_hash(attributes)
351
346
  return nil unless attributes.is_a?(Hash)
352
347
  attributes = attributes.transform_keys(&:to_sym)
353
- self.class.openapi_types.each_pair do |key, type|
354
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
355
- self.send("#{key}=", nil)
348
+ transformed_hash = {}
349
+ openapi_types.each_pair do |key, type|
350
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
351
+ transformed_hash["#{key}"] = nil
356
352
  elsif type =~ /\AArray<(.*)>/i
357
353
  # check to ensure the input is an array given that the attribute
358
354
  # is documented as an array but the input is not
359
- if attributes[self.class.attribute_map[key]].is_a?(Array)
360
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
355
+ if attributes[attribute_map[key]].is_a?(Array)
356
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
361
357
  end
362
- elsif !attributes[self.class.attribute_map[key]].nil?
363
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
358
+ elsif !attributes[attribute_map[key]].nil?
359
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
364
360
  end
365
361
  end
366
-
367
- self
362
+ new(transformed_hash)
368
363
  end
369
364
 
370
365
  # Deserializes the data based on type
371
366
  # @param string type Data type
372
367
  # @param string value Value to be deserialized
373
368
  # @return [Object] Deserialized data
374
- def _deserialize(type, value)
369
+ def self._deserialize(type, value)
375
370
  case type.to_sym
376
371
  when :Time
377
372
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -163,6 +163,7 @@ module Sendpost
163
163
  # Show invalid properties with the reasons. Usually used together with valid?
164
164
  # @return Array for valid properties with the reasons
165
165
  def list_invalid_properties
166
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
166
167
  invalid_properties = Array.new
167
168
  invalid_properties
168
169
  end
@@ -170,6 +171,7 @@ module Sendpost
170
171
  # Check to see if the all the properties in the model are valid
171
172
  # @return true if the model is valid
172
173
  def valid?
174
+ warn '[DEPRECATED] the `valid?` method is obsolete'
173
175
  true
174
176
  end
175
177
 
@@ -209,37 +211,30 @@ module Sendpost
209
211
  # @param [Hash] attributes Model attributes in the form of hash
210
212
  # @return [Object] Returns the model itself
211
213
  def self.build_from_hash(attributes)
212
- new.build_from_hash(attributes)
213
- end
214
-
215
- # Builds the object from hash
216
- # @param [Hash] attributes Model attributes in the form of hash
217
- # @return [Object] Returns the model itself
218
- def build_from_hash(attributes)
219
214
  return nil unless attributes.is_a?(Hash)
220
215
  attributes = attributes.transform_keys(&:to_sym)
221
- self.class.openapi_types.each_pair do |key, type|
222
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
- self.send("#{key}=", nil)
216
+ transformed_hash = {}
217
+ openapi_types.each_pair do |key, type|
218
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = nil
224
220
  elsif type =~ /\AArray<(.*)>/i
225
221
  # check to ensure the input is an array given that the attribute
226
222
  # is documented as an array but the input is not
227
- if attributes[self.class.attribute_map[key]].is_a?(Array)
228
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
223
+ if attributes[attribute_map[key]].is_a?(Array)
224
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
229
225
  end
230
- elsif !attributes[self.class.attribute_map[key]].nil?
231
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ elsif !attributes[attribute_map[key]].nil?
227
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
232
228
  end
233
229
  end
234
-
235
- self
230
+ new(transformed_hash)
236
231
  end
237
232
 
238
233
  # Deserializes the data based on type
239
234
  # @param string type Data type
240
235
  # @param string value Value to be deserialized
241
236
  # @return [Object] Deserialized data
242
- def _deserialize(type, value)
237
+ def self._deserialize(type, value)
243
238
  case type.to_sym
244
239
  when :Time
245
240
  Time.parse(value)
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #SendPost API
3
+
4
+ #Email API and SMTP relay to not just send and measure email sending, but also alert and optimise. We provide you with tools, expertise and support needed to reliably deliver emails to your customers inboxes on time, every time.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hello@sendpost.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendpost
17
+ class RSuppression
18
+ attr_accessor :hard_bounce
19
+
20
+ attr_accessor :manual
21
+
22
+ attr_accessor :spam_complaint
23
+
24
+ attr_accessor :unsubscribe
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'hard_bounce' => :'hardBounce',
30
+ :'manual' => :'manual',
31
+ :'spam_complaint' => :'spamComplaint',
32
+ :'unsubscribe' => :'unsubscribe'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'hard_bounce' => :'Array<SuppressionEmail>',
45
+ :'manual' => :'Array<SuppressionEmail>',
46
+ :'spam_complaint' => :'Array<SuppressionEmail>',
47
+ :'unsubscribe' => :'Array<SuppressionEmail>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::RSuppression` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::RSuppression`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'hard_bounce')
73
+ if (value = attributes[:'hard_bounce']).is_a?(Array)
74
+ self.hard_bounce = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'manual')
79
+ if (value = attributes[:'manual']).is_a?(Array)
80
+ self.manual = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'spam_complaint')
85
+ if (value = attributes[:'spam_complaint']).is_a?(Array)
86
+ self.spam_complaint = value
87
+ end
88
+ end
89
+
90
+ if attributes.key?(:'unsubscribe')
91
+ if (value = attributes[:'unsubscribe']).is_a?(Array)
92
+ self.unsubscribe = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ hard_bounce == o.hard_bounce &&
118
+ manual == o.manual &&
119
+ spam_complaint == o.spam_complaint &&
120
+ unsubscribe == o.unsubscribe
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [hard_bounce, manual, spam_complaint, unsubscribe].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Sendpost.const_get(type)
197
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end