cloudmersive-configuration-api-client 1.7.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 +121 -0
- data/Rakefile +8 -0
- data/cloudmersive-configuration-api-client.gemspec +45 -0
- data/docs/CreateSettingRequest.md +14 -0
- data/docs/CreateSettingResponse.md +11 -0
- data/docs/HttpFormDataParameter.md +11 -0
- data/docs/HttpGetParameter.md +10 -0
- data/docs/HttpOrchestrationHeader.md +10 -0
- data/docs/HttpOrchestrationRequest.md +8 -0
- data/docs/HttpOrchestrationResponse.md +11 -0
- data/docs/HttpOrchestrationTask.md +16 -0
- data/docs/HttpRawBinaryParameter.md +9 -0
- data/docs/HttpRawTextParameter.md +9 -0
- data/docs/HttpWwwFormUrlEncodedParameter.md +10 -0
- data/docs/ListSettingsRequest.md +9 -0
- data/docs/ListSettingsResponse.md +8 -0
- data/docs/OrchestratorApi.md +61 -0
- data/docs/SettingValue.md +15 -0
- data/docs/SettingsApi.md +167 -0
- data/docs/TaskOutputReference.md +9 -0
- data/docs/UpdateSettingRequest.md +10 -0
- data/docs/UpdateSettingResponse.md +9 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-configuration-api-client.rb +58 -0
- data/lib/cloudmersive-configuration-api-client/api/orchestrator_api.rb +78 -0
- data/lib/cloudmersive-configuration-api-client/api/settings_api.rb +188 -0
- data/lib/cloudmersive-configuration-api-client/api_client.rb +389 -0
- data/lib/cloudmersive-configuration-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-configuration-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-configuration-api-client/models/create_setting_request.rb +249 -0
- data/lib/cloudmersive-configuration-api-client/models/create_setting_response.rb +219 -0
- data/lib/cloudmersive-configuration-api-client/models/http_form_data_parameter.rb +235 -0
- data/lib/cloudmersive-configuration-api-client/models/http_get_parameter.rb +209 -0
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_header.rb +209 -0
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_request.rb +191 -0
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_response.rb +235 -0
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_task.rb +277 -0
- data/lib/cloudmersive-configuration-api-client/models/http_raw_binary_parameter.rb +215 -0
- data/lib/cloudmersive-configuration-api-client/models/http_raw_text_parameter.rb +199 -0
- data/lib/cloudmersive-configuration-api-client/models/http_www_form_url_encoded_parameter.rb +209 -0
- data/lib/cloudmersive-configuration-api-client/models/list_settings_request.rb +199 -0
- data/lib/cloudmersive-configuration-api-client/models/list_settings_response.rb +191 -0
- data/lib/cloudmersive-configuration-api-client/models/setting_value.rb +259 -0
- data/lib/cloudmersive-configuration-api-client/models/task_output_reference.rb +199 -0
- data/lib/cloudmersive-configuration-api-client/models/update_setting_request.rb +206 -0
- data/lib/cloudmersive-configuration-api-client/models/update_setting_response.rb +197 -0
- data/lib/cloudmersive-configuration-api-client/version.rb +15 -0
- data/spec/api/orchestrator_api_spec.rb +47 -0
- data/spec/api/settings_api_spec.rb +71 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/create_setting_request_spec.rb +78 -0
- data/spec/models/create_setting_response_spec.rb +60 -0
- data/spec/models/http_form_data_parameter_spec.rb +60 -0
- data/spec/models/http_get_parameter_spec.rb +54 -0
- data/spec/models/http_orchestration_header_spec.rb +54 -0
- data/spec/models/http_orchestration_request_spec.rb +42 -0
- data/spec/models/http_orchestration_response_spec.rb +60 -0
- data/spec/models/http_orchestration_task_spec.rb +90 -0
- data/spec/models/http_raw_binary_parameter_spec.rb +48 -0
- data/spec/models/http_raw_text_parameter_spec.rb +48 -0
- data/spec/models/http_www_form_url_encoded_parameter_spec.rb +54 -0
- data/spec/models/list_settings_request_spec.rb +48 -0
- data/spec/models/list_settings_response_spec.rb +42 -0
- data/spec/models/setting_value_spec.rb +84 -0
- data/spec/models/task_output_reference_spec.rb +48 -0
- data/spec/models/update_setting_request_spec.rb +54 -0
- data/spec/models/update_setting_response_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- metadata +294 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
=begin
|
2
|
+
#configapi
|
3
|
+
|
4
|
+
#Config API lets you easily manage configuration at scale.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module CloudmersiveConfigurationApiClient
|
14
|
+
class ApiError < StandardError
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
16
|
+
|
17
|
+
# Usage examples:
|
18
|
+
# ApiError.new
|
19
|
+
# ApiError.new("message")
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
22
|
+
def initialize(arg = nil)
|
23
|
+
if arg.is_a? Hash
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
25
|
+
super(arg[:message] || arg['message'])
|
26
|
+
else
|
27
|
+
super arg
|
28
|
+
end
|
29
|
+
|
30
|
+
arg.each do |k, v|
|
31
|
+
instance_variable_set "@#{k}", v
|
32
|
+
end
|
33
|
+
else
|
34
|
+
super arg
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
=begin
|
2
|
+
#configapi
|
3
|
+
|
4
|
+
#Config API lets you easily manage configuration at scale.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module CloudmersiveConfigurationApiClient
|
16
|
+
class Configuration
|
17
|
+
# Defines url scheme
|
18
|
+
attr_accessor :scheme
|
19
|
+
|
20
|
+
# Defines url host
|
21
|
+
attr_accessor :host
|
22
|
+
|
23
|
+
# Defines url base path
|
24
|
+
attr_accessor :base_path
|
25
|
+
|
26
|
+
# Defines API keys used with API Key authentications.
|
27
|
+
#
|
28
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
29
|
+
#
|
30
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
31
|
+
# config.api_key['api_key'] = 'xxx'
|
32
|
+
attr_accessor :api_key
|
33
|
+
|
34
|
+
# Defines API key prefixes used with API Key authentications.
|
35
|
+
#
|
36
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
37
|
+
#
|
38
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
39
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
40
|
+
attr_accessor :api_key_prefix
|
41
|
+
|
42
|
+
# Defines the username used with HTTP basic authentication.
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
attr_accessor :username
|
46
|
+
|
47
|
+
# Defines the password used with HTTP basic authentication.
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
attr_accessor :password
|
51
|
+
|
52
|
+
# Defines the access token (Bearer) used with OAuth2.
|
53
|
+
attr_accessor :access_token
|
54
|
+
|
55
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
56
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
57
|
+
# Default to false.
|
58
|
+
#
|
59
|
+
# @return [true, false]
|
60
|
+
attr_accessor :debugging
|
61
|
+
|
62
|
+
# Defines the logger used for debugging.
|
63
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
64
|
+
#
|
65
|
+
# @return [#debug]
|
66
|
+
attr_accessor :logger
|
67
|
+
|
68
|
+
# Defines the temporary folder to store downloaded files
|
69
|
+
# (for API endpoints that have file response).
|
70
|
+
# Default to use `Tempfile`.
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
attr_accessor :temp_folder_path
|
74
|
+
|
75
|
+
# The time limit for HTTP request in seconds.
|
76
|
+
# Default to 0 (never times out).
|
77
|
+
attr_accessor :timeout
|
78
|
+
|
79
|
+
# Set this to false to skip client side validation in the operation.
|
80
|
+
# Default to true.
|
81
|
+
# @return [true, false]
|
82
|
+
attr_accessor :client_side_validation
|
83
|
+
|
84
|
+
### TLS/SSL setting
|
85
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
86
|
+
# Default to true.
|
87
|
+
#
|
88
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
89
|
+
#
|
90
|
+
# @return [true, false]
|
91
|
+
attr_accessor :verify_ssl
|
92
|
+
|
93
|
+
### TLS/SSL setting
|
94
|
+
# Set this to false to skip verifying SSL host name
|
95
|
+
# Default to true.
|
96
|
+
#
|
97
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
98
|
+
#
|
99
|
+
# @return [true, false]
|
100
|
+
attr_accessor :verify_ssl_host
|
101
|
+
|
102
|
+
### TLS/SSL setting
|
103
|
+
# Set this to customize the certificate file to verify the peer.
|
104
|
+
#
|
105
|
+
# @return [String] the path to the certificate file
|
106
|
+
#
|
107
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
108
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
109
|
+
attr_accessor :ssl_ca_cert
|
110
|
+
|
111
|
+
### TLS/SSL setting
|
112
|
+
# Client certificate file (for client certificate)
|
113
|
+
attr_accessor :cert_file
|
114
|
+
|
115
|
+
### TLS/SSL setting
|
116
|
+
# Client private key file (for client certificate)
|
117
|
+
attr_accessor :key_file
|
118
|
+
|
119
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
120
|
+
# Default to nil.
|
121
|
+
#
|
122
|
+
# @see The params_encoding option of Ethon. Related source code:
|
123
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
124
|
+
attr_accessor :params_encoding
|
125
|
+
|
126
|
+
attr_accessor :inject_format
|
127
|
+
|
128
|
+
attr_accessor :force_ending_format
|
129
|
+
|
130
|
+
def initialize
|
131
|
+
@scheme = 'https'
|
132
|
+
@host = 'api.cloudmersive.com'
|
133
|
+
@base_path = ''
|
134
|
+
@api_key = {}
|
135
|
+
@api_key_prefix = {}
|
136
|
+
@timeout = 0
|
137
|
+
@client_side_validation = true
|
138
|
+
@verify_ssl = true
|
139
|
+
@verify_ssl_host = true
|
140
|
+
@params_encoding = nil
|
141
|
+
@cert_file = nil
|
142
|
+
@key_file = nil
|
143
|
+
@debugging = false
|
144
|
+
@inject_format = false
|
145
|
+
@force_ending_format = false
|
146
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
147
|
+
|
148
|
+
yield(self) if block_given?
|
149
|
+
end
|
150
|
+
|
151
|
+
# The default Configuration object.
|
152
|
+
def self.default
|
153
|
+
@@default ||= Configuration.new
|
154
|
+
end
|
155
|
+
|
156
|
+
def configure
|
157
|
+
yield(self) if block_given?
|
158
|
+
end
|
159
|
+
|
160
|
+
def scheme=(scheme)
|
161
|
+
# remove :// from scheme
|
162
|
+
@scheme = scheme.sub(/:\/\//, '')
|
163
|
+
end
|
164
|
+
|
165
|
+
def host=(host)
|
166
|
+
# remove http(s):// and anything after a slash
|
167
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
168
|
+
end
|
169
|
+
|
170
|
+
def base_path=(base_path)
|
171
|
+
# Add leading and trailing slashes to base_path
|
172
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
173
|
+
@base_path = "" if @base_path == "/"
|
174
|
+
end
|
175
|
+
|
176
|
+
def base_url
|
177
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
178
|
+
URI.encode(url)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Gets API key (with prefix if set).
|
182
|
+
# @param [String] param_name the parameter name of API key auth
|
183
|
+
def api_key_with_prefix(param_name)
|
184
|
+
if @api_key_prefix[param_name]
|
185
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
186
|
+
else
|
187
|
+
@api_key[param_name]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Gets Basic Auth token string
|
192
|
+
def basic_auth_token
|
193
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns Auth Settings hash for api client.
|
197
|
+
def auth_settings
|
198
|
+
{
|
199
|
+
'Apikey' =>
|
200
|
+
{
|
201
|
+
type: 'api_key',
|
202
|
+
in: 'header',
|
203
|
+
key: 'Apikey',
|
204
|
+
value: api_key_with_prefix('Apikey')
|
205
|
+
},
|
206
|
+
}
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,249 @@
|
|
1
|
+
=begin
|
2
|
+
#configapi
|
3
|
+
|
4
|
+
#Config API lets you easily manage configuration at scale.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConfigurationApiClient
|
16
|
+
# Request to create a setting
|
17
|
+
class CreateSettingRequest
|
18
|
+
# BucketID of the bucket to place the setting in; you can create a bucket by navigating to account.cloudmersive.com, clicking on Settings > API Configuration > Create Bucket
|
19
|
+
attr_accessor :bucket_id
|
20
|
+
|
21
|
+
# SecretKey of the bucket to place the setting in; you can create a bucket by navigating to account.cloudmersive.com, clicking on Settings > API Configuration > Create Bucket
|
22
|
+
attr_accessor :bucket_secret_key
|
23
|
+
|
24
|
+
# Name of the setting to create
|
25
|
+
attr_accessor :setting_name
|
26
|
+
|
27
|
+
# Type of setting to create; possible values are STRING, JSON
|
28
|
+
attr_accessor :setting_type
|
29
|
+
|
30
|
+
# Initial value of the setting
|
31
|
+
attr_accessor :setting_value
|
32
|
+
|
33
|
+
# Description of the setting
|
34
|
+
attr_accessor :setting_description
|
35
|
+
|
36
|
+
# Tags to apply to the setting
|
37
|
+
attr_accessor :setting_tags
|
38
|
+
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'bucket_id' => :'BucketID',
|
44
|
+
:'bucket_secret_key' => :'BucketSecretKey',
|
45
|
+
:'setting_name' => :'SettingName',
|
46
|
+
:'setting_type' => :'SettingType',
|
47
|
+
:'setting_value' => :'SettingValue',
|
48
|
+
:'setting_description' => :'SettingDescription',
|
49
|
+
:'setting_tags' => :'SettingTags'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'bucket_id' => :'String',
|
57
|
+
:'bucket_secret_key' => :'String',
|
58
|
+
:'setting_name' => :'String',
|
59
|
+
:'setting_type' => :'String',
|
60
|
+
:'setting_value' => :'Object',
|
61
|
+
:'setting_description' => :'String',
|
62
|
+
:'setting_tags' => :'String'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
return unless attributes.is_a?(Hash)
|
70
|
+
|
71
|
+
# convert string to symbol for hash key
|
72
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
73
|
+
|
74
|
+
if attributes.has_key?(:'BucketID')
|
75
|
+
self.bucket_id = attributes[:'BucketID']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'BucketSecretKey')
|
79
|
+
self.bucket_secret_key = attributes[:'BucketSecretKey']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'SettingName')
|
83
|
+
self.setting_name = attributes[:'SettingName']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'SettingType')
|
87
|
+
self.setting_type = attributes[:'SettingType']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'SettingValue')
|
91
|
+
self.setting_value = attributes[:'SettingValue']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'SettingDescription')
|
95
|
+
self.setting_description = attributes[:'SettingDescription']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'SettingTags')
|
99
|
+
self.setting_tags = attributes[:'SettingTags']
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
105
|
+
# @return Array for valid properties with the reasons
|
106
|
+
def list_invalid_properties
|
107
|
+
invalid_properties = Array.new
|
108
|
+
return invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
return true
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
bucket_id == o.bucket_id &&
|
123
|
+
bucket_secret_key == o.bucket_secret_key &&
|
124
|
+
setting_name == o.setting_name &&
|
125
|
+
setting_type == o.setting_type &&
|
126
|
+
setting_value == o.setting_value &&
|
127
|
+
setting_description == o.setting_description &&
|
128
|
+
setting_tags == o.setting_tags
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Fixnum] Hash code
|
139
|
+
def hash
|
140
|
+
[bucket_id, bucket_secret_key, setting_name, setting_type, setting_value, setting_description, setting_tags].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
self.class.swagger_types.each_pair do |key, type|
|
149
|
+
if type =~ /\AArray<(.*)>/i
|
150
|
+
# check to ensure the input is an array given that the the attribute
|
151
|
+
# is documented as an array but the input is not
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
158
|
+
end
|
159
|
+
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :DateTime
|
170
|
+
DateTime.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :BOOLEAN
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
|
201
|
+
temp_model.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
next if value.nil?
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map{ |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|