cloudmersive-convert-api-client 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -4
- data/docs/AutodetectToThumbnailsResult.md +9 -0
- data/docs/ConvertDocumentApi.md +742 -91
- data/docs/DocxToPngResult.md +9 -0
- data/docs/EmlAttachment.md +9 -0
- data/docs/EmlToHtmlResult.md +18 -0
- data/docs/GetFileTypeIconResult.md +10 -0
- data/docs/MsgAttachment.md +9 -0
- data/docs/MsgToHtmlResult.md +16 -0
- data/docs/PptxToPngResult.md +9 -0
- data/docs/Thumbnail.md +9 -0
- data/docs/ValidateDocumentApi.md +110 -0
- data/docs/XlsxToPngResult.md +9 -0
- data/lib/cloudmersive-convert-api-client.rb +10 -0
- data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +657 -0
- data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +112 -0
- data/lib/cloudmersive-convert-api-client/models/autodetect_to_thumbnails_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/docx_to_png_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/eml_attachment.rb +215 -0
- data/lib/cloudmersive-convert-api-client/models/eml_to_html_result.rb +291 -0
- data/lib/cloudmersive-convert-api-client/models/get_file_type_icon_result.rb +225 -0
- data/lib/cloudmersive-convert-api-client/models/msg_attachment.rb +215 -0
- data/lib/cloudmersive-convert-api-client/models/msg_to_html_result.rb +271 -0
- data/lib/cloudmersive-convert-api-client/models/pptx_to_png_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/models/thumbnail.rb +215 -0
- data/lib/cloudmersive-convert-api-client/models/xlsx_to_png_result.rb +201 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/convert_document_api_spec.rb +147 -0
- data/spec/api/validate_document_api_spec.rb +24 -0
- data/spec/models/autodetect_to_thumbnails_result_spec.rb +48 -0
- data/spec/models/docx_to_png_result_spec.rb +48 -0
- data/spec/models/eml_attachment_spec.rb +48 -0
- data/spec/models/eml_to_html_result_spec.rb +102 -0
- data/spec/models/get_file_type_icon_result_spec.rb +54 -0
- data/spec/models/msg_attachment_spec.rb +48 -0
- data/spec/models/msg_to_html_result_spec.rb +90 -0
- data/spec/models/pptx_to_png_result_spec.rb +48 -0
- data/spec/models/thumbnail_spec.rb +48 -0
- data/spec/models/xlsx_to_png_result_spec.rb +48 -0
- metadata +32 -2
@@ -0,0 +1,215 @@
|
|
1
|
+
=begin
|
2
|
+
#convertapi
|
3
|
+
|
4
|
+
#Convert API lets you effortlessly convert file formats and types.
|
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 CloudmersiveConvertApiClient
|
16
|
+
# An EML file attachment
|
17
|
+
class EmlAttachment
|
18
|
+
# Name of the attachment, including file extension
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# The EML attachment as a byte[]
|
22
|
+
attr_accessor :content
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'name' => :'Name',
|
29
|
+
:'content' => :'Content'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'name' => :'String',
|
37
|
+
:'content' => :'String'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
|
+
|
49
|
+
if attributes.has_key?(:'Name')
|
50
|
+
self.name = attributes[:'Name']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'Content')
|
54
|
+
self.content = attributes[:'Content']
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
60
|
+
# @return Array for valid properties with the reasons
|
61
|
+
def list_invalid_properties
|
62
|
+
invalid_properties = Array.new
|
63
|
+
if !@content.nil? && @content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
64
|
+
invalid_properties.push("invalid value for 'content', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
65
|
+
end
|
66
|
+
|
67
|
+
return invalid_properties
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
return false if !@content.nil? && @content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
74
|
+
return true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Custom attribute writer method with validation
|
78
|
+
# @param [Object] content Value to be assigned
|
79
|
+
def content=(content)
|
80
|
+
|
81
|
+
if !content.nil? && content !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
82
|
+
fail ArgumentError, "invalid value for 'content', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
83
|
+
end
|
84
|
+
|
85
|
+
@content = content
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
name == o.name &&
|
94
|
+
content == o.content
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Fixnum] Hash code
|
105
|
+
def hash
|
106
|
+
[name, content].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def build_from_hash(attributes)
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
114
|
+
self.class.swagger_types.each_pair do |key, type|
|
115
|
+
if type =~ /\AArray<(.*)>/i
|
116
|
+
# check to ensure the input is an array given that the the attribute
|
117
|
+
# is documented as an array but the input is not
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
120
|
+
end
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
123
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
124
|
+
end
|
125
|
+
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deserializes the data based on type
|
130
|
+
# @param string type Data type
|
131
|
+
# @param string value Value to be deserialized
|
132
|
+
# @return [Object] Deserialized data
|
133
|
+
def _deserialize(type, value)
|
134
|
+
case type.to_sym
|
135
|
+
when :DateTime
|
136
|
+
DateTime.parse(value)
|
137
|
+
when :Date
|
138
|
+
Date.parse(value)
|
139
|
+
when :String
|
140
|
+
value.to_s
|
141
|
+
when :Integer
|
142
|
+
value.to_i
|
143
|
+
when :Float
|
144
|
+
value.to_f
|
145
|
+
when :BOOLEAN
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
|
+
true
|
148
|
+
else
|
149
|
+
false
|
150
|
+
end
|
151
|
+
when :Object
|
152
|
+
# generic object (usually a Hash), return directly
|
153
|
+
value
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each do |k, v|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
else # model
|
166
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
167
|
+
temp_model.build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
next if value.nil?
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map{ |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
@@ -0,0 +1,291 @@
|
|
1
|
+
=begin
|
2
|
+
#convertapi
|
3
|
+
|
4
|
+
#Convert API lets you effortlessly convert file formats and types.
|
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 CloudmersiveConvertApiClient
|
16
|
+
# Result of converting an EML file to HTML string
|
17
|
+
class EmlToHtmlResult
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# An HTML string version of the EML file
|
22
|
+
attr_accessor :content
|
23
|
+
|
24
|
+
# The main body of the EML file's email as an HTML string
|
25
|
+
attr_accessor :body
|
26
|
+
|
27
|
+
# The From sender of the EML file's email
|
28
|
+
attr_accessor :from
|
29
|
+
|
30
|
+
# The To recipients of the EML file's email
|
31
|
+
attr_accessor :to
|
32
|
+
|
33
|
+
# The CC recipients of the EML file's email
|
34
|
+
attr_accessor :cc
|
35
|
+
|
36
|
+
# The BCC recipients of the EML file's email
|
37
|
+
attr_accessor :bcc
|
38
|
+
|
39
|
+
# The time that the EML file's email was received
|
40
|
+
attr_accessor :received_time
|
41
|
+
|
42
|
+
# The subject of the EML file's email
|
43
|
+
attr_accessor :subject
|
44
|
+
|
45
|
+
# The Organization of the EML file's email
|
46
|
+
attr_accessor :organization
|
47
|
+
|
48
|
+
# List of all attachments for the EML file
|
49
|
+
attr_accessor :attachments
|
50
|
+
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'successful' => :'Successful',
|
56
|
+
:'content' => :'Content',
|
57
|
+
:'body' => :'Body',
|
58
|
+
:'from' => :'From',
|
59
|
+
:'to' => :'To',
|
60
|
+
:'cc' => :'Cc',
|
61
|
+
:'bcc' => :'Bcc',
|
62
|
+
:'received_time' => :'ReceivedTime',
|
63
|
+
:'subject' => :'Subject',
|
64
|
+
:'organization' => :'Organization',
|
65
|
+
:'attachments' => :'Attachments'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.swagger_types
|
71
|
+
{
|
72
|
+
:'successful' => :'BOOLEAN',
|
73
|
+
:'content' => :'String',
|
74
|
+
:'body' => :'String',
|
75
|
+
:'from' => :'String',
|
76
|
+
:'to' => :'String',
|
77
|
+
:'cc' => :'String',
|
78
|
+
:'bcc' => :'String',
|
79
|
+
:'received_time' => :'String',
|
80
|
+
:'subject' => :'String',
|
81
|
+
:'organization' => :'String',
|
82
|
+
:'attachments' => :'Array<EmlAttachment>'
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# Initializes the object
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
+
def initialize(attributes = {})
|
89
|
+
return unless attributes.is_a?(Hash)
|
90
|
+
|
91
|
+
# convert string to symbol for hash key
|
92
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
93
|
+
|
94
|
+
if attributes.has_key?(:'Successful')
|
95
|
+
self.successful = attributes[:'Successful']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'Content')
|
99
|
+
self.content = attributes[:'Content']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'Body')
|
103
|
+
self.body = attributes[:'Body']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'From')
|
107
|
+
self.from = attributes[:'From']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'To')
|
111
|
+
self.to = attributes[:'To']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'Cc')
|
115
|
+
self.cc = attributes[:'Cc']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'Bcc')
|
119
|
+
self.bcc = attributes[:'Bcc']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'ReceivedTime')
|
123
|
+
self.received_time = attributes[:'ReceivedTime']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'Subject')
|
127
|
+
self.subject = attributes[:'Subject']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.has_key?(:'Organization')
|
131
|
+
self.organization = attributes[:'Organization']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.has_key?(:'Attachments')
|
135
|
+
if (value = attributes[:'Attachments']).is_a?(Array)
|
136
|
+
self.attachments = value
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
143
|
+
# @return Array for valid properties with the reasons
|
144
|
+
def list_invalid_properties
|
145
|
+
invalid_properties = Array.new
|
146
|
+
return invalid_properties
|
147
|
+
end
|
148
|
+
|
149
|
+
# Check to see if the all the properties in the model are valid
|
150
|
+
# @return true if the model is valid
|
151
|
+
def valid?
|
152
|
+
return true
|
153
|
+
end
|
154
|
+
|
155
|
+
# Checks equality by comparing each attribute.
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def ==(o)
|
158
|
+
return true if self.equal?(o)
|
159
|
+
self.class == o.class &&
|
160
|
+
successful == o.successful &&
|
161
|
+
content == o.content &&
|
162
|
+
body == o.body &&
|
163
|
+
from == o.from &&
|
164
|
+
to == o.to &&
|
165
|
+
cc == o.cc &&
|
166
|
+
bcc == o.bcc &&
|
167
|
+
received_time == o.received_time &&
|
168
|
+
subject == o.subject &&
|
169
|
+
organization == o.organization &&
|
170
|
+
attachments == o.attachments
|
171
|
+
end
|
172
|
+
|
173
|
+
# @see the `==` method
|
174
|
+
# @param [Object] Object to be compared
|
175
|
+
def eql?(o)
|
176
|
+
self == o
|
177
|
+
end
|
178
|
+
|
179
|
+
# Calculates hash code according to all attributes.
|
180
|
+
# @return [Fixnum] Hash code
|
181
|
+
def hash
|
182
|
+
[successful, content, body, from, to, cc, bcc, received_time, subject, organization, attachments].hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Builds the object from hash
|
186
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
187
|
+
# @return [Object] Returns the model itself
|
188
|
+
def build_from_hash(attributes)
|
189
|
+
return nil unless attributes.is_a?(Hash)
|
190
|
+
self.class.swagger_types.each_pair do |key, type|
|
191
|
+
if type =~ /\AArray<(.*)>/i
|
192
|
+
# check to ensure the input is an array given that the the attribute
|
193
|
+
# is documented as an array but the input is not
|
194
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
195
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
196
|
+
end
|
197
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
198
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
199
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
200
|
+
end
|
201
|
+
|
202
|
+
self
|
203
|
+
end
|
204
|
+
|
205
|
+
# Deserializes the data based on type
|
206
|
+
# @param string type Data type
|
207
|
+
# @param string value Value to be deserialized
|
208
|
+
# @return [Object] Deserialized data
|
209
|
+
def _deserialize(type, value)
|
210
|
+
case type.to_sym
|
211
|
+
when :DateTime
|
212
|
+
DateTime.parse(value)
|
213
|
+
when :Date
|
214
|
+
Date.parse(value)
|
215
|
+
when :String
|
216
|
+
value.to_s
|
217
|
+
when :Integer
|
218
|
+
value.to_i
|
219
|
+
when :Float
|
220
|
+
value.to_f
|
221
|
+
when :BOOLEAN
|
222
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
223
|
+
true
|
224
|
+
else
|
225
|
+
false
|
226
|
+
end
|
227
|
+
when :Object
|
228
|
+
# generic object (usually a Hash), return directly
|
229
|
+
value
|
230
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
231
|
+
inner_type = Regexp.last_match[:inner_type]
|
232
|
+
value.map { |v| _deserialize(inner_type, v) }
|
233
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
234
|
+
k_type = Regexp.last_match[:k_type]
|
235
|
+
v_type = Regexp.last_match[:v_type]
|
236
|
+
{}.tap do |hash|
|
237
|
+
value.each do |k, v|
|
238
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
else # model
|
242
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
243
|
+
temp_model.build_from_hash(value)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns the string representation of the object
|
248
|
+
# @return [String] String presentation of the object
|
249
|
+
def to_s
|
250
|
+
to_hash.to_s
|
251
|
+
end
|
252
|
+
|
253
|
+
# to_body is an alias to to_hash (backward compatibility)
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
255
|
+
def to_body
|
256
|
+
to_hash
|
257
|
+
end
|
258
|
+
|
259
|
+
# Returns the object in the form of hash
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
261
|
+
def to_hash
|
262
|
+
hash = {}
|
263
|
+
self.class.attribute_map.each_pair do |attr, param|
|
264
|
+
value = self.send(attr)
|
265
|
+
next if value.nil?
|
266
|
+
hash[param] = _to_hash(value)
|
267
|
+
end
|
268
|
+
hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Outputs non-array value in the form of hash
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
273
|
+
# @param [Object] value Any valid value
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
275
|
+
def _to_hash(value)
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.compact.map{ |v| _to_hash(v) }
|
278
|
+
elsif value.is_a?(Hash)
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
281
|
+
end
|
282
|
+
elsif value.respond_to? :to_hash
|
283
|
+
value.to_hash
|
284
|
+
else
|
285
|
+
value
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|