rainbow-submarine-test-3356 1.2.2

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