rainbow-submarine-test-3356 1.2.2
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 +150 -0
- data/Rakefile +8 -0
- data/docs/AppUser.md +14 -0
- data/docs/AppUserApi.md +616 -0
- data/docs/AppUserLink.md +9 -0
- data/docs/AppUserPreCreate.md +14 -0
- data/docs/AppUserResponse.md +8 -0
- data/docs/AppUserUpdate.md +12 -0
- data/docs/Client.md +12 -0
- data/docs/ClientInfo.md +15 -0
- data/docs/ClientResponse.md +8 -0
- data/docs/Conversation.md +9 -0
- data/docs/ConversationApi.md +192 -0
- data/docs/DeviceUpdate.md +10 -0
- data/docs/Event.md +8 -0
- data/docs/GetMessagesResponse.md +10 -0
- data/docs/Menu.md +9 -0
- data/docs/MenuApi.md +163 -0
- data/docs/MenuItem.md +13 -0
- data/docs/MenuResponse.md +8 -0
- data/docs/Message.md +17 -0
- data/docs/MessageResponse.md +9 -0
- data/docs/Postback.md +11 -0
- data/docs/TrackEventResponse.md +8 -0
- data/docs/TypingActivityTrigger.md +11 -0
- data/git_push.sh +55 -0
- data/lib/rainbow-submarine-test-3356.rb +61 -0
- data/lib/rainbow-submarine-test-3356/api/app_user_api.rb +585 -0
- data/lib/rainbow-submarine-test-3356/api/conversation_api.rb +189 -0
- data/lib/rainbow-submarine-test-3356/api/menu_api.rb +173 -0
- data/lib/rainbow-submarine-test-3356/api_client.rb +376 -0
- data/lib/rainbow-submarine-test-3356/api_error.rb +37 -0
- data/lib/rainbow-submarine-test-3356/configuration.rb +209 -0
- data/lib/rainbow-submarine-test-3356/models/app_user.rb +258 -0
- data/lib/rainbow-submarine-test-3356/models/app_user_link.rb +201 -0
- data/lib/rainbow-submarine-test-3356/models/app_user_pre_create.rb +246 -0
- data/lib/rainbow-submarine-test-3356/models/app_user_response.rb +192 -0
- data/lib/rainbow-submarine-test-3356/models/app_user_update.rb +223 -0
- data/lib/rainbow-submarine-test-3356/models/client.rb +248 -0
- data/lib/rainbow-submarine-test-3356/models/client_info.rb +250 -0
- data/lib/rainbow-submarine-test-3356/models/client_response.rb +187 -0
- data/lib/rainbow-submarine-test-3356/models/conversation.rb +206 -0
- data/lib/rainbow-submarine-test-3356/models/device_update.rb +205 -0
- data/lib/rainbow-submarine-test-3356/models/event.rb +192 -0
- data/lib/rainbow-submarine-test-3356/models/get_messages_response.rb +207 -0
- data/lib/rainbow-submarine-test-3356/models/menu.rb +203 -0
- data/lib/rainbow-submarine-test-3356/models/menu_item.rb +242 -0
- data/lib/rainbow-submarine-test-3356/models/menu_response.rb +192 -0
- data/lib/rainbow-submarine-test-3356/models/message.rb +303 -0
- data/lib/rainbow-submarine-test-3356/models/message_response.rb +206 -0
- data/lib/rainbow-submarine-test-3356/models/postback.rb +229 -0
- data/lib/rainbow-submarine-test-3356/models/track_event_response.rb +187 -0
- data/lib/rainbow-submarine-test-3356/models/typing_activity_trigger.rb +224 -0
- data/lib/rainbow-submarine-test-3356/version.rb +14 -0
- data/lib/swagger_client.rb +61 -0
- data/lib/swagger_client/api/app_user_api.rb +585 -0
- data/lib/swagger_client/api/conversation_api.rb +189 -0
- data/lib/swagger_client/api/menu_api.rb +173 -0
- data/lib/swagger_client/api_client.rb +376 -0
- data/lib/swagger_client/api_error.rb +37 -0
- data/lib/swagger_client/configuration.rb +209 -0
- data/lib/swagger_client/models/app_user.rb +258 -0
- data/lib/swagger_client/models/app_user_link.rb +201 -0
- data/lib/swagger_client/models/app_user_pre_create.rb +246 -0
- data/lib/swagger_client/models/app_user_response.rb +192 -0
- data/lib/swagger_client/models/app_user_update.rb +223 -0
- data/lib/swagger_client/models/client.rb +248 -0
- data/lib/swagger_client/models/client_info.rb +250 -0
- data/lib/swagger_client/models/client_response.rb +187 -0
- data/lib/swagger_client/models/conversation.rb +206 -0
- data/lib/swagger_client/models/device_update.rb +205 -0
- data/lib/swagger_client/models/event.rb +192 -0
- data/lib/swagger_client/models/get_messages_response.rb +207 -0
- data/lib/swagger_client/models/menu.rb +203 -0
- data/lib/swagger_client/models/menu_item.rb +242 -0
- data/lib/swagger_client/models/menu_response.rb +192 -0
- data/lib/swagger_client/models/message.rb +303 -0
- data/lib/swagger_client/models/message_response.rb +206 -0
- data/lib/swagger_client/models/postback.rb +229 -0
- data/lib/swagger_client/models/track_event_response.rb +187 -0
- data/lib/swagger_client/models/typing_activity_trigger.rb +224 -0
- data/lib/swagger_client/version.rb +14 -0
- data/rainbow-submarine-test-3356.gemspec +44 -0
- data/spec/api/app_user_api_spec.rb +162 -0
- data/spec/api/conversation_api_spec.rb +73 -0
- data/spec/api/menu_api_spec.rb +68 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/app_user_link_spec.rb +47 -0
- data/spec/models/app_user_pre_create_spec.rb +77 -0
- data/spec/models/app_user_response_spec.rb +41 -0
- data/spec/models/app_user_spec.rb +77 -0
- data/spec/models/app_user_update_spec.rb +65 -0
- data/spec/models/client_info_spec.rb +83 -0
- data/spec/models/client_response_spec.rb +41 -0
- data/spec/models/client_spec.rb +65 -0
- data/spec/models/conversation_spec.rb +47 -0
- data/spec/models/device_update_spec.rb +53 -0
- data/spec/models/event_spec.rb +41 -0
- data/spec/models/get_messages_response_spec.rb +53 -0
- data/spec/models/menu_item_spec.rb +71 -0
- data/spec/models/menu_response_spec.rb +41 -0
- data/spec/models/menu_spec.rb +47 -0
- data/spec/models/message_response_spec.rb +47 -0
- data/spec/models/message_spec.rb +95 -0
- data/spec/models/postback_spec.rb +59 -0
- data/spec/models/track_event_response_spec.rb +41 -0
- data/spec/models/typing_activity_trigger_spec.rb +59 -0
- data/spec/spec_helper.rb +110 -0
- data/swagger_client.gemspec +45 -0
- metadata +361 -0
@@ -0,0 +1,223 @@
|
|
1
|
+
=begin
|
2
|
+
#Smooch
|
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
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module SwaggerClient
|
15
|
+
|
16
|
+
class AppUserUpdate
|
17
|
+
attr_accessor :given_name
|
18
|
+
|
19
|
+
attr_accessor :surname
|
20
|
+
|
21
|
+
attr_accessor :email
|
22
|
+
|
23
|
+
attr_accessor :signed_up_at
|
24
|
+
|
25
|
+
attr_accessor :properties
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'given_name' => :'givenName',
|
32
|
+
:'surname' => :'surname',
|
33
|
+
:'email' => :'email',
|
34
|
+
:'signed_up_at' => :'signedUpAt',
|
35
|
+
:'properties' => :'properties'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'given_name' => :'String',
|
43
|
+
:'surname' => :'String',
|
44
|
+
:'email' => :'String',
|
45
|
+
:'signed_up_at' => :'String',
|
46
|
+
:'properties' => :'Object'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
if attributes.has_key?(:'givenName')
|
59
|
+
self.given_name = attributes[:'givenName']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'surname')
|
63
|
+
self.surname = attributes[:'surname']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'email')
|
67
|
+
self.email = attributes[:'email']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'signedUpAt')
|
71
|
+
self.signed_up_at = attributes[:'signedUpAt']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'properties')
|
75
|
+
self.properties = attributes[:'properties']
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properies with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
return invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
given_name == o.given_name &&
|
99
|
+
surname == o.surname &&
|
100
|
+
email == o.email &&
|
101
|
+
signed_up_at == o.signed_up_at &&
|
102
|
+
properties == o.properties
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Fixnum] Hash code
|
113
|
+
def hash
|
114
|
+
[given_name, surname, email, signed_up_at, properties].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def build_from_hash(attributes)
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
122
|
+
self.class.swagger_types.each_pair do |key, type|
|
123
|
+
if type =~ /\AArray<(.*)>/i
|
124
|
+
# check to ensure the input is an array given that the the attribute
|
125
|
+
# is documented as an array but the input is not
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
128
|
+
end
|
129
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
131
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Deserializes the data based on type
|
138
|
+
# @param string type Data type
|
139
|
+
# @param string value Value to be deserialized
|
140
|
+
# @return [Object] Deserialized data
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :DateTime
|
144
|
+
DateTime.parse(value)
|
145
|
+
when :Date
|
146
|
+
Date.parse(value)
|
147
|
+
when :String
|
148
|
+
value.to_s
|
149
|
+
when :Integer
|
150
|
+
value.to_i
|
151
|
+
when :Float
|
152
|
+
value.to_f
|
153
|
+
when :BOOLEAN
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
+
true
|
156
|
+
else
|
157
|
+
false
|
158
|
+
end
|
159
|
+
when :Object
|
160
|
+
# generic object (usually a Hash), return directly
|
161
|
+
value
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each do |k, v|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
else # model
|
174
|
+
temp_model = SwaggerClient.const_get(type).new
|
175
|
+
temp_model.build_from_hash(value)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the string representation of the object
|
180
|
+
# @return [String] String presentation of the object
|
181
|
+
def to_s
|
182
|
+
to_hash.to_s
|
183
|
+
end
|
184
|
+
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_body
|
188
|
+
to_hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the object in the form of hash
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_hash
|
194
|
+
hash = {}
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
196
|
+
value = self.send(attr)
|
197
|
+
next if value.nil?
|
198
|
+
hash[param] = _to_hash(value)
|
199
|
+
end
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map{ |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to? :to_hash
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
=begin
|
2
|
+
#Smooch
|
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
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module SwaggerClient
|
15
|
+
|
16
|
+
class Client
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
attr_accessor :active
|
20
|
+
|
21
|
+
attr_accessor :last_seen
|
22
|
+
|
23
|
+
attr_accessor :platform
|
24
|
+
|
25
|
+
attr_accessor :info
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'id' => :'id',
|
32
|
+
:'active' => :'active',
|
33
|
+
:'last_seen' => :'lastSeen',
|
34
|
+
:'platform' => :'platform',
|
35
|
+
:'info' => :'info'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'id' => :'String',
|
43
|
+
:'active' => :'BOOLEAN',
|
44
|
+
:'last_seen' => :'String',
|
45
|
+
:'platform' => :'String',
|
46
|
+
:'info' => :'ClientInfo'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
if attributes.has_key?(:'id')
|
59
|
+
self.id = attributes[:'id']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'active')
|
63
|
+
self.active = attributes[:'active']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'lastSeen')
|
67
|
+
self.last_seen = attributes[:'lastSeen']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'platform')
|
71
|
+
self.platform = attributes[:'platform']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'info')
|
75
|
+
self.info = attributes[:'info']
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properies with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
if @id.nil?
|
85
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
86
|
+
end
|
87
|
+
|
88
|
+
if @active.nil?
|
89
|
+
invalid_properties.push("invalid value for 'active', active cannot be nil.")
|
90
|
+
end
|
91
|
+
|
92
|
+
if @last_seen.nil?
|
93
|
+
invalid_properties.push("invalid value for 'last_seen', last_seen cannot be nil.")
|
94
|
+
end
|
95
|
+
|
96
|
+
if @platform.nil?
|
97
|
+
invalid_properties.push("invalid value for 'platform', platform cannot be nil.")
|
98
|
+
end
|
99
|
+
|
100
|
+
if @info.nil?
|
101
|
+
invalid_properties.push("invalid value for 'info', info cannot be nil.")
|
102
|
+
end
|
103
|
+
|
104
|
+
return invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
return false if @id.nil?
|
111
|
+
return false if @active.nil?
|
112
|
+
return false if @last_seen.nil?
|
113
|
+
return false if @platform.nil?
|
114
|
+
return false if @info.nil?
|
115
|
+
return true
|
116
|
+
end
|
117
|
+
|
118
|
+
# Checks equality by comparing each attribute.
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def ==(o)
|
121
|
+
return true if self.equal?(o)
|
122
|
+
self.class == o.class &&
|
123
|
+
id == o.id &&
|
124
|
+
active == o.active &&
|
125
|
+
last_seen == o.last_seen &&
|
126
|
+
platform == o.platform &&
|
127
|
+
info == o.info
|
128
|
+
end
|
129
|
+
|
130
|
+
# @see the `==` method
|
131
|
+
# @param [Object] Object to be compared
|
132
|
+
def eql?(o)
|
133
|
+
self == o
|
134
|
+
end
|
135
|
+
|
136
|
+
# Calculates hash code according to all attributes.
|
137
|
+
# @return [Fixnum] Hash code
|
138
|
+
def hash
|
139
|
+
[id, active, last_seen, platform, info].hash
|
140
|
+
end
|
141
|
+
|
142
|
+
# Builds the object from hash
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
+
# @return [Object] Returns the model itself
|
145
|
+
def build_from_hash(attributes)
|
146
|
+
return nil unless attributes.is_a?(Hash)
|
147
|
+
self.class.swagger_types.each_pair do |key, type|
|
148
|
+
if type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the the attribute
|
150
|
+
# is documented as an array but the input is not
|
151
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
152
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
153
|
+
end
|
154
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
155
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
156
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
157
|
+
end
|
158
|
+
|
159
|
+
self
|
160
|
+
end
|
161
|
+
|
162
|
+
# Deserializes the data based on type
|
163
|
+
# @param string type Data type
|
164
|
+
# @param string value Value to be deserialized
|
165
|
+
# @return [Object] Deserialized data
|
166
|
+
def _deserialize(type, value)
|
167
|
+
case type.to_sym
|
168
|
+
when :DateTime
|
169
|
+
DateTime.parse(value)
|
170
|
+
when :Date
|
171
|
+
Date.parse(value)
|
172
|
+
when :String
|
173
|
+
value.to_s
|
174
|
+
when :Integer
|
175
|
+
value.to_i
|
176
|
+
when :Float
|
177
|
+
value.to_f
|
178
|
+
when :BOOLEAN
|
179
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
180
|
+
true
|
181
|
+
else
|
182
|
+
false
|
183
|
+
end
|
184
|
+
when :Object
|
185
|
+
# generic object (usually a Hash), return directly
|
186
|
+
value
|
187
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
188
|
+
inner_type = Regexp.last_match[:inner_type]
|
189
|
+
value.map { |v| _deserialize(inner_type, v) }
|
190
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
191
|
+
k_type = Regexp.last_match[:k_type]
|
192
|
+
v_type = Regexp.last_match[:v_type]
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each do |k, v|
|
195
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
else # model
|
199
|
+
temp_model = SwaggerClient.const_get(type).new
|
200
|
+
temp_model.build_from_hash(value)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the string representation of the object
|
205
|
+
# @return [String] String presentation of the object
|
206
|
+
def to_s
|
207
|
+
to_hash.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# to_body is an alias to to_hash (backward compatibility)
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_body
|
213
|
+
to_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the object in the form of hash
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_hash
|
219
|
+
hash = {}
|
220
|
+
self.class.attribute_map.each_pair do |attr, param|
|
221
|
+
value = self.send(attr)
|
222
|
+
next if value.nil?
|
223
|
+
hash[param] = _to_hash(value)
|
224
|
+
end
|
225
|
+
hash
|
226
|
+
end
|
227
|
+
|
228
|
+
# Outputs non-array value in the form of hash
|
229
|
+
# For object, use to_hash. Otherwise, just return the value
|
230
|
+
# @param [Object] value Any valid value
|
231
|
+
# @return [Hash] Returns the value in the form of hash
|
232
|
+
def _to_hash(value)
|
233
|
+
if value.is_a?(Array)
|
234
|
+
value.compact.map{ |v| _to_hash(v) }
|
235
|
+
elsif value.is_a?(Hash)
|
236
|
+
{}.tap do |hash|
|
237
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
238
|
+
end
|
239
|
+
elsif value.respond_to? :to_hash
|
240
|
+
value.to_hash
|
241
|
+
else
|
242
|
+
value
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|