messente_api 1.1.0 → 1.3.1

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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +11 -3
  4. data/docs/ContactEnvelope.md +1 -1
  5. data/docs/ContactListEnvelope.md +1 -1
  6. data/docs/ContactResponseFields.md +37 -0
  7. data/docs/ErrorCodeStatistics.md +16 -0
  8. data/docs/ErrorItemNumberLookup.md +17 -0
  9. data/docs/ErrorItemNumberLookupError.md +19 -0
  10. data/docs/ErrorItemStatistics.md +21 -0
  11. data/docs/ErrorNumberLookup.md +17 -0
  12. data/docs/ErrorStatistics.md +17 -0
  13. data/docs/MobileNetwork.md +25 -0
  14. data/docs/NumberLookupApi.md +60 -0
  15. data/docs/NumbersToInvestigate.md +17 -0
  16. data/docs/OmnimessageApi.md +4 -3
  17. data/docs/StatisticsApi.md +60 -0
  18. data/docs/StatisticsReport.md +21 -0
  19. data/docs/StatisticsReportSettings.md +21 -0
  20. data/docs/StatisticsReportSuccess.md +17 -0
  21. data/docs/SyncNumberLookupResult.md +33 -0
  22. data/docs/SyncNumberLookupSuccess.md +19 -0
  23. data/git_push.sh +10 -7
  24. data/lib/messente_api.rb +19 -3
  25. data/lib/messente_api/api/blacklist_api.rb +3 -3
  26. data/lib/messente_api/api/contacts_api.rb +3 -3
  27. data/lib/messente_api/api/delivery_report_api.rb +3 -3
  28. data/lib/messente_api/api/groups_api.rb +3 -3
  29. data/lib/messente_api/api/number_lookup_api.rb +84 -0
  30. data/lib/messente_api/api/omnimessage_api.rb +8 -8
  31. data/lib/messente_api/api/statistics_api.rb +84 -0
  32. data/lib/messente_api/api_client.rb +38 -36
  33. data/lib/messente_api/api_error.rb +3 -3
  34. data/lib/messente_api/configuration.rb +4 -4
  35. data/lib/messente_api/models/channel.rb +3 -3
  36. data/lib/messente_api/models/contact_envelope.rb +15 -5
  37. data/lib/messente_api/models/contact_fields.rb +24 -5
  38. data/lib/messente_api/models/contact_list_envelope.rb +15 -5
  39. data/lib/messente_api/models/contact_response_fields.rb +318 -0
  40. data/lib/messente_api/models/contact_update_fields.rb +23 -4
  41. data/lib/messente_api/models/delivery_report_response.rb +14 -4
  42. data/lib/messente_api/models/delivery_result.rb +14 -4
  43. data/lib/messente_api/models/error_code_omnichannel.rb +3 -3
  44. data/lib/messente_api/models/error_code_omnichannel_machine.rb +3 -3
  45. data/lib/messente_api/models/error_code_phonebook.rb +3 -3
  46. data/lib/messente_api/models/error_code_statistics.rb +38 -0
  47. data/lib/messente_api/models/error_item_number_lookup.rb +212 -0
  48. data/lib/messente_api/models/error_item_number_lookup_error.rb +256 -0
  49. data/lib/messente_api/models/error_item_omnichannel.rb +15 -9
  50. data/lib/messente_api/models/error_item_phonebook.rb +14 -4
  51. data/lib/messente_api/models/error_item_statistics.rb +242 -0
  52. data/lib/messente_api/models/error_number_lookup.rb +215 -0
  53. data/lib/messente_api/models/error_omnichannel.rb +14 -4
  54. data/lib/messente_api/models/error_phonebook.rb +14 -4
  55. data/lib/messente_api/models/error_statistics.rb +215 -0
  56. data/lib/messente_api/models/error_title_omnichannel.rb +3 -3
  57. data/lib/messente_api/models/error_title_phonebook.rb +3 -3
  58. data/lib/messente_api/models/fetch_blacklist_success.rb +14 -4
  59. data/lib/messente_api/models/group_envelope.rb +14 -4
  60. data/lib/messente_api/models/group_list_envelope.rb +14 -4
  61. data/lib/messente_api/models/group_name.rb +14 -4
  62. data/lib/messente_api/models/group_response_fields.rb +15 -4
  63. data/lib/messente_api/models/message_result.rb +14 -4
  64. data/lib/messente_api/models/mobile_network.rb +248 -0
  65. data/lib/messente_api/models/number_to_blacklist.rb +14 -4
  66. data/lib/messente_api/models/numbers_to_investigate.rb +215 -0
  67. data/lib/messente_api/models/omni_message_create_success_response.rb +14 -4
  68. data/lib/messente_api/models/omnimessage.rb +14 -4
  69. data/lib/messente_api/models/sms.rb +14 -4
  70. data/lib/messente_api/models/statistics_report.rb +243 -0
  71. data/lib/messente_api/models/statistics_report_settings.rb +240 -0
  72. data/lib/messente_api/models/statistics_report_success.rb +215 -0
  73. data/lib/messente_api/models/status.rb +3 -3
  74. data/lib/messente_api/models/sync_number_lookup_result.rb +329 -0
  75. data/lib/messente_api/models/sync_number_lookup_success.rb +230 -0
  76. data/lib/messente_api/models/telegram.rb +14 -4
  77. data/lib/messente_api/models/text_store.rb +3 -3
  78. data/lib/messente_api/models/viber.rb +14 -4
  79. data/lib/messente_api/models/whats_app.rb +14 -4
  80. data/lib/messente_api/models/whats_app_audio.rb +14 -4
  81. data/lib/messente_api/models/whats_app_document.rb +14 -4
  82. data/lib/messente_api/models/whats_app_image.rb +14 -4
  83. data/lib/messente_api/models/whats_app_text.rb +14 -4
  84. data/lib/messente_api/version.rb +4 -4
  85. data/messente_api-1.3.0.gem +0 -0
  86. data/messente_api.gemspec +4 -10
  87. data/spec/api_client_spec.rb +4 -4
  88. data/spec/configuration_spec.rb +3 -3
  89. data/spec/spec_helper.rb +3 -3
  90. metadata +49 -136
  91. data/Gemfile.lock +0 -79
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -127,6 +127,34 @@ module MessenteApi
127
127
  request
128
128
  end
129
129
 
130
+ # Builds the HTTP request body
131
+ #
132
+ # @param [Hash] header_params Header parameters
133
+ # @param [Hash] form_params Query parameters
134
+ # @param [Object] body HTTP body (JSON/XML)
135
+ # @return [String] HTTP body data in the form of string
136
+ def build_request_body(header_params, form_params, body)
137
+ # http form
138
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
139
+ header_params['Content-Type'] == 'multipart/form-data'
140
+ data = {}
141
+ form_params.each do |key, value|
142
+ case value
143
+ when ::File, ::Array, nil
144
+ # let typhoeus handle File, Array and nil parameters
145
+ data[key] = value
146
+ else
147
+ data[key] = value.to_s
148
+ end
149
+ end
150
+ elsif body
151
+ data = body.is_a?(String) ? body : body.to_json
152
+ else
153
+ data = nil
154
+ end
155
+ data
156
+ end
157
+
130
158
  # Check if the given MIME is a JSON MIME.
131
159
  # JSON MIME examples:
132
160
  # application/json
@@ -241,11 +269,13 @@ module MessenteApi
241
269
  tempfile.write(chunk)
242
270
  end
243
271
  request.on_complete do |response|
244
- tempfile.close if tempfile
245
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
246
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
247
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
248
- "explicitly with `tempfile.delete`"
272
+ if tempfile
273
+ tempfile.close
274
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
275
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
276
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
277
+ "explicitly with `tempfile.delete`"
278
+ end
249
279
  end
250
280
  end
251
281
 
@@ -264,34 +294,6 @@ module MessenteApi
264
294
  @config.base_url + path
265
295
  end
266
296
 
267
- # Builds the HTTP request body
268
- #
269
- # @param [Hash] header_params Header parameters
270
- # @param [Hash] form_params Query parameters
271
- # @param [Object] body HTTP body (JSON/XML)
272
- # @return [String] HTTP body data in the form of string
273
- def build_request_body(header_params, form_params, body)
274
- # http form
275
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
276
- header_params['Content-Type'] == 'multipart/form-data'
277
- data = {}
278
- form_params.each do |key, value|
279
- case value
280
- when ::File, ::Array, nil
281
- # let typhoeus handle File, Array and nil parameters
282
- data[key] = value
283
- else
284
- data[key] = value.to_s
285
- end
286
- end
287
- elsif body
288
- data = body.is_a?(String) ? body : body.to_json
289
- else
290
- data = nil
291
- end
292
- data
293
- end
294
-
295
297
  # Update hearder and query params based on authentication settings.
296
298
  #
297
299
  # @param [Hash] header_params Header parameters
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -208,7 +208,7 @@ module MessenteApi
208
208
  [
209
209
  {
210
210
  url: "https://api.messente.com/v1",
211
- description: "No descriptoin provided",
211
+ description: "No description provided",
212
212
  }
213
213
  ]
214
214
  end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -27,10 +27,16 @@ module MessenteApi
27
27
  # Attribute type mapping.
28
28
  def self.openapi_types
29
29
  {
30
- :'contact' => :'ContactFields'
30
+ :'contact' => :'ContactResponseFields'
31
31
  }
32
32
  end
33
33
 
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
34
40
  # Initializes the object
35
41
  # @param [Hash] attributes Model attributes in the form of hash
36
42
  def initialize(attributes = {})
@@ -170,7 +176,11 @@ module MessenteApi
170
176
  hash = {}
171
177
  self.class.attribute_map.each_pair do |attr, param|
172
178
  value = self.send(attr)
173
- next if value.nil?
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
174
184
  hash[param] = _to_hash(value)
175
185
  end
176
186
  hash
@@ -1,19 +1,19 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module MessenteApi
16
- # A container for fields of a contact
16
+ # A container for fields of a request body of a contact
17
17
  class ContactFields
18
18
  # Phone number in e.164 format
19
19
  attr_accessor :phone_number
@@ -77,6 +77,21 @@ module MessenteApi
77
77
  }
78
78
  end
79
79
 
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ :'email',
84
+ :'first_name',
85
+ :'last_name',
86
+ :'company',
87
+ :'title',
88
+ :'custom',
89
+ :'custom2',
90
+ :'custom3',
91
+ :'custom4'
92
+ ])
93
+ end
94
+
80
95
  # Initializes the object
81
96
  # @param [Hash] attributes Model attributes in the form of hash
82
97
  def initialize(attributes = {})
@@ -266,7 +281,11 @@ module MessenteApi
266
281
  hash = {}
267
282
  self.class.attribute_map.each_pair do |attr, param|
268
283
  value = self.send(attr)
269
- next if value.nil?
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
270
289
  hash[param] = _to_hash(value)
271
290
  end
272
291
  hash
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Messente API
3
3
 
4
- #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber, WhatsApp and Telegram messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.1.0
6
+ The version of the OpenAPI document: 1.3.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.0.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -28,10 +28,16 @@ module MessenteApi
28
28
  # Attribute type mapping.
29
29
  def self.openapi_types
30
30
  {
31
- :'contacts' => :'Array<ContactFields>'
31
+ :'contacts' => :'Array<ContactResponseFields>'
32
32
  }
33
33
  end
34
34
 
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
35
41
  # Initializes the object
36
42
  # @param [Hash] attributes Model attributes in the form of hash
37
43
  def initialize(attributes = {})
@@ -173,7 +179,11 @@ module MessenteApi
173
179
  hash = {}
174
180
  self.class.attribute_map.each_pair do |attr, param|
175
181
  value = self.send(attr)
176
- next if value.nil?
182
+ if value.nil?
183
+ is_nullable = self.class.openapi_nullable.include?(attr)
184
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
+ end
186
+
177
187
  hash[param] = _to_hash(value)
178
188
  end
179
189
  hash
@@ -0,0 +1,318 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 1.3.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # A container for response fields of a contact
17
+ class ContactResponseFields
18
+ # Phone number in e.164 format
19
+ attr_accessor :phone_number
20
+
21
+ # The email of the contact
22
+ attr_accessor :email
23
+
24
+ # The first name of the contact
25
+ attr_accessor :first_name
26
+
27
+ # The last name of the contact
28
+ attr_accessor :last_name
29
+
30
+ # The company of the contact
31
+ attr_accessor :company
32
+
33
+ # The title of the contact
34
+ attr_accessor :title
35
+
36
+ # The first custom field
37
+ attr_accessor :custom
38
+
39
+ # The second custom field
40
+ attr_accessor :custom2
41
+
42
+ # The third custom field
43
+ attr_accessor :custom3
44
+
45
+ # The fourth custom field
46
+ attr_accessor :custom4
47
+
48
+ # The date in ISO 8601 format, YYYY-MM-DD, on which the contact is going to be deleted because it has not belonged to a group for 30 days
49
+ attr_accessor :scheduled_deletion_date
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'phone_number' => :'phoneNumber',
55
+ :'email' => :'email',
56
+ :'first_name' => :'firstName',
57
+ :'last_name' => :'lastName',
58
+ :'company' => :'company',
59
+ :'title' => :'title',
60
+ :'custom' => :'custom',
61
+ :'custom2' => :'custom2',
62
+ :'custom3' => :'custom3',
63
+ :'custom4' => :'custom4',
64
+ :'scheduled_deletion_date' => :'scheduledDeletionDate'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'phone_number' => :'String',
72
+ :'email' => :'String',
73
+ :'first_name' => :'String',
74
+ :'last_name' => :'String',
75
+ :'company' => :'String',
76
+ :'title' => :'String',
77
+ :'custom' => :'String',
78
+ :'custom2' => :'String',
79
+ :'custom3' => :'String',
80
+ :'custom4' => :'String',
81
+ :'scheduled_deletion_date' => :'Date'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ :'email',
89
+ :'first_name',
90
+ :'last_name',
91
+ :'company',
92
+ :'title',
93
+ :'custom',
94
+ :'custom2',
95
+ :'custom3',
96
+ :'custom4',
97
+ :'scheduled_deletion_date'
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ContactResponseFields` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ContactResponseFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'phone_number')
117
+ self.phone_number = attributes[:'phone_number']
118
+ end
119
+
120
+ if attributes.key?(:'email')
121
+ self.email = attributes[:'email']
122
+ end
123
+
124
+ if attributes.key?(:'first_name')
125
+ self.first_name = attributes[:'first_name']
126
+ end
127
+
128
+ if attributes.key?(:'last_name')
129
+ self.last_name = attributes[:'last_name']
130
+ end
131
+
132
+ if attributes.key?(:'company')
133
+ self.company = attributes[:'company']
134
+ end
135
+
136
+ if attributes.key?(:'title')
137
+ self.title = attributes[:'title']
138
+ end
139
+
140
+ if attributes.key?(:'custom')
141
+ self.custom = attributes[:'custom']
142
+ end
143
+
144
+ if attributes.key?(:'custom2')
145
+ self.custom2 = attributes[:'custom2']
146
+ end
147
+
148
+ if attributes.key?(:'custom3')
149
+ self.custom3 = attributes[:'custom3']
150
+ end
151
+
152
+ if attributes.key?(:'custom4')
153
+ self.custom4 = attributes[:'custom4']
154
+ end
155
+
156
+ if attributes.key?(:'scheduled_deletion_date')
157
+ self.scheduled_deletion_date = attributes[:'scheduled_deletion_date']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ true
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ phone_number == o.phone_number &&
180
+ email == o.email &&
181
+ first_name == o.first_name &&
182
+ last_name == o.last_name &&
183
+ company == o.company &&
184
+ title == o.title &&
185
+ custom == o.custom &&
186
+ custom2 == o.custom2 &&
187
+ custom3 == o.custom3 &&
188
+ custom4 == o.custom4 &&
189
+ scheduled_deletion_date == o.scheduled_deletion_date
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [phone_number, email, first_name, last_name, company, title, custom, custom2, custom3, custom4, scheduled_deletion_date].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ new.build_from_hash(attributes)
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ self.class.openapi_types.each_pair do |key, type|
217
+ if type =~ /\AArray<(.*)>/i
218
+ # check to ensure the input is an array given that the attribute
219
+ # is documented as an array but the input is not
220
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
221
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
226
+ end
227
+
228
+ self
229
+ end
230
+
231
+ # Deserializes the data based on type
232
+ # @param string type Data type
233
+ # @param string value Value to be deserialized
234
+ # @return [Object] Deserialized data
235
+ def _deserialize(type, value)
236
+ case type.to_sym
237
+ when :DateTime
238
+ DateTime.parse(value)
239
+ when :Date
240
+ Date.parse(value)
241
+ when :String
242
+ value.to_s
243
+ when :Integer
244
+ value.to_i
245
+ when :Float
246
+ value.to_f
247
+ when :Boolean
248
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
249
+ true
250
+ else
251
+ false
252
+ end
253
+ when :Object
254
+ # generic object (usually a Hash), return directly
255
+ value
256
+ when /\AArray<(?<inner_type>.+)>\z/
257
+ inner_type = Regexp.last_match[:inner_type]
258
+ value.map { |v| _deserialize(inner_type, v) }
259
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
260
+ k_type = Regexp.last_match[:k_type]
261
+ v_type = Regexp.last_match[:v_type]
262
+ {}.tap do |hash|
263
+ value.each do |k, v|
264
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
265
+ end
266
+ end
267
+ else # model
268
+ MessenteApi.const_get(type).build_from_hash(value)
269
+ end
270
+ end
271
+
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+
278
+ # to_body is an alias to to_hash (backward compatibility)
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ if value.nil?
291
+ is_nullable = self.class.openapi_nullable.include?(attr)
292
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
+ end
294
+
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ # Outputs non-array value in the form of hash
301
+ # For object, use to_hash. Otherwise, just return the value
302
+ # @param [Object] value Any valid value
303
+ # @return [Hash] Returns the value in the form of hash
304
+ def _to_hash(value)
305
+ if value.is_a?(Array)
306
+ value.compact.map { |v| _to_hash(v) }
307
+ elsif value.is_a?(Hash)
308
+ {}.tap do |hash|
309
+ value.each { |k, v| hash[k] = _to_hash(v) }
310
+ end
311
+ elsif value.respond_to? :to_hash
312
+ value.to_hash
313
+ else
314
+ value
315
+ end
316
+ end
317
+ end
318
+ end