cloudmersive-configuration-api-client 1.7.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +3 -73
- data/Gemfile +0 -7
- data/README.md +0 -121
- data/Rakefile +0 -8
- data/cloudmersive-configuration-api-client.gemspec +0 -45
- data/docs/CreateSettingRequest.md +0 -14
- data/docs/CreateSettingResponse.md +0 -11
- data/docs/HttpFormDataParameter.md +0 -11
- data/docs/HttpGetParameter.md +0 -10
- data/docs/HttpOrchestrationHeader.md +0 -10
- data/docs/HttpOrchestrationRequest.md +0 -8
- data/docs/HttpOrchestrationResponse.md +0 -11
- data/docs/HttpOrchestrationTask.md +0 -16
- data/docs/HttpRawBinaryParameter.md +0 -9
- data/docs/HttpRawTextParameter.md +0 -9
- data/docs/HttpWwwFormUrlEncodedParameter.md +0 -10
- data/docs/ListSettingsRequest.md +0 -9
- data/docs/ListSettingsResponse.md +0 -8
- data/docs/OrchestratorApi.md +0 -61
- data/docs/SettingValue.md +0 -15
- data/docs/SettingsApi.md +0 -167
- data/docs/TaskOutputReference.md +0 -9
- data/docs/UpdateSettingRequest.md +0 -10
- data/docs/UpdateSettingResponse.md +0 -9
- data/git_push.sh +0 -55
- data/lib/cloudmersive-configuration-api-client.rb +0 -58
- data/lib/cloudmersive-configuration-api-client/api/orchestrator_api.rb +0 -78
- data/lib/cloudmersive-configuration-api-client/api/settings_api.rb +0 -188
- data/lib/cloudmersive-configuration-api-client/api_client.rb +0 -389
- data/lib/cloudmersive-configuration-api-client/api_error.rb +0 -38
- data/lib/cloudmersive-configuration-api-client/configuration.rb +0 -209
- data/lib/cloudmersive-configuration-api-client/models/create_setting_request.rb +0 -249
- data/lib/cloudmersive-configuration-api-client/models/create_setting_response.rb +0 -219
- data/lib/cloudmersive-configuration-api-client/models/http_form_data_parameter.rb +0 -235
- data/lib/cloudmersive-configuration-api-client/models/http_get_parameter.rb +0 -209
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_header.rb +0 -209
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_request.rb +0 -191
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_response.rb +0 -235
- data/lib/cloudmersive-configuration-api-client/models/http_orchestration_task.rb +0 -277
- data/lib/cloudmersive-configuration-api-client/models/http_raw_binary_parameter.rb +0 -215
- data/lib/cloudmersive-configuration-api-client/models/http_raw_text_parameter.rb +0 -199
- data/lib/cloudmersive-configuration-api-client/models/http_www_form_url_encoded_parameter.rb +0 -209
- data/lib/cloudmersive-configuration-api-client/models/list_settings_request.rb +0 -199
- data/lib/cloudmersive-configuration-api-client/models/list_settings_response.rb +0 -191
- data/lib/cloudmersive-configuration-api-client/models/setting_value.rb +0 -259
- data/lib/cloudmersive-configuration-api-client/models/task_output_reference.rb +0 -199
- data/lib/cloudmersive-configuration-api-client/models/update_setting_request.rb +0 -206
- data/lib/cloudmersive-configuration-api-client/models/update_setting_response.rb +0 -197
- data/lib/cloudmersive-configuration-api-client/version.rb +0 -15
- data/spec/api/orchestrator_api_spec.rb +0 -47
- data/spec/api/settings_api_spec.rb +0 -71
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/create_setting_request_spec.rb +0 -78
- data/spec/models/create_setting_response_spec.rb +0 -60
- data/spec/models/http_form_data_parameter_spec.rb +0 -60
- data/spec/models/http_get_parameter_spec.rb +0 -54
- data/spec/models/http_orchestration_header_spec.rb +0 -54
- data/spec/models/http_orchestration_request_spec.rb +0 -42
- data/spec/models/http_orchestration_response_spec.rb +0 -60
- data/spec/models/http_orchestration_task_spec.rb +0 -90
- data/spec/models/http_raw_binary_parameter_spec.rb +0 -48
- data/spec/models/http_raw_text_parameter_spec.rb +0 -48
- data/spec/models/http_www_form_url_encoded_parameter_spec.rb +0 -54
- data/spec/models/list_settings_request_spec.rb +0 -48
- data/spec/models/list_settings_response_spec.rb +0 -42
- data/spec/models/setting_value_spec.rb +0 -84
- data/spec/models/task_output_reference_spec.rb +0 -48
- data/spec/models/update_setting_request_spec.rb +0 -54
- data/spec/models/update_setting_response_spec.rb +0 -48
- data/spec/spec_helper.rb +0 -111
@@ -1,235 +0,0 @@
|
|
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
|
-
# Result of performing an HTTP orchestration
|
17
|
-
class HttpOrchestrationResponse
|
18
|
-
# True if the operation was successful, false otherwise
|
19
|
-
attr_accessor :successful
|
20
|
-
|
21
|
-
# Count of the number of tasks that were completed
|
22
|
-
attr_accessor :tasks_completed
|
23
|
-
|
24
|
-
# Result output in string format
|
25
|
-
attr_accessor :output_string_type
|
26
|
-
|
27
|
-
# Result output in binary format
|
28
|
-
attr_accessor :output_binary_type
|
29
|
-
|
30
|
-
|
31
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
-
def self.attribute_map
|
33
|
-
{
|
34
|
-
:'successful' => :'Successful',
|
35
|
-
:'tasks_completed' => :'TasksCompleted',
|
36
|
-
:'output_string_type' => :'Output_StringType',
|
37
|
-
:'output_binary_type' => :'Output_BinaryType'
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
# Attribute type mapping.
|
42
|
-
def self.swagger_types
|
43
|
-
{
|
44
|
-
:'successful' => :'BOOLEAN',
|
45
|
-
:'tasks_completed' => :'Integer',
|
46
|
-
:'output_string_type' => :'String',
|
47
|
-
:'output_binary_type' => :'String'
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
# Initializes the object
|
52
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
-
def initialize(attributes = {})
|
54
|
-
return unless attributes.is_a?(Hash)
|
55
|
-
|
56
|
-
# convert string to symbol for hash key
|
57
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
|
-
|
59
|
-
if attributes.has_key?(:'Successful')
|
60
|
-
self.successful = attributes[:'Successful']
|
61
|
-
end
|
62
|
-
|
63
|
-
if attributes.has_key?(:'TasksCompleted')
|
64
|
-
self.tasks_completed = attributes[:'TasksCompleted']
|
65
|
-
end
|
66
|
-
|
67
|
-
if attributes.has_key?(:'Output_StringType')
|
68
|
-
self.output_string_type = attributes[:'Output_StringType']
|
69
|
-
end
|
70
|
-
|
71
|
-
if attributes.has_key?(:'Output_BinaryType')
|
72
|
-
self.output_binary_type = attributes[:'Output_BinaryType']
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
-
# @return Array for valid properties with the reasons
|
79
|
-
def list_invalid_properties
|
80
|
-
invalid_properties = Array.new
|
81
|
-
if !@output_binary_type.nil? && @output_binary_type !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
82
|
-
invalid_properties.push("invalid value for 'output_binary_type', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
83
|
-
end
|
84
|
-
|
85
|
-
return invalid_properties
|
86
|
-
end
|
87
|
-
|
88
|
-
# Check to see if the all the properties in the model are valid
|
89
|
-
# @return true if the model is valid
|
90
|
-
def valid?
|
91
|
-
return false if !@output_binary_type.nil? && @output_binary_type !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
92
|
-
return true
|
93
|
-
end
|
94
|
-
|
95
|
-
# Custom attribute writer method with validation
|
96
|
-
# @param [Object] output_binary_type Value to be assigned
|
97
|
-
def output_binary_type=(output_binary_type)
|
98
|
-
|
99
|
-
if !output_binary_type.nil? && output_binary_type !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
100
|
-
fail ArgumentError, "invalid value for 'output_binary_type', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
101
|
-
end
|
102
|
-
|
103
|
-
@output_binary_type = output_binary_type
|
104
|
-
end
|
105
|
-
|
106
|
-
# Checks equality by comparing each attribute.
|
107
|
-
# @param [Object] Object to be compared
|
108
|
-
def ==(o)
|
109
|
-
return true if self.equal?(o)
|
110
|
-
self.class == o.class &&
|
111
|
-
successful == o.successful &&
|
112
|
-
tasks_completed == o.tasks_completed &&
|
113
|
-
output_string_type == o.output_string_type &&
|
114
|
-
output_binary_type == o.output_binary_type
|
115
|
-
end
|
116
|
-
|
117
|
-
# @see the `==` method
|
118
|
-
# @param [Object] Object to be compared
|
119
|
-
def eql?(o)
|
120
|
-
self == o
|
121
|
-
end
|
122
|
-
|
123
|
-
# Calculates hash code according to all attributes.
|
124
|
-
# @return [Fixnum] Hash code
|
125
|
-
def hash
|
126
|
-
[successful, tasks_completed, output_string_type, output_binary_type].hash
|
127
|
-
end
|
128
|
-
|
129
|
-
# Builds the object from hash
|
130
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
-
# @return [Object] Returns the model itself
|
132
|
-
def build_from_hash(attributes)
|
133
|
-
return nil unless attributes.is_a?(Hash)
|
134
|
-
self.class.swagger_types.each_pair do |key, type|
|
135
|
-
if type =~ /\AArray<(.*)>/i
|
136
|
-
# check to ensure the input is an array given that the the attribute
|
137
|
-
# is documented as an array but the input is not
|
138
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
140
|
-
end
|
141
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
143
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
144
|
-
end
|
145
|
-
|
146
|
-
self
|
147
|
-
end
|
148
|
-
|
149
|
-
# Deserializes the data based on type
|
150
|
-
# @param string type Data type
|
151
|
-
# @param string value Value to be deserialized
|
152
|
-
# @return [Object] Deserialized data
|
153
|
-
def _deserialize(type, value)
|
154
|
-
case type.to_sym
|
155
|
-
when :DateTime
|
156
|
-
DateTime.parse(value)
|
157
|
-
when :Date
|
158
|
-
Date.parse(value)
|
159
|
-
when :String
|
160
|
-
value.to_s
|
161
|
-
when :Integer
|
162
|
-
value.to_i
|
163
|
-
when :Float
|
164
|
-
value.to_f
|
165
|
-
when :BOOLEAN
|
166
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
167
|
-
true
|
168
|
-
else
|
169
|
-
false
|
170
|
-
end
|
171
|
-
when :Object
|
172
|
-
# generic object (usually a Hash), return directly
|
173
|
-
value
|
174
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
175
|
-
inner_type = Regexp.last_match[:inner_type]
|
176
|
-
value.map { |v| _deserialize(inner_type, v) }
|
177
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
178
|
-
k_type = Regexp.last_match[:k_type]
|
179
|
-
v_type = Regexp.last_match[:v_type]
|
180
|
-
{}.tap do |hash|
|
181
|
-
value.each do |k, v|
|
182
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
else # model
|
186
|
-
temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
|
187
|
-
temp_model.build_from_hash(value)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
# Returns the string representation of the object
|
192
|
-
# @return [String] String presentation of the object
|
193
|
-
def to_s
|
194
|
-
to_hash.to_s
|
195
|
-
end
|
196
|
-
|
197
|
-
# to_body is an alias to to_hash (backward compatibility)
|
198
|
-
# @return [Hash] Returns the object in the form of hash
|
199
|
-
def to_body
|
200
|
-
to_hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Returns the object in the form of hash
|
204
|
-
# @return [Hash] Returns the object in the form of hash
|
205
|
-
def to_hash
|
206
|
-
hash = {}
|
207
|
-
self.class.attribute_map.each_pair do |attr, param|
|
208
|
-
value = self.send(attr)
|
209
|
-
next if value.nil?
|
210
|
-
hash[param] = _to_hash(value)
|
211
|
-
end
|
212
|
-
hash
|
213
|
-
end
|
214
|
-
|
215
|
-
# Outputs non-array value in the form of hash
|
216
|
-
# For object, use to_hash. Otherwise, just return the value
|
217
|
-
# @param [Object] value Any valid value
|
218
|
-
# @return [Hash] Returns the value in the form of hash
|
219
|
-
def _to_hash(value)
|
220
|
-
if value.is_a?(Array)
|
221
|
-
value.compact.map{ |v| _to_hash(v) }
|
222
|
-
elsif value.is_a?(Hash)
|
223
|
-
{}.tap do |hash|
|
224
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
225
|
-
end
|
226
|
-
elsif value.respond_to? :to_hash
|
227
|
-
value.to_hash
|
228
|
-
else
|
229
|
-
value
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
end
|
234
|
-
|
235
|
-
end
|
@@ -1,277 +0,0 @@
|
|
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
|
-
|
17
|
-
class HttpOrchestrationTask
|
18
|
-
# An identifier for this task name, e.g. CreateCustomer or ScanForVirus; allows you to refer to this task from other tasks; if not supplied, it will default to a 0-based integer index of the task
|
19
|
-
attr_accessor :task_name
|
20
|
-
|
21
|
-
# HTTP Method, e.g. GET, PUT, POST, etc.
|
22
|
-
attr_accessor :http_method
|
23
|
-
|
24
|
-
# HTTP URL to orchestrate
|
25
|
-
attr_accessor :url
|
26
|
-
|
27
|
-
# Optional; HTTP headers to apply to the request
|
28
|
-
attr_accessor :http_headers
|
29
|
-
|
30
|
-
# Optional; query parameters, these query parameters will be incorporated into the URL
|
31
|
-
attr_accessor :query_parameters
|
32
|
-
|
33
|
-
# Optional; FormData parameters, these parameters will be stored in the body in a multi-part encoding
|
34
|
-
attr_accessor :form_data_parameters
|
35
|
-
|
36
|
-
# Optional; x-www-form-urlencoded paramereters, these parameters will be stored in the body as an application/x-www-form-urlencoded encoding
|
37
|
-
attr_accessor :www_form_url_encoded_parameters
|
38
|
-
|
39
|
-
# Optional; sets the body of the request as raw text, cannot be used with other parameter types in the same request
|
40
|
-
attr_accessor :raw_text_body
|
41
|
-
|
42
|
-
# Optional; set the body of the request as binary, cannot be used with other parameter types in the same request
|
43
|
-
attr_accessor :raw_binary_body
|
44
|
-
|
45
|
-
|
46
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
-
def self.attribute_map
|
48
|
-
{
|
49
|
-
:'task_name' => :'TaskName',
|
50
|
-
:'http_method' => :'HttpMethod',
|
51
|
-
:'url' => :'URL',
|
52
|
-
:'http_headers' => :'HttpHeaders',
|
53
|
-
:'query_parameters' => :'QueryParameters',
|
54
|
-
:'form_data_parameters' => :'FormDataParameters',
|
55
|
-
:'www_form_url_encoded_parameters' => :'WwwFormUrlEncodedParameters',
|
56
|
-
:'raw_text_body' => :'RawTextBody',
|
57
|
-
:'raw_binary_body' => :'RawBinaryBody'
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
# Attribute type mapping.
|
62
|
-
def self.swagger_types
|
63
|
-
{
|
64
|
-
:'task_name' => :'String',
|
65
|
-
:'http_method' => :'String',
|
66
|
-
:'url' => :'String',
|
67
|
-
:'http_headers' => :'Array<HttpOrchestrationHeader>',
|
68
|
-
:'query_parameters' => :'Array<HttpGetParameter>',
|
69
|
-
:'form_data_parameters' => :'Array<HttpFormDataParameter>',
|
70
|
-
:'www_form_url_encoded_parameters' => :'Array<HttpWwwFormUrlEncodedParameter>',
|
71
|
-
:'raw_text_body' => :'HttpRawTextParameter',
|
72
|
-
:'raw_binary_body' => :'HttpRawBinaryParameter'
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
# Initializes the object
|
77
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
-
def initialize(attributes = {})
|
79
|
-
return unless attributes.is_a?(Hash)
|
80
|
-
|
81
|
-
# convert string to symbol for hash key
|
82
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
83
|
-
|
84
|
-
if attributes.has_key?(:'TaskName')
|
85
|
-
self.task_name = attributes[:'TaskName']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.has_key?(:'HttpMethod')
|
89
|
-
self.http_method = attributes[:'HttpMethod']
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.has_key?(:'URL')
|
93
|
-
self.url = attributes[:'URL']
|
94
|
-
end
|
95
|
-
|
96
|
-
if attributes.has_key?(:'HttpHeaders')
|
97
|
-
if (value = attributes[:'HttpHeaders']).is_a?(Array)
|
98
|
-
self.http_headers = value
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
if attributes.has_key?(:'QueryParameters')
|
103
|
-
if (value = attributes[:'QueryParameters']).is_a?(Array)
|
104
|
-
self.query_parameters = value
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
if attributes.has_key?(:'FormDataParameters')
|
109
|
-
if (value = attributes[:'FormDataParameters']).is_a?(Array)
|
110
|
-
self.form_data_parameters = value
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
if attributes.has_key?(:'WwwFormUrlEncodedParameters')
|
115
|
-
if (value = attributes[:'WwwFormUrlEncodedParameters']).is_a?(Array)
|
116
|
-
self.www_form_url_encoded_parameters = value
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
if attributes.has_key?(:'RawTextBody')
|
121
|
-
self.raw_text_body = attributes[:'RawTextBody']
|
122
|
-
end
|
123
|
-
|
124
|
-
if attributes.has_key?(:'RawBinaryBody')
|
125
|
-
self.raw_binary_body = attributes[:'RawBinaryBody']
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
131
|
-
# @return Array for valid properties with the reasons
|
132
|
-
def list_invalid_properties
|
133
|
-
invalid_properties = Array.new
|
134
|
-
return invalid_properties
|
135
|
-
end
|
136
|
-
|
137
|
-
# Check to see if the all the properties in the model are valid
|
138
|
-
# @return true if the model is valid
|
139
|
-
def valid?
|
140
|
-
return true
|
141
|
-
end
|
142
|
-
|
143
|
-
# Checks equality by comparing each attribute.
|
144
|
-
# @param [Object] Object to be compared
|
145
|
-
def ==(o)
|
146
|
-
return true if self.equal?(o)
|
147
|
-
self.class == o.class &&
|
148
|
-
task_name == o.task_name &&
|
149
|
-
http_method == o.http_method &&
|
150
|
-
url == o.url &&
|
151
|
-
http_headers == o.http_headers &&
|
152
|
-
query_parameters == o.query_parameters &&
|
153
|
-
form_data_parameters == o.form_data_parameters &&
|
154
|
-
www_form_url_encoded_parameters == o.www_form_url_encoded_parameters &&
|
155
|
-
raw_text_body == o.raw_text_body &&
|
156
|
-
raw_binary_body == o.raw_binary_body
|
157
|
-
end
|
158
|
-
|
159
|
-
# @see the `==` method
|
160
|
-
# @param [Object] Object to be compared
|
161
|
-
def eql?(o)
|
162
|
-
self == o
|
163
|
-
end
|
164
|
-
|
165
|
-
# Calculates hash code according to all attributes.
|
166
|
-
# @return [Fixnum] Hash code
|
167
|
-
def hash
|
168
|
-
[task_name, http_method, url, http_headers, query_parameters, form_data_parameters, www_form_url_encoded_parameters, raw_text_body, raw_binary_body].hash
|
169
|
-
end
|
170
|
-
|
171
|
-
# Builds the object from hash
|
172
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
173
|
-
# @return [Object] Returns the model itself
|
174
|
-
def build_from_hash(attributes)
|
175
|
-
return nil unless attributes.is_a?(Hash)
|
176
|
-
self.class.swagger_types.each_pair do |key, type|
|
177
|
-
if type =~ /\AArray<(.*)>/i
|
178
|
-
# check to ensure the input is an array given that the the attribute
|
179
|
-
# is documented as an array but the input is not
|
180
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
181
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
182
|
-
end
|
183
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
184
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
185
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
186
|
-
end
|
187
|
-
|
188
|
-
self
|
189
|
-
end
|
190
|
-
|
191
|
-
# Deserializes the data based on type
|
192
|
-
# @param string type Data type
|
193
|
-
# @param string value Value to be deserialized
|
194
|
-
# @return [Object] Deserialized data
|
195
|
-
def _deserialize(type, value)
|
196
|
-
case type.to_sym
|
197
|
-
when :DateTime
|
198
|
-
DateTime.parse(value)
|
199
|
-
when :Date
|
200
|
-
Date.parse(value)
|
201
|
-
when :String
|
202
|
-
value.to_s
|
203
|
-
when :Integer
|
204
|
-
value.to_i
|
205
|
-
when :Float
|
206
|
-
value.to_f
|
207
|
-
when :BOOLEAN
|
208
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
209
|
-
true
|
210
|
-
else
|
211
|
-
false
|
212
|
-
end
|
213
|
-
when :Object
|
214
|
-
# generic object (usually a Hash), return directly
|
215
|
-
value
|
216
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
217
|
-
inner_type = Regexp.last_match[:inner_type]
|
218
|
-
value.map { |v| _deserialize(inner_type, v) }
|
219
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
220
|
-
k_type = Regexp.last_match[:k_type]
|
221
|
-
v_type = Regexp.last_match[:v_type]
|
222
|
-
{}.tap do |hash|
|
223
|
-
value.each do |k, v|
|
224
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
else # model
|
228
|
-
temp_model = CloudmersiveConfigurationApiClient.const_get(type).new
|
229
|
-
temp_model.build_from_hash(value)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
# Returns the string representation of the object
|
234
|
-
# @return [String] String presentation of the object
|
235
|
-
def to_s
|
236
|
-
to_hash.to_s
|
237
|
-
end
|
238
|
-
|
239
|
-
# to_body is an alias to to_hash (backward compatibility)
|
240
|
-
# @return [Hash] Returns the object in the form of hash
|
241
|
-
def to_body
|
242
|
-
to_hash
|
243
|
-
end
|
244
|
-
|
245
|
-
# Returns the object in the form of hash
|
246
|
-
# @return [Hash] Returns the object in the form of hash
|
247
|
-
def to_hash
|
248
|
-
hash = {}
|
249
|
-
self.class.attribute_map.each_pair do |attr, param|
|
250
|
-
value = self.send(attr)
|
251
|
-
next if value.nil?
|
252
|
-
hash[param] = _to_hash(value)
|
253
|
-
end
|
254
|
-
hash
|
255
|
-
end
|
256
|
-
|
257
|
-
# Outputs non-array value in the form of hash
|
258
|
-
# For object, use to_hash. Otherwise, just return the value
|
259
|
-
# @param [Object] value Any valid value
|
260
|
-
# @return [Hash] Returns the value in the form of hash
|
261
|
-
def _to_hash(value)
|
262
|
-
if value.is_a?(Array)
|
263
|
-
value.compact.map{ |v| _to_hash(v) }
|
264
|
-
elsif value.is_a?(Hash)
|
265
|
-
{}.tap do |hash|
|
266
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
267
|
-
end
|
268
|
-
elsif value.respond_to? :to_hash
|
269
|
-
value.to_hash
|
270
|
-
else
|
271
|
-
value
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
end
|
276
|
-
|
277
|
-
end
|