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,37 @@
|
|
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
|
+
module RainbowSubmarineTest3356
|
13
|
+
class ApiError < StandardError
|
14
|
+
attr_reader :code, :response_headers, :response_body
|
15
|
+
|
16
|
+
# Usage examples:
|
17
|
+
# ApiError.new
|
18
|
+
# ApiError.new("message")
|
19
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
20
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
21
|
+
def initialize(arg = nil)
|
22
|
+
if arg.is_a? Hash
|
23
|
+
if arg.key?(:message) || arg.key?('message')
|
24
|
+
super(arg[:message] || arg['message'])
|
25
|
+
else
|
26
|
+
super arg
|
27
|
+
end
|
28
|
+
|
29
|
+
arg.each do |k, v|
|
30
|
+
instance_variable_set "@#{k}", v
|
31
|
+
end
|
32
|
+
else
|
33
|
+
super arg
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,209 @@
|
|
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 'uri'
|
13
|
+
|
14
|
+
module RainbowSubmarineTest3356
|
15
|
+
class Configuration
|
16
|
+
# Defines url scheme
|
17
|
+
attr_accessor :scheme
|
18
|
+
|
19
|
+
# Defines url host
|
20
|
+
attr_accessor :host
|
21
|
+
|
22
|
+
# Defines url base path
|
23
|
+
attr_accessor :base_path
|
24
|
+
|
25
|
+
# Defines API keys used with API Key authentications.
|
26
|
+
#
|
27
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
28
|
+
#
|
29
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
30
|
+
# config.api_key['api_key'] = 'xxx'
|
31
|
+
attr_accessor :api_key
|
32
|
+
|
33
|
+
# Defines API key prefixes used with API Key authentications.
|
34
|
+
#
|
35
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
36
|
+
#
|
37
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
38
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
39
|
+
attr_accessor :api_key_prefix
|
40
|
+
|
41
|
+
# Defines the username used with HTTP basic authentication.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
attr_accessor :username
|
45
|
+
|
46
|
+
# Defines the password used with HTTP basic authentication.
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
attr_accessor :password
|
50
|
+
|
51
|
+
# Defines the access token (Bearer) used with OAuth2.
|
52
|
+
attr_accessor :access_token
|
53
|
+
|
54
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
55
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
56
|
+
# Default to false.
|
57
|
+
#
|
58
|
+
# @return [true, false]
|
59
|
+
attr_accessor :debugging
|
60
|
+
|
61
|
+
# Defines the logger used for debugging.
|
62
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
63
|
+
#
|
64
|
+
# @return [#debug]
|
65
|
+
attr_accessor :logger
|
66
|
+
|
67
|
+
# Defines the temporary folder to store downloaded files
|
68
|
+
# (for API endpoints that have file response).
|
69
|
+
# Default to use `Tempfile`.
|
70
|
+
#
|
71
|
+
# @return [String]
|
72
|
+
attr_accessor :temp_folder_path
|
73
|
+
|
74
|
+
# The time limit for HTTP request in seconds.
|
75
|
+
# Default to 0 (never times out).
|
76
|
+
attr_accessor :timeout
|
77
|
+
|
78
|
+
### TLS/SSL setting
|
79
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
80
|
+
# Default to true.
|
81
|
+
#
|
82
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
83
|
+
#
|
84
|
+
# @return [true, false]
|
85
|
+
attr_accessor :verify_ssl
|
86
|
+
|
87
|
+
### TLS/SSL setting
|
88
|
+
# Set this to false to skip verifying SSL host name
|
89
|
+
# Default to true.
|
90
|
+
#
|
91
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
92
|
+
#
|
93
|
+
# @return [true, false]
|
94
|
+
attr_accessor :verify_ssl_host
|
95
|
+
|
96
|
+
### TLS/SSL setting
|
97
|
+
# Set this to customize the certificate file to verify the peer.
|
98
|
+
#
|
99
|
+
# @return [String] the path to the certificate file
|
100
|
+
#
|
101
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
102
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
103
|
+
attr_accessor :ssl_ca_cert
|
104
|
+
|
105
|
+
### TLS/SSL setting
|
106
|
+
# Client certificate file (for client certificate)
|
107
|
+
attr_accessor :cert_file
|
108
|
+
|
109
|
+
### TLS/SSL setting
|
110
|
+
# Client private key file (for client certificate)
|
111
|
+
attr_accessor :key_file
|
112
|
+
|
113
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
114
|
+
# Default to nil.
|
115
|
+
#
|
116
|
+
# @see The params_encoding option of Ethon. Related source code:
|
117
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
118
|
+
attr_accessor :params_encoding
|
119
|
+
|
120
|
+
attr_accessor :inject_format
|
121
|
+
|
122
|
+
attr_accessor :force_ending_format
|
123
|
+
|
124
|
+
def initialize
|
125
|
+
@scheme = 'https'
|
126
|
+
@host = 'api.smooch.io'
|
127
|
+
@base_path = '/v1'
|
128
|
+
@api_key = {}
|
129
|
+
@api_key_prefix = {}
|
130
|
+
@timeout = 0
|
131
|
+
@verify_ssl = true
|
132
|
+
@verify_ssl_host = true
|
133
|
+
@params_encoding = nil
|
134
|
+
@cert_file = nil
|
135
|
+
@key_file = nil
|
136
|
+
@debugging = false
|
137
|
+
@inject_format = false
|
138
|
+
@force_ending_format = false
|
139
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
140
|
+
|
141
|
+
yield(self) if block_given?
|
142
|
+
end
|
143
|
+
|
144
|
+
# The default Configuration object.
|
145
|
+
def self.default
|
146
|
+
@@default ||= Configuration.new
|
147
|
+
end
|
148
|
+
|
149
|
+
def configure
|
150
|
+
yield(self) if block_given?
|
151
|
+
end
|
152
|
+
|
153
|
+
def scheme=(scheme)
|
154
|
+
# remove :// from scheme
|
155
|
+
@scheme = scheme.sub(/:\/\//, '')
|
156
|
+
end
|
157
|
+
|
158
|
+
def host=(host)
|
159
|
+
# remove http(s):// and anything after a slash
|
160
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
161
|
+
end
|
162
|
+
|
163
|
+
def base_path=(base_path)
|
164
|
+
# Add leading and trailing slashes to base_path
|
165
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
166
|
+
@base_path = "" if @base_path == "/"
|
167
|
+
end
|
168
|
+
|
169
|
+
def base_url
|
170
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
171
|
+
URI.encode(url)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Gets API key (with prefix if set).
|
175
|
+
# @param [String] param_name the parameter name of API key auth
|
176
|
+
def api_key_with_prefix(param_name)
|
177
|
+
if @api_key_prefix[param_name]
|
178
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
179
|
+
else
|
180
|
+
@api_key[param_name]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Gets Basic Auth token string
|
185
|
+
def basic_auth_token
|
186
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns Auth Settings hash for api client.
|
190
|
+
def auth_settings
|
191
|
+
{
|
192
|
+
'appToken' =>
|
193
|
+
{
|
194
|
+
type: 'api_key',
|
195
|
+
in: 'header',
|
196
|
+
key: 'app-token',
|
197
|
+
value: api_key_with_prefix('app-token')
|
198
|
+
},
|
199
|
+
'jwt' =>
|
200
|
+
{
|
201
|
+
type: 'api_key',
|
202
|
+
in: 'header',
|
203
|
+
key: 'Authorization',
|
204
|
+
value: api_key_with_prefix('Authorization')
|
205
|
+
},
|
206
|
+
}
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,258 @@
|
|
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 RainbowSubmarineTest3356
|
15
|
+
|
16
|
+
class AppUser
|
17
|
+
attr_accessor :_id
|
18
|
+
|
19
|
+
attr_accessor :user_id
|
20
|
+
|
21
|
+
attr_accessor :given_name
|
22
|
+
|
23
|
+
attr_accessor :surname
|
24
|
+
|
25
|
+
attr_accessor :properties
|
26
|
+
|
27
|
+
attr_accessor :conversation_started
|
28
|
+
|
29
|
+
attr_accessor :clients
|
30
|
+
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'_id' => :'_id',
|
36
|
+
:'user_id' => :'userId',
|
37
|
+
:'given_name' => :'givenName',
|
38
|
+
:'surname' => :'surname',
|
39
|
+
:'properties' => :'properties',
|
40
|
+
:'conversation_started' => :'conversationStarted',
|
41
|
+
:'clients' => :'clients'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Attribute type mapping.
|
46
|
+
def self.swagger_types
|
47
|
+
{
|
48
|
+
:'_id' => :'String',
|
49
|
+
:'user_id' => :'String',
|
50
|
+
:'given_name' => :'String',
|
51
|
+
:'surname' => :'String',
|
52
|
+
:'properties' => :'Object',
|
53
|
+
:'conversation_started' => :'BOOLEAN',
|
54
|
+
:'clients' => :'Array<Client>'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Initializes the object
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
60
|
+
def initialize(attributes = {})
|
61
|
+
return unless attributes.is_a?(Hash)
|
62
|
+
|
63
|
+
# convert string to symbol for hash key
|
64
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
65
|
+
|
66
|
+
if attributes.has_key?(:'_id')
|
67
|
+
self._id = attributes[:'_id']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'userId')
|
71
|
+
self.user_id = attributes[:'userId']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'givenName')
|
75
|
+
self.given_name = attributes[:'givenName']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'surname')
|
79
|
+
self.surname = attributes[:'surname']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'properties')
|
83
|
+
self.properties = attributes[:'properties']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'conversationStarted')
|
87
|
+
self.conversation_started = attributes[:'conversationStarted']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'clients')
|
91
|
+
if (value = attributes[:'clients']).is_a?(Array)
|
92
|
+
self.clients = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properies with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
invalid_properties = Array.new
|
102
|
+
if @_id.nil?
|
103
|
+
invalid_properties.push("invalid value for '_id', _id cannot be nil.")
|
104
|
+
end
|
105
|
+
|
106
|
+
if @properties.nil?
|
107
|
+
invalid_properties.push("invalid value for 'properties', properties cannot be nil.")
|
108
|
+
end
|
109
|
+
|
110
|
+
if @conversation_started.nil?
|
111
|
+
invalid_properties.push("invalid value for 'conversation_started', conversation_started cannot be nil.")
|
112
|
+
end
|
113
|
+
|
114
|
+
return invalid_properties
|
115
|
+
end
|
116
|
+
|
117
|
+
# Check to see if the all the properties in the model are valid
|
118
|
+
# @return true if the model is valid
|
119
|
+
def valid?
|
120
|
+
return false if @_id.nil?
|
121
|
+
return false if @properties.nil?
|
122
|
+
return false if @conversation_started.nil?
|
123
|
+
return true
|
124
|
+
end
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(o)
|
129
|
+
return true if self.equal?(o)
|
130
|
+
self.class == o.class &&
|
131
|
+
_id == o._id &&
|
132
|
+
user_id == o.user_id &&
|
133
|
+
given_name == o.given_name &&
|
134
|
+
surname == o.surname &&
|
135
|
+
properties == o.properties &&
|
136
|
+
conversation_started == o.conversation_started &&
|
137
|
+
clients == o.clients
|
138
|
+
end
|
139
|
+
|
140
|
+
# @see the `==` method
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def eql?(o)
|
143
|
+
self == o
|
144
|
+
end
|
145
|
+
|
146
|
+
# Calculates hash code according to all attributes.
|
147
|
+
# @return [Fixnum] Hash code
|
148
|
+
def hash
|
149
|
+
[_id, user_id, given_name, surname, properties, conversation_started, clients].hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Builds the object from hash
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
# @return [Object] Returns the model itself
|
155
|
+
def build_from_hash(attributes)
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
157
|
+
self.class.swagger_types.each_pair do |key, type|
|
158
|
+
if type =~ /\AArray<(.*)>/i
|
159
|
+
# check to ensure the input is an array given that the the attribute
|
160
|
+
# is documented as an array but the input is not
|
161
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
162
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
163
|
+
end
|
164
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
165
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
166
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
167
|
+
end
|
168
|
+
|
169
|
+
self
|
170
|
+
end
|
171
|
+
|
172
|
+
# Deserializes the data based on type
|
173
|
+
# @param string type Data type
|
174
|
+
# @param string value Value to be deserialized
|
175
|
+
# @return [Object] Deserialized data
|
176
|
+
def _deserialize(type, value)
|
177
|
+
case type.to_sym
|
178
|
+
when :DateTime
|
179
|
+
DateTime.parse(value)
|
180
|
+
when :Date
|
181
|
+
Date.parse(value)
|
182
|
+
when :String
|
183
|
+
value.to_s
|
184
|
+
when :Integer
|
185
|
+
value.to_i
|
186
|
+
when :Float
|
187
|
+
value.to_f
|
188
|
+
when :BOOLEAN
|
189
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
190
|
+
true
|
191
|
+
else
|
192
|
+
false
|
193
|
+
end
|
194
|
+
when :Object
|
195
|
+
# generic object (usually a Hash), return directly
|
196
|
+
value
|
197
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
198
|
+
inner_type = Regexp.last_match[:inner_type]
|
199
|
+
value.map { |v| _deserialize(inner_type, v) }
|
200
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
201
|
+
k_type = Regexp.last_match[:k_type]
|
202
|
+
v_type = Regexp.last_match[:v_type]
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each do |k, v|
|
205
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
else # model
|
209
|
+
temp_model = RainbowSubmarineTest3356.const_get(type).new
|
210
|
+
temp_model.build_from_hash(value)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the string representation of the object
|
215
|
+
# @return [String] String presentation of the object
|
216
|
+
def to_s
|
217
|
+
to_hash.to_s
|
218
|
+
end
|
219
|
+
|
220
|
+
# to_body is an alias to to_hash (backward compatibility)
|
221
|
+
# @return [Hash] Returns the object in the form of hash
|
222
|
+
def to_body
|
223
|
+
to_hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the object in the form of hash
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_hash
|
229
|
+
hash = {}
|
230
|
+
self.class.attribute_map.each_pair do |attr, param|
|
231
|
+
value = self.send(attr)
|
232
|
+
next if value.nil?
|
233
|
+
hash[param] = _to_hash(value)
|
234
|
+
end
|
235
|
+
hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Outputs non-array value in the form of hash
|
239
|
+
# For object, use to_hash. Otherwise, just return the value
|
240
|
+
# @param [Object] value Any valid value
|
241
|
+
# @return [Hash] Returns the value in the form of hash
|
242
|
+
def _to_hash(value)
|
243
|
+
if value.is_a?(Array)
|
244
|
+
value.compact.map{ |v| _to_hash(v) }
|
245
|
+
elsif value.is_a?(Hash)
|
246
|
+
{}.tap do |hash|
|
247
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
248
|
+
end
|
249
|
+
elsif value.respond_to? :to_hash
|
250
|
+
value.to_hash
|
251
|
+
else
|
252
|
+
value
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|