messente_api 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/docs/ContactEnvelope.md +1 -1
- data/docs/ContactListEnvelope.md +1 -1
- data/docs/ContactResponseFields.md +37 -0
- data/docs/Omnimessage.md +3 -1
- data/docs/OmnimessageApi.md +4 -3
- data/docs/Priority.md +16 -0
- data/docs/StatisticsReportSettings.md +1 -1
- data/docs/SyncNumberLookupResult.md +1 -1
- data/git_push.sh +10 -7
- data/lib/messente_api.rb +4 -2
- data/lib/messente_api/api/blacklist_api.rb +2 -2
- data/lib/messente_api/api/contacts_api.rb +2 -2
- data/lib/messente_api/api/delivery_report_api.rb +2 -2
- data/lib/messente_api/api/groups_api.rb +2 -2
- data/lib/messente_api/api/number_lookup_api.rb +2 -2
- data/lib/messente_api/api/omnimessage_api.rb +7 -7
- data/lib/messente_api/api/statistics_api.rb +2 -2
- data/lib/messente_api/api_client.rb +37 -35
- data/lib/messente_api/api_error.rb +2 -2
- data/lib/messente_api/configuration.rb +3 -3
- data/lib/messente_api/models/channel.rb +2 -2
- data/lib/messente_api/models/contact_envelope.rb +14 -4
- data/lib/messente_api/models/contact_fields.rb +23 -4
- data/lib/messente_api/models/contact_list_envelope.rb +14 -4
- data/lib/messente_api/models/contact_response_fields.rb +318 -0
- data/lib/messente_api/models/contact_update_fields.rb +22 -3
- data/lib/messente_api/models/delivery_report_response.rb +13 -3
- data/lib/messente_api/models/delivery_result.rb +13 -3
- data/lib/messente_api/models/error_code_omnichannel.rb +2 -2
- data/lib/messente_api/models/error_code_omnichannel_machine.rb +2 -2
- data/lib/messente_api/models/error_code_phonebook.rb +2 -2
- data/lib/messente_api/models/error_code_statistics.rb +2 -2
- data/lib/messente_api/models/error_item_number_lookup.rb +13 -3
- data/lib/messente_api/models/error_item_number_lookup_error.rb +13 -3
- data/lib/messente_api/models/error_item_omnichannel.rb +14 -8
- data/lib/messente_api/models/error_item_phonebook.rb +13 -3
- data/lib/messente_api/models/error_item_statistics.rb +13 -3
- data/lib/messente_api/models/error_number_lookup.rb +13 -3
- data/lib/messente_api/models/error_omnichannel.rb +13 -3
- data/lib/messente_api/models/error_phonebook.rb +13 -3
- data/lib/messente_api/models/error_statistics.rb +13 -3
- data/lib/messente_api/models/error_title_omnichannel.rb +2 -2
- data/lib/messente_api/models/error_title_phonebook.rb +2 -2
- data/lib/messente_api/models/fetch_blacklist_success.rb +13 -3
- data/lib/messente_api/models/group_envelope.rb +13 -3
- data/lib/messente_api/models/group_list_envelope.rb +13 -3
- data/lib/messente_api/models/group_name.rb +13 -3
- data/lib/messente_api/models/group_response_fields.rb +14 -3
- data/lib/messente_api/models/message_result.rb +13 -3
- data/lib/messente_api/models/mobile_network.rb +13 -3
- data/lib/messente_api/models/number_to_blacklist.rb +13 -3
- data/lib/messente_api/models/numbers_to_investigate.rb +13 -3
- data/lib/messente_api/models/omni_message_create_success_response.rb +13 -3
- data/lib/messente_api/models/omnimessage.rb +26 -7
- data/lib/messente_api/models/priority.rb +37 -0
- data/lib/messente_api/models/sms.rb +13 -3
- data/lib/messente_api/models/statistics_report.rb +13 -3
- data/lib/messente_api/models/statistics_report_settings.rb +14 -4
- data/lib/messente_api/models/statistics_report_success.rb +13 -3
- data/lib/messente_api/models/status.rb +2 -2
- data/lib/messente_api/models/sync_number_lookup_result.rb +20 -4
- data/lib/messente_api/models/sync_number_lookup_success.rb +13 -3
- data/lib/messente_api/models/telegram.rb +13 -3
- data/lib/messente_api/models/text_store.rb +2 -2
- data/lib/messente_api/models/viber.rb +13 -3
- data/lib/messente_api/models/whats_app.rb +13 -3
- data/lib/messente_api/models/whats_app_audio.rb +13 -3
- data/lib/messente_api/models/whats_app_document.rb +13 -3
- data/lib/messente_api/models/whats_app_image.rb +13 -3
- data/lib/messente_api/models/whats_app_text.rb +13 -3
- data/lib/messente_api/version.rb +3 -3
- data/messente_api.gemspec +2 -8
- data/spec/api_client_spec.rb +3 -3
- data/spec/configuration_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +15 -132
- data/Gemfile.lock +0 -79
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
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
|
211
|
+
description: "No description provided",
|
212
212
|
}
|
213
213
|
]
|
214
214
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
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' => :'
|
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
|
-
|
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
|
@@ -3,17 +3,17 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
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
|
-
|
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
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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.
|
6
|
+
The version of the OpenAPI document: 1.4.0
|
7
7
|
Contact: messente@messente.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
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<
|
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
|
-
|
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.4.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
|