sms_works_sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +120 -0
- data/Rakefile +8 -0
- data/docs/ApiKeyResponse.md +9 -0
- data/docs/AuthApi.md +102 -0
- data/docs/BatchMessage.md +11 -0
- data/docs/BatchMessageResponse.md +9 -0
- data/docs/BatchMessagesApi.md +224 -0
- data/docs/CancelledMessageResponse.md +9 -0
- data/docs/ErrorModel.md +9 -0
- data/docs/ExtendedErrorModel.md +10 -0
- data/docs/HelloWorldResponse.md +8 -0
- data/docs/Login.md +10 -0
- data/docs/Message.md +12 -0
- data/docs/MessageResponse.md +19 -0
- data/docs/MessagesApi.md +278 -0
- data/docs/MessagesResponse.md +8 -0
- data/docs/MessagesResponseMessages.md +8 -0
- data/docs/Query.md +13 -0
- data/docs/ScheduledBatchResponse.md +9 -0
- data/docs/ScheduledMessageResponse.md +9 -0
- data/docs/SendMessageResponse.md +10 -0
- data/docs/TokenResponse.md +8 -0
- data/docs/UtilsApi.md +56 -0
- data/git_push.sh +55 -0
- data/lib/swagger_client.rb +60 -0
- data/lib/swagger_client/api/auth_api.rb +134 -0
- data/lib/swagger_client/api/batch_messages_api.rb +243 -0
- data/lib/swagger_client/api/messages_api.rb +298 -0
- data/lib/swagger_client/api/utils_api.rb +75 -0
- data/lib/swagger_client/api_client.rb +389 -0
- data/lib/swagger_client/api_error.rb +38 -0
- data/lib/swagger_client/configuration.rb +209 -0
- data/lib/swagger_client/models/api_key_response.rb +207 -0
- data/lib/swagger_client/models/batch_message.rb +241 -0
- data/lib/swagger_client/models/batch_message_response.rb +207 -0
- data/lib/swagger_client/models/cancelled_message_response.rb +207 -0
- data/lib/swagger_client/models/error_model.rb +235 -0
- data/lib/swagger_client/models/extended_error_model.rb +249 -0
- data/lib/swagger_client/models/hello_world_response.rb +193 -0
- data/lib/swagger_client/models/login.rb +209 -0
- data/lib/swagger_client/models/message.rb +249 -0
- data/lib/swagger_client/models/message_response.rb +347 -0
- data/lib/swagger_client/models/messages_response.rb +188 -0
- data/lib/swagger_client/models/messages_response_messages.rb +188 -0
- data/lib/swagger_client/models/query.rb +239 -0
- data/lib/swagger_client/models/scheduled_batch_response.rb +207 -0
- data/lib/swagger_client/models/scheduled_message_response.rb +207 -0
- data/lib/swagger_client/models/send_message_response.rb +221 -0
- data/lib/swagger_client/models/token_response.rb +193 -0
- data/lib/swagger_client/version.rb +15 -0
- data/spec/api/auth_api_spec.rb +59 -0
- data/spec/api/batch_messages_api_spec.rb +83 -0
- data/spec/api/messages_api_spec.rb +95 -0
- data/spec/api/utils_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/api_key_response_spec.rb +48 -0
- data/spec/models/batch_message_response_spec.rb +48 -0
- data/spec/models/batch_message_spec.rb +60 -0
- data/spec/models/cancelled_message_response_spec.rb +48 -0
- data/spec/models/error_model_spec.rb +48 -0
- data/spec/models/extended_error_model_spec.rb +54 -0
- data/spec/models/hello_world_response_spec.rb +42 -0
- data/spec/models/login_spec.rb +54 -0
- data/spec/models/message_response_spec.rb +108 -0
- data/spec/models/message_spec.rb +66 -0
- data/spec/models/messages_response_messages_spec.rb +42 -0
- data/spec/models/messages_response_spec.rb +42 -0
- data/spec/models/query_spec.rb +72 -0
- data/spec/models/scheduled_batch_response_spec.rb +48 -0
- data/spec/models/scheduled_message_response_spec.rb +48 -0
- data/spec/models/send_message_response_spec.rb +54 -0
- data/spec/models/token_response_spec.rb +42 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger_client.gemspec +46 -0
- metadata +323 -0
@@ -0,0 +1,347 @@
|
|
1
|
+
=begin
|
2
|
+
#The SMS Works API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SwaggerClient
|
16
|
+
|
17
|
+
class MessageResponse
|
18
|
+
attr_accessor :batchid
|
19
|
+
|
20
|
+
attr_accessor :content
|
21
|
+
|
22
|
+
attr_accessor :created
|
23
|
+
|
24
|
+
attr_accessor :customerid
|
25
|
+
|
26
|
+
attr_accessor :destination
|
27
|
+
|
28
|
+
attr_accessor :keyword
|
29
|
+
|
30
|
+
attr_accessor :messageid
|
31
|
+
|
32
|
+
attr_accessor :modified
|
33
|
+
|
34
|
+
attr_accessor :schedule
|
35
|
+
|
36
|
+
attr_accessor :status
|
37
|
+
|
38
|
+
attr_accessor :sender
|
39
|
+
|
40
|
+
attr_accessor :tag
|
41
|
+
|
42
|
+
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
44
|
+
def self.attribute_map
|
45
|
+
{
|
46
|
+
:'batchid' => :'batchid',
|
47
|
+
:'content' => :'content',
|
48
|
+
:'created' => :'created',
|
49
|
+
:'customerid' => :'customerid',
|
50
|
+
:'destination' => :'destination',
|
51
|
+
:'keyword' => :'keyword',
|
52
|
+
:'messageid' => :'messageid',
|
53
|
+
:'modified' => :'modified',
|
54
|
+
:'schedule' => :'schedule',
|
55
|
+
:'status' => :'status',
|
56
|
+
:'sender' => :'sender',
|
57
|
+
:'tag' => :'tag'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute type mapping.
|
62
|
+
def self.swagger_types
|
63
|
+
{
|
64
|
+
:'batchid' => :'String',
|
65
|
+
:'content' => :'String',
|
66
|
+
:'created' => :'String',
|
67
|
+
:'customerid' => :'String',
|
68
|
+
:'destination' => :'Float',
|
69
|
+
:'keyword' => :'String',
|
70
|
+
:'messageid' => :'String',
|
71
|
+
:'modified' => :'String',
|
72
|
+
:'schedule' => :'String',
|
73
|
+
:'status' => :'String',
|
74
|
+
:'sender' => :'String',
|
75
|
+
:'tag' => :'String'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# Initializes the object
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
def initialize(attributes = {})
|
82
|
+
return unless attributes.is_a?(Hash)
|
83
|
+
|
84
|
+
# convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
86
|
+
|
87
|
+
if attributes.has_key?(:'batchid')
|
88
|
+
self.batchid = attributes[:'batchid']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'content')
|
92
|
+
self.content = attributes[:'content']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'created')
|
96
|
+
self.created = attributes[:'created']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'customerid')
|
100
|
+
self.customerid = attributes[:'customerid']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.has_key?(:'destination')
|
104
|
+
self.destination = attributes[:'destination']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'keyword')
|
108
|
+
self.keyword = attributes[:'keyword']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'messageid')
|
112
|
+
self.messageid = attributes[:'messageid']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'modified')
|
116
|
+
self.modified = attributes[:'modified']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'schedule')
|
120
|
+
self.schedule = attributes[:'schedule']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'status')
|
124
|
+
self.status = attributes[:'status']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'sender')
|
128
|
+
self.sender = attributes[:'sender']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'tag')
|
132
|
+
self.tag = attributes[:'tag']
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
138
|
+
# @return Array for valid properies with the reasons
|
139
|
+
def list_invalid_properties
|
140
|
+
invalid_properties = Array.new
|
141
|
+
if @batchid.nil?
|
142
|
+
invalid_properties.push("invalid value for 'batchid', batchid cannot be nil.")
|
143
|
+
end
|
144
|
+
|
145
|
+
if @content.nil?
|
146
|
+
invalid_properties.push("invalid value for 'content', content cannot be nil.")
|
147
|
+
end
|
148
|
+
|
149
|
+
if @created.nil?
|
150
|
+
invalid_properties.push("invalid value for 'created', created cannot be nil.")
|
151
|
+
end
|
152
|
+
|
153
|
+
if @customerid.nil?
|
154
|
+
invalid_properties.push("invalid value for 'customerid', customerid cannot be nil.")
|
155
|
+
end
|
156
|
+
|
157
|
+
if @destination.nil?
|
158
|
+
invalid_properties.push("invalid value for 'destination', destination cannot be nil.")
|
159
|
+
end
|
160
|
+
|
161
|
+
if @keyword.nil?
|
162
|
+
invalid_properties.push("invalid value for 'keyword', keyword cannot be nil.")
|
163
|
+
end
|
164
|
+
|
165
|
+
if @messageid.nil?
|
166
|
+
invalid_properties.push("invalid value for 'messageid', messageid cannot be nil.")
|
167
|
+
end
|
168
|
+
|
169
|
+
if @modified.nil?
|
170
|
+
invalid_properties.push("invalid value for 'modified', modified cannot be nil.")
|
171
|
+
end
|
172
|
+
|
173
|
+
if @schedule.nil?
|
174
|
+
invalid_properties.push("invalid value for 'schedule', schedule cannot be nil.")
|
175
|
+
end
|
176
|
+
|
177
|
+
if @status.nil?
|
178
|
+
invalid_properties.push("invalid value for 'status', status cannot be nil.")
|
179
|
+
end
|
180
|
+
|
181
|
+
if @sender.nil?
|
182
|
+
invalid_properties.push("invalid value for 'sender', sender cannot be nil.")
|
183
|
+
end
|
184
|
+
|
185
|
+
if @tag.nil?
|
186
|
+
invalid_properties.push("invalid value for 'tag', tag cannot be nil.")
|
187
|
+
end
|
188
|
+
|
189
|
+
return invalid_properties
|
190
|
+
end
|
191
|
+
|
192
|
+
# Check to see if the all the properties in the model are valid
|
193
|
+
# @return true if the model is valid
|
194
|
+
def valid?
|
195
|
+
return false if @batchid.nil?
|
196
|
+
return false if @content.nil?
|
197
|
+
return false if @created.nil?
|
198
|
+
return false if @customerid.nil?
|
199
|
+
return false if @destination.nil?
|
200
|
+
return false if @keyword.nil?
|
201
|
+
return false if @messageid.nil?
|
202
|
+
return false if @modified.nil?
|
203
|
+
return false if @schedule.nil?
|
204
|
+
return false if @status.nil?
|
205
|
+
return false if @sender.nil?
|
206
|
+
return false if @tag.nil?
|
207
|
+
return true
|
208
|
+
end
|
209
|
+
|
210
|
+
# Checks equality by comparing each attribute.
|
211
|
+
# @param [Object] Object to be compared
|
212
|
+
def ==(o)
|
213
|
+
return true if self.equal?(o)
|
214
|
+
self.class == o.class &&
|
215
|
+
batchid == o.batchid &&
|
216
|
+
content == o.content &&
|
217
|
+
created == o.created &&
|
218
|
+
customerid == o.customerid &&
|
219
|
+
destination == o.destination &&
|
220
|
+
keyword == o.keyword &&
|
221
|
+
messageid == o.messageid &&
|
222
|
+
modified == o.modified &&
|
223
|
+
schedule == o.schedule &&
|
224
|
+
status == o.status &&
|
225
|
+
sender == o.sender &&
|
226
|
+
tag == o.tag
|
227
|
+
end
|
228
|
+
|
229
|
+
# @see the `==` method
|
230
|
+
# @param [Object] Object to be compared
|
231
|
+
def eql?(o)
|
232
|
+
self == o
|
233
|
+
end
|
234
|
+
|
235
|
+
# Calculates hash code according to all attributes.
|
236
|
+
# @return [Fixnum] Hash code
|
237
|
+
def hash
|
238
|
+
[batchid, content, created, customerid, destination, keyword, messageid, modified, schedule, status, sender, tag].hash
|
239
|
+
end
|
240
|
+
|
241
|
+
# Builds the object from hash
|
242
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
243
|
+
# @return [Object] Returns the model itself
|
244
|
+
def build_from_hash(attributes)
|
245
|
+
return nil unless attributes.is_a?(Hash)
|
246
|
+
self.class.swagger_types.each_pair do |key, type|
|
247
|
+
if type =~ /\AArray<(.*)>/i
|
248
|
+
# check to ensure the input is an array given that the the attribute
|
249
|
+
# is documented as an array but the input is not
|
250
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
251
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
252
|
+
end
|
253
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
254
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
255
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
256
|
+
end
|
257
|
+
|
258
|
+
self
|
259
|
+
end
|
260
|
+
|
261
|
+
# Deserializes the data based on type
|
262
|
+
# @param string type Data type
|
263
|
+
# @param string value Value to be deserialized
|
264
|
+
# @return [Object] Deserialized data
|
265
|
+
def _deserialize(type, value)
|
266
|
+
case type.to_sym
|
267
|
+
when :DateTime
|
268
|
+
DateTime.parse(value)
|
269
|
+
when :Date
|
270
|
+
Date.parse(value)
|
271
|
+
when :String
|
272
|
+
value.to_s
|
273
|
+
when :Integer
|
274
|
+
value.to_i
|
275
|
+
when :Float
|
276
|
+
value.to_f
|
277
|
+
when :BOOLEAN
|
278
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
279
|
+
true
|
280
|
+
else
|
281
|
+
false
|
282
|
+
end
|
283
|
+
when :Object
|
284
|
+
# generic object (usually a Hash), return directly
|
285
|
+
value
|
286
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
287
|
+
inner_type = Regexp.last_match[:inner_type]
|
288
|
+
value.map { |v| _deserialize(inner_type, v) }
|
289
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
290
|
+
k_type = Regexp.last_match[:k_type]
|
291
|
+
v_type = Regexp.last_match[:v_type]
|
292
|
+
{}.tap do |hash|
|
293
|
+
value.each do |k, v|
|
294
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
else # model
|
298
|
+
temp_model = SwaggerClient.const_get(type).new
|
299
|
+
temp_model.build_from_hash(value)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the string representation of the object
|
304
|
+
# @return [String] String presentation of the object
|
305
|
+
def to_s
|
306
|
+
to_hash.to_s
|
307
|
+
end
|
308
|
+
|
309
|
+
# to_body is an alias to to_hash (backward compatibility)
|
310
|
+
# @return [Hash] Returns the object in the form of hash
|
311
|
+
def to_body
|
312
|
+
to_hash
|
313
|
+
end
|
314
|
+
|
315
|
+
# Returns the object in the form of hash
|
316
|
+
# @return [Hash] Returns the object in the form of hash
|
317
|
+
def to_hash
|
318
|
+
hash = {}
|
319
|
+
self.class.attribute_map.each_pair do |attr, param|
|
320
|
+
value = self.send(attr)
|
321
|
+
next if value.nil?
|
322
|
+
hash[param] = _to_hash(value)
|
323
|
+
end
|
324
|
+
hash
|
325
|
+
end
|
326
|
+
|
327
|
+
# Outputs non-array value in the form of hash
|
328
|
+
# For object, use to_hash. Otherwise, just return the value
|
329
|
+
# @param [Object] value Any valid value
|
330
|
+
# @return [Hash] Returns the value in the form of hash
|
331
|
+
def _to_hash(value)
|
332
|
+
if value.is_a?(Array)
|
333
|
+
value.compact.map{ |v| _to_hash(v) }
|
334
|
+
elsif value.is_a?(Hash)
|
335
|
+
{}.tap do |hash|
|
336
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
337
|
+
end
|
338
|
+
elsif value.respond_to? :to_hash
|
339
|
+
value.to_hash
|
340
|
+
else
|
341
|
+
value
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
end
|
346
|
+
|
347
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
=begin
|
2
|
+
#The SMS Works API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SwaggerClient
|
16
|
+
|
17
|
+
class MessagesResponse
|
18
|
+
attr_accessor :messages
|
19
|
+
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'messages' => :'messages'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'messages' => :'MessagesResponseMessages'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
42
|
+
|
43
|
+
if attributes.has_key?(:'messages')
|
44
|
+
self.messages = attributes[:'messages']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
50
|
+
# @return Array for valid properies with the reasons
|
51
|
+
def list_invalid_properties
|
52
|
+
invalid_properties = Array.new
|
53
|
+
return invalid_properties
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check to see if the all the properties in the model are valid
|
57
|
+
# @return true if the model is valid
|
58
|
+
def valid?
|
59
|
+
return true
|
60
|
+
end
|
61
|
+
|
62
|
+
# Checks equality by comparing each attribute.
|
63
|
+
# @param [Object] Object to be compared
|
64
|
+
def ==(o)
|
65
|
+
return true if self.equal?(o)
|
66
|
+
self.class == o.class &&
|
67
|
+
messages == o.messages
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see the `==` method
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def eql?(o)
|
73
|
+
self == o
|
74
|
+
end
|
75
|
+
|
76
|
+
# Calculates hash code according to all attributes.
|
77
|
+
# @return [Fixnum] Hash code
|
78
|
+
def hash
|
79
|
+
[messages].hash
|
80
|
+
end
|
81
|
+
|
82
|
+
# Builds the object from hash
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
# @return [Object] Returns the model itself
|
85
|
+
def build_from_hash(attributes)
|
86
|
+
return nil unless attributes.is_a?(Hash)
|
87
|
+
self.class.swagger_types.each_pair do |key, type|
|
88
|
+
if type =~ /\AArray<(.*)>/i
|
89
|
+
# check to ensure the input is an array given that the the attribute
|
90
|
+
# is documented as an array but the input is not
|
91
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
92
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
93
|
+
end
|
94
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
95
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
96
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
97
|
+
end
|
98
|
+
|
99
|
+
self
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deserializes the data based on type
|
103
|
+
# @param string type Data type
|
104
|
+
# @param string value Value to be deserialized
|
105
|
+
# @return [Object] Deserialized data
|
106
|
+
def _deserialize(type, value)
|
107
|
+
case type.to_sym
|
108
|
+
when :DateTime
|
109
|
+
DateTime.parse(value)
|
110
|
+
when :Date
|
111
|
+
Date.parse(value)
|
112
|
+
when :String
|
113
|
+
value.to_s
|
114
|
+
when :Integer
|
115
|
+
value.to_i
|
116
|
+
when :Float
|
117
|
+
value.to_f
|
118
|
+
when :BOOLEAN
|
119
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
120
|
+
true
|
121
|
+
else
|
122
|
+
false
|
123
|
+
end
|
124
|
+
when :Object
|
125
|
+
# generic object (usually a Hash), return directly
|
126
|
+
value
|
127
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
128
|
+
inner_type = Regexp.last_match[:inner_type]
|
129
|
+
value.map { |v| _deserialize(inner_type, v) }
|
130
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
131
|
+
k_type = Regexp.last_match[:k_type]
|
132
|
+
v_type = Regexp.last_match[:v_type]
|
133
|
+
{}.tap do |hash|
|
134
|
+
value.each do |k, v|
|
135
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
else # model
|
139
|
+
temp_model = SwaggerClient.const_get(type).new
|
140
|
+
temp_model.build_from_hash(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the string representation of the object
|
145
|
+
# @return [String] String presentation of the object
|
146
|
+
def to_s
|
147
|
+
to_hash.to_s
|
148
|
+
end
|
149
|
+
|
150
|
+
# to_body is an alias to to_hash (backward compatibility)
|
151
|
+
# @return [Hash] Returns the object in the form of hash
|
152
|
+
def to_body
|
153
|
+
to_hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the object in the form of hash
|
157
|
+
# @return [Hash] Returns the object in the form of hash
|
158
|
+
def to_hash
|
159
|
+
hash = {}
|
160
|
+
self.class.attribute_map.each_pair do |attr, param|
|
161
|
+
value = self.send(attr)
|
162
|
+
next if value.nil?
|
163
|
+
hash[param] = _to_hash(value)
|
164
|
+
end
|
165
|
+
hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Outputs non-array value in the form of hash
|
169
|
+
# For object, use to_hash. Otherwise, just return the value
|
170
|
+
# @param [Object] value Any valid value
|
171
|
+
# @return [Hash] Returns the value in the form of hash
|
172
|
+
def _to_hash(value)
|
173
|
+
if value.is_a?(Array)
|
174
|
+
value.compact.map{ |v| _to_hash(v) }
|
175
|
+
elsif value.is_a?(Hash)
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
178
|
+
end
|
179
|
+
elsif value.respond_to? :to_hash
|
180
|
+
value.to_hash
|
181
|
+
else
|
182
|
+
value
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|