messente_api 1.1.0 → 1.2.0

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +11 -3
  4. data/docs/ErrorCodeStatistics.md +16 -0
  5. data/docs/ErrorItemNumberLookup.md +17 -0
  6. data/docs/ErrorItemNumberLookupError.md +19 -0
  7. data/docs/ErrorItemStatistics.md +21 -0
  8. data/docs/ErrorNumberLookup.md +17 -0
  9. data/docs/ErrorStatistics.md +17 -0
  10. data/docs/MobileNetwork.md +25 -0
  11. data/docs/NumberLookupApi.md +60 -0
  12. data/docs/NumbersToInvestigate.md +17 -0
  13. data/docs/StatisticsApi.md +60 -0
  14. data/docs/StatisticsReport.md +21 -0
  15. data/docs/StatisticsReportSettings.md +21 -0
  16. data/docs/StatisticsReportSuccess.md +17 -0
  17. data/docs/SyncNumberLookupResult.md +33 -0
  18. data/docs/SyncNumberLookupSuccess.md +19 -0
  19. data/lib/messente_api.rb +17 -2
  20. data/lib/messente_api/api/blacklist_api.rb +2 -2
  21. data/lib/messente_api/api/contacts_api.rb +2 -2
  22. data/lib/messente_api/api/delivery_report_api.rb +2 -2
  23. data/lib/messente_api/api/groups_api.rb +2 -2
  24. data/lib/messente_api/api/number_lookup_api.rb +84 -0
  25. data/lib/messente_api/api/omnimessage_api.rb +2 -2
  26. data/lib/messente_api/api/statistics_api.rb +84 -0
  27. data/lib/messente_api/api_client.rb +2 -2
  28. data/lib/messente_api/api_error.rb +2 -2
  29. data/lib/messente_api/configuration.rb +2 -2
  30. data/lib/messente_api/models/channel.rb +2 -2
  31. data/lib/messente_api/models/contact_envelope.rb +2 -2
  32. data/lib/messente_api/models/contact_fields.rb +2 -2
  33. data/lib/messente_api/models/contact_list_envelope.rb +2 -2
  34. data/lib/messente_api/models/contact_update_fields.rb +2 -2
  35. data/lib/messente_api/models/delivery_report_response.rb +2 -2
  36. data/lib/messente_api/models/delivery_result.rb +2 -2
  37. data/lib/messente_api/models/error_code_omnichannel.rb +2 -2
  38. data/lib/messente_api/models/error_code_omnichannel_machine.rb +2 -2
  39. data/lib/messente_api/models/error_code_phonebook.rb +2 -2
  40. data/lib/messente_api/models/error_code_statistics.rb +38 -0
  41. data/lib/messente_api/models/error_item_number_lookup.rb +202 -0
  42. data/lib/messente_api/models/error_item_number_lookup_error.rb +246 -0
  43. data/lib/messente_api/models/error_item_omnichannel.rb +2 -2
  44. data/lib/messente_api/models/error_item_phonebook.rb +2 -2
  45. data/lib/messente_api/models/error_item_statistics.rb +232 -0
  46. data/lib/messente_api/models/error_number_lookup.rb +205 -0
  47. data/lib/messente_api/models/error_omnichannel.rb +2 -2
  48. data/lib/messente_api/models/error_phonebook.rb +2 -2
  49. data/lib/messente_api/models/error_statistics.rb +205 -0
  50. data/lib/messente_api/models/error_title_omnichannel.rb +2 -2
  51. data/lib/messente_api/models/error_title_phonebook.rb +2 -2
  52. data/lib/messente_api/models/fetch_blacklist_success.rb +2 -2
  53. data/lib/messente_api/models/group_envelope.rb +2 -2
  54. data/lib/messente_api/models/group_list_envelope.rb +2 -2
  55. data/lib/messente_api/models/group_name.rb +2 -2
  56. data/lib/messente_api/models/group_response_fields.rb +2 -2
  57. data/lib/messente_api/models/message_result.rb +2 -2
  58. data/lib/messente_api/models/mobile_network.rb +238 -0
  59. data/lib/messente_api/models/number_to_blacklist.rb +2 -2
  60. data/lib/messente_api/models/numbers_to_investigate.rb +205 -0
  61. data/lib/messente_api/models/omni_message_create_success_response.rb +2 -2
  62. data/lib/messente_api/models/omnimessage.rb +2 -2
  63. data/lib/messente_api/models/sms.rb +2 -2
  64. data/lib/messente_api/models/statistics_report.rb +233 -0
  65. data/lib/messente_api/models/statistics_report_settings.rb +230 -0
  66. data/lib/messente_api/models/statistics_report_success.rb +205 -0
  67. data/lib/messente_api/models/status.rb +2 -2
  68. data/lib/messente_api/models/sync_number_lookup_result.rb +313 -0
  69. data/lib/messente_api/models/sync_number_lookup_success.rb +220 -0
  70. data/lib/messente_api/models/telegram.rb +2 -2
  71. data/lib/messente_api/models/text_store.rb +2 -2
  72. data/lib/messente_api/models/viber.rb +2 -2
  73. data/lib/messente_api/models/whats_app.rb +2 -2
  74. data/lib/messente_api/models/whats_app_audio.rb +2 -2
  75. data/lib/messente_api/models/whats_app_document.rb +2 -2
  76. data/lib/messente_api/models/whats_app_image.rb +2 -2
  77. data/lib/messente_api/models/whats_app_text.rb +2 -2
  78. data/lib/messente_api/version.rb +3 -3
  79. data/messente_api.gemspec +3 -3
  80. data/spec/api_client_spec.rb +2 -2
  81. data/spec/configuration_spec.rb +2 -2
  82. data/spec/spec_helper.rb +2 -2
  83. metadata +38 -7
@@ -0,0 +1,230 @@
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.2.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # A container for statistics report settings
17
+ class StatisticsReportSettings
18
+ # Start date for the report
19
+ attr_accessor :start_date
20
+
21
+ # End date for the report
22
+ attr_accessor :end_date
23
+
24
+ # Optional list of message types (sms, viber, whatsapp, hlr)
25
+ attr_accessor :message_types
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'start_date' => :'start_date',
31
+ :'end_date' => :'end_date',
32
+ :'message_types' => :'message_types'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'start_date' => :'Date',
40
+ :'end_date' => :'Date',
41
+ :'message_types' => :'Array<String>'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::StatisticsReportSettings` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::StatisticsReportSettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'start_date')
61
+ self.start_date = attributes[:'start_date']
62
+ end
63
+
64
+ if attributes.key?(:'end_date')
65
+ self.end_date = attributes[:'end_date']
66
+ end
67
+
68
+ if attributes.key?(:'message_types')
69
+ if (value = attributes[:'message_types']).is_a?(Array)
70
+ self.message_types = value
71
+ end
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @start_date.nil?
80
+ invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
81
+ end
82
+
83
+ if @end_date.nil?
84
+ invalid_properties.push('invalid value for "end_date", end_date cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @start_date.nil?
94
+ return false if @end_date.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ start_date == o.start_date &&
104
+ end_date == o.end_date &&
105
+ message_types == o.message_types
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [start_date, end_date, message_types].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ MessenteApi.const_get(type).build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ next if value.nil?
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,205 @@
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.2.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # A container for statistics reports
17
+ class StatisticsReportSuccess
18
+ # Array of report objects
19
+ attr_accessor :reports
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'reports' => :'reports'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'reports' => :'Array<StatisticsReport>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ if (!attributes.is_a?(Hash))
39
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::StatisticsReportSuccess` initialize method"
40
+ end
41
+
42
+ # check to see if the attribute exists and convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h|
44
+ if (!self.class.attribute_map.key?(k.to_sym))
45
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::StatisticsReportSuccess`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
46
+ end
47
+ h[k.to_sym] = v
48
+ }
49
+
50
+ if attributes.key?(:'reports')
51
+ if (value = attributes[:'reports']).is_a?(Array)
52
+ self.reports = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @reports.nil?
62
+ invalid_properties.push('invalid value for "reports", reports cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @reports.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ reports == o.reports
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [reports].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :Boolean
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ MessenteApi.const_get(type).build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
@@ -1,9 +1,9 @@
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.2.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.0.3
@@ -0,0 +1,313 @@
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.2.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ # Info about a phone number
17
+ class SyncNumberLookupResult
18
+ # Phone number in e.164 format
19
+ attr_accessor :number
20
+
21
+ # Indicates if a number is roaming
22
+ attr_accessor :roaming
23
+
24
+ # Indicates if a number is ported
25
+ attr_accessor :ported
26
+
27
+ attr_accessor :roaming_network
28
+
29
+ attr_accessor :current_network
30
+
31
+ attr_accessor :original_network
32
+
33
+ attr_accessor :ported_network
34
+
35
+ # Status of the phone number
36
+ attr_accessor :status
37
+
38
+ # Indicates if any error occurred while handling the request
39
+ attr_accessor :error
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'number' => :'number',
67
+ :'roaming' => :'roaming',
68
+ :'ported' => :'ported',
69
+ :'roaming_network' => :'roamingNetwork',
70
+ :'current_network' => :'currentNetwork',
71
+ :'original_network' => :'originalNetwork',
72
+ :'ported_network' => :'portedNetwork',
73
+ :'status' => :'status',
74
+ :'error' => :'error'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'number' => :'String',
82
+ :'roaming' => :'Boolean',
83
+ :'ported' => :'Boolean',
84
+ :'roaming_network' => :'MobileNetwork',
85
+ :'current_network' => :'MobileNetwork',
86
+ :'original_network' => :'MobileNetwork',
87
+ :'ported_network' => :'MobileNetwork',
88
+ :'status' => :'String',
89
+ :'error' => :'Object'
90
+ }
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::SyncNumberLookupResult` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::SyncNumberLookupResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'number')
109
+ self.number = attributes[:'number']
110
+ end
111
+
112
+ if attributes.key?(:'roaming')
113
+ self.roaming = attributes[:'roaming']
114
+ end
115
+
116
+ if attributes.key?(:'ported')
117
+ self.ported = attributes[:'ported']
118
+ end
119
+
120
+ if attributes.key?(:'roaming_network')
121
+ self.roaming_network = attributes[:'roaming_network']
122
+ end
123
+
124
+ if attributes.key?(:'current_network')
125
+ self.current_network = attributes[:'current_network']
126
+ end
127
+
128
+ if attributes.key?(:'original_network')
129
+ self.original_network = attributes[:'original_network']
130
+ end
131
+
132
+ if attributes.key?(:'ported_network')
133
+ self.ported_network = attributes[:'ported_network']
134
+ end
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ end
139
+
140
+ if attributes.key?(:'error')
141
+ self.error = attributes[:'error']
142
+ end
143
+ end
144
+
145
+ # Show invalid properties with the reasons. Usually used together with valid?
146
+ # @return Array for valid properties with the reasons
147
+ def list_invalid_properties
148
+ invalid_properties = Array.new
149
+ if @number.nil?
150
+ invalid_properties.push('invalid value for "number", number cannot be nil.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return false if @number.nil?
160
+ status_validator = EnumAttributeValidator.new('String', ["ON", "OFF", "INVALID", "UNKNOWN"])
161
+ return false unless status_validator.valid?(@status)
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] status Object to be assigned
167
+ def status=(status)
168
+ validator = EnumAttributeValidator.new('String', ["ON", "OFF", "INVALID", "UNKNOWN"])
169
+ unless validator.valid?(status)
170
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
171
+ end
172
+ @status = status
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(o)
178
+ return true if self.equal?(o)
179
+ self.class == o.class &&
180
+ number == o.number &&
181
+ roaming == o.roaming &&
182
+ ported == o.ported &&
183
+ roaming_network == o.roaming_network &&
184
+ current_network == o.current_network &&
185
+ original_network == o.original_network &&
186
+ ported_network == o.ported_network &&
187
+ status == o.status &&
188
+ error == o.error
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [number, roaming, ported, roaming_network, current_network, original_network, ported_network, status, error].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.openapi_types.each_pair do |key, type|
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
+ end
222
+ elsif !attributes[self.class.attribute_map[key]].nil?
223
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+
230
+ # Deserializes the data based on type
231
+ # @param string type Data type
232
+ # @param string value Value to be deserialized
233
+ # @return [Object] Deserialized data
234
+ def _deserialize(type, value)
235
+ case type.to_sym
236
+ when :DateTime
237
+ DateTime.parse(value)
238
+ when :Date
239
+ Date.parse(value)
240
+ when :String
241
+ value.to_s
242
+ when :Integer
243
+ value.to_i
244
+ when :Float
245
+ value.to_f
246
+ when :Boolean
247
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
248
+ true
249
+ else
250
+ false
251
+ end
252
+ when :Object
253
+ # generic object (usually a Hash), return directly
254
+ value
255
+ when /\AArray<(?<inner_type>.+)>\z/
256
+ inner_type = Regexp.last_match[:inner_type]
257
+ value.map { |v| _deserialize(inner_type, v) }
258
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
259
+ k_type = Regexp.last_match[:k_type]
260
+ v_type = Regexp.last_match[:v_type]
261
+ {}.tap do |hash|
262
+ value.each do |k, v|
263
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
264
+ end
265
+ end
266
+ else # model
267
+ MessenteApi.const_get(type).build_from_hash(value)
268
+ end
269
+ end
270
+
271
+ # Returns the string representation of the object
272
+ # @return [String] String presentation of the object
273
+ def to_s
274
+ to_hash.to_s
275
+ end
276
+
277
+ # to_body is an alias to to_hash (backward compatibility)
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_body
280
+ to_hash
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ next if value.nil?
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+ end
313
+ end