groupdocs_parser_cloud 19.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/groupdocs_parser_cloud.rb +91 -0
- data/lib/groupdocs_parser_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_parser_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_parser_cloud/api/info_api.rb +363 -0
- data/lib/groupdocs_parser_cloud/api/parse_api.rb +411 -0
- data/lib/groupdocs_parser_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_parser_cloud/api/template_api.rb +410 -0
- data/lib/groupdocs_parser_cloud/api_client.rb +380 -0
- data/lib/groupdocs_parser_cloud/api_error.rb +64 -0
- data/lib/groupdocs_parser_cloud/configuration.rb +95 -0
- data/lib/groupdocs_parser_cloud/models/container_item.rb +246 -0
- data/lib/groupdocs_parser_cloud/models/container_item_info.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/container_options.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/container_result.rb +216 -0
- data/lib/groupdocs_parser_cloud/models/coordinates.rb +264 -0
- data/lib/groupdocs_parser_cloud/models/create_template_options.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/detector_parameters.rb +266 -0
- data/lib/groupdocs_parser_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/error.rb +244 -0
- data/lib/groupdocs_parser_cloud/models/error_details.rb +229 -0
- data/lib/groupdocs_parser_cloud/models/field.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/field_data.rb +249 -0
- data/lib/groupdocs_parser_cloud/models/field_position.rb +344 -0
- data/lib/groupdocs_parser_cloud/models/file_info.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/file_type.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_parser_cloud/models/file_versions.rb +216 -0
- data/lib/groupdocs_parser_cloud/models/files_list.rb +216 -0
- data/lib/groupdocs_parser_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_parser_cloud/models/format.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/formats_result.rb +216 -0
- data/lib/groupdocs_parser_cloud/models/formatted_text_options.rb +214 -0
- data/lib/groupdocs_parser_cloud/models/image.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/image_page.rb +231 -0
- data/lib/groupdocs_parser_cloud/models/images_options.rb +254 -0
- data/lib/groupdocs_parser_cloud/models/images_result.rb +228 -0
- data/lib/groupdocs_parser_cloud/models/info_options.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/info_result.rb +244 -0
- data/lib/groupdocs_parser_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/page.rb +229 -0
- data/lib/groupdocs_parser_cloud/models/page_area.rb +244 -0
- data/lib/groupdocs_parser_cloud/models/page_table_area.rb +246 -0
- data/lib/groupdocs_parser_cloud/models/page_table_area_cell.rb +274 -0
- data/lib/groupdocs_parser_cloud/models/page_text_area.rb +251 -0
- data/lib/groupdocs_parser_cloud/models/parse_options.rb +244 -0
- data/lib/groupdocs_parser_cloud/models/parse_result.rb +231 -0
- data/lib/groupdocs_parser_cloud/models/parser_options.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/point.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/rectangle.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/size.rb +234 -0
- data/lib/groupdocs_parser_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_parser_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_parser_cloud/models/table.rb +244 -0
- data/lib/groupdocs_parser_cloud/models/table_layout.rb +228 -0
- data/lib/groupdocs_parser_cloud/models/template.rb +228 -0
- data/lib/groupdocs_parser_cloud/models/template_options.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/template_result.rb +224 -0
- data/lib/groupdocs_parser_cloud/models/text_options.rb +254 -0
- data/lib/groupdocs_parser_cloud/models/text_page.rb +229 -0
- data/lib/groupdocs_parser_cloud/models/text_result.rb +226 -0
- data/lib/groupdocs_parser_cloud/models/text_style.rb +269 -0
- data/lib/groupdocs_parser_cloud/version.rb +29 -0
- metadata +174 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# -----------------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose Pty Ltd" file="api_error.rb">
|
3
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
4
|
+
# </copyright>
|
5
|
+
# <summary>
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
# </summary>
|
24
|
+
# -----------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
module GroupDocsParserCloud
|
27
|
+
#
|
28
|
+
# ApiError class for error handling
|
29
|
+
#
|
30
|
+
class ApiError < StandardError
|
31
|
+
attr_reader :code
|
32
|
+
attr_reader :message
|
33
|
+
|
34
|
+
# Usage examples:
|
35
|
+
# ApiError.new
|
36
|
+
# ApiError.new(:code => 500, :response_body => "")
|
37
|
+
def initialize(arg = nil)
|
38
|
+
if arg.is_a? Hash
|
39
|
+
|
40
|
+
if arg.key?(:response_body)
|
41
|
+
data = JSON.parse(arg[:response_body], :symbolize_names => true)
|
42
|
+
if !data.nil?
|
43
|
+
if !data[:error].nil?
|
44
|
+
if data[:error].is_a? String
|
45
|
+
@message = data[:error]
|
46
|
+
elsif !data[:error][:message].nil?
|
47
|
+
@message = data[:error][:message]
|
48
|
+
end
|
49
|
+
elsif !data[:Error].nil? && !data[:Error][:Message].nil?
|
50
|
+
@message = data[:Error][:Message]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if arg.key?(:arg) then
|
56
|
+
@code = arg[:Code]
|
57
|
+
end
|
58
|
+
|
59
|
+
else
|
60
|
+
super arg
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# ------------------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose Pty Ltd" file="configuration.rb">
|
3
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
4
|
+
# </copyright>
|
5
|
+
# <summary>
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
# </summary>
|
24
|
+
# ------------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
module GroupDocsParserCloud
|
27
|
+
#
|
28
|
+
# Class for storing API configuration info
|
29
|
+
#
|
30
|
+
class Configuration
|
31
|
+
|
32
|
+
# Api base url, default is 'https://api.groupdocs.cloud'
|
33
|
+
#
|
34
|
+
# @return [String] Api base url
|
35
|
+
attr_accessor :api_base_url
|
36
|
+
|
37
|
+
# Api version, default is '/v1.0'
|
38
|
+
#
|
39
|
+
# @return [String] Api version
|
40
|
+
attr_accessor :api_version
|
41
|
+
|
42
|
+
# Application identifier (App SID)
|
43
|
+
#
|
44
|
+
# @return [String] Application identifier (App SID)
|
45
|
+
attr_accessor :app_sid
|
46
|
+
|
47
|
+
# Application private key (App Key)
|
48
|
+
#
|
49
|
+
# @return [String] Application private key (App Key)
|
50
|
+
attr_accessor :app_key
|
51
|
+
|
52
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
53
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
54
|
+
# Default value is false.
|
55
|
+
#
|
56
|
+
# @return [true, false]
|
57
|
+
attr_accessor :debugging
|
58
|
+
|
59
|
+
# Defines the logger used for debugging.
|
60
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
61
|
+
#
|
62
|
+
# @return [#logger]
|
63
|
+
attr_accessor :logger
|
64
|
+
|
65
|
+
# Defines the temporary folder to store downloaded files
|
66
|
+
# (for API endpoints that have file response).
|
67
|
+
# System temporary folder is used by default.
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
attr_accessor :temp_folder_path
|
71
|
+
|
72
|
+
# Set this to false to skip client side validation in the operation.
|
73
|
+
# Default to true.
|
74
|
+
# @return [true, false]
|
75
|
+
attr_accessor :client_side_validation
|
76
|
+
|
77
|
+
# Initializes new instance of Configuration
|
78
|
+
#
|
79
|
+
# @param [app_sid] Application identifier (App SID)
|
80
|
+
# @param [app_key] Application private key (App Key)
|
81
|
+
# @return [Configuration] New instance of Configuration
|
82
|
+
def initialize(app_sid, app_key)
|
83
|
+
@api_base_url = "https://api.groupdocs.cloud"
|
84
|
+
@api_version = '/v1.0'
|
85
|
+
@app_sid = app_sid
|
86
|
+
@app_key = app_key
|
87
|
+
@client_side_validation = true
|
88
|
+
@debugging = false
|
89
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
90
|
+
|
91
|
+
yield(self) if block_given?
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="container_item.rb">
|
4
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsParserCloud
|
31
|
+
# Represents a container item like Zip archive entity, email attachment, PDF Portfolio item and so on.
|
32
|
+
class ContainerItem
|
33
|
+
|
34
|
+
# Gets or sets the name of the item.
|
35
|
+
attr_accessor :name
|
36
|
+
|
37
|
+
# Gets or sets the full path of the item.
|
38
|
+
attr_accessor :file_path
|
39
|
+
|
40
|
+
# Gets or sets the directory of the item.
|
41
|
+
attr_accessor :directory
|
42
|
+
|
43
|
+
# Gets or sets the collection of metadata items.
|
44
|
+
attr_accessor :metadata
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'name' => :'Name',
|
50
|
+
:'file_path' => :'FilePath',
|
51
|
+
:'directory' => :'Directory',
|
52
|
+
:'metadata' => :'Metadata'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'name' => :'String',
|
60
|
+
:'file_path' => :'String',
|
61
|
+
:'directory' => :'String',
|
62
|
+
:'metadata' => :'Hash<String, 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.key?(:'Name')
|
75
|
+
self.name = attributes[:'Name']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'FilePath')
|
79
|
+
self.file_path = attributes[:'FilePath']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'Directory')
|
83
|
+
self.directory = attributes[:'Directory']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'Metadata')
|
87
|
+
if (value = attributes[:'Metadata']).is_a?(Hash)
|
88
|
+
self.metadata = value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
+
# @return Array for valid properies with the reasons
|
96
|
+
def list_invalid_properties
|
97
|
+
invalid_properties = []
|
98
|
+
return invalid_properties
|
99
|
+
end
|
100
|
+
|
101
|
+
# Check to see if the all the properties in the model are valid
|
102
|
+
# @return true if the model is valid
|
103
|
+
def valid?
|
104
|
+
return true
|
105
|
+
end
|
106
|
+
|
107
|
+
# Checks equality by comparing each attribute.
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def ==(other)
|
110
|
+
return true if self.equal?(other)
|
111
|
+
self.class == other.class &&
|
112
|
+
name == other.name &&
|
113
|
+
file_path == other.file_path &&
|
114
|
+
directory == other.directory &&
|
115
|
+
metadata == other.metadata
|
116
|
+
end
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def eql?(other)
|
121
|
+
self == other
|
122
|
+
end
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Fixnum] Hash code
|
126
|
+
def hash
|
127
|
+
[name, file_path, directory, metadata].hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# Downcases first letter.
|
131
|
+
# @return downcased string
|
132
|
+
def uncap(str)
|
133
|
+
str[0, 1].downcase + str[1..-1]
|
134
|
+
end
|
135
|
+
|
136
|
+
# Builds the object from hash
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
138
|
+
# @return [Object] Returns the model itself
|
139
|
+
def build_from_hash(attributes)
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
141
|
+
self.class.swagger_types.each_pair do |key, type|
|
142
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
143
|
+
value = attributes[pname]
|
144
|
+
if type =~ /\AArray<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if value.is_a?(Array)
|
148
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
149
|
+
end
|
150
|
+
elsif !value.nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, value))
|
152
|
+
end
|
153
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
154
|
+
end
|
155
|
+
|
156
|
+
self
|
157
|
+
end
|
158
|
+
|
159
|
+
# Deserializes the data based on type
|
160
|
+
# @param string type Data type
|
161
|
+
# @param string value Value to be deserialized
|
162
|
+
# @return [Object] Deserialized data
|
163
|
+
def _deserialize(type, value)
|
164
|
+
case type.to_sym
|
165
|
+
when :DateTime
|
166
|
+
Date.parse value
|
167
|
+
when :Date
|
168
|
+
Date.parse value
|
169
|
+
when :String
|
170
|
+
value.to_s
|
171
|
+
when :Integer
|
172
|
+
value.to_i
|
173
|
+
when :Float
|
174
|
+
value.to_f
|
175
|
+
when :BOOLEAN
|
176
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
177
|
+
true
|
178
|
+
else
|
179
|
+
false
|
180
|
+
end
|
181
|
+
when :Object
|
182
|
+
# generic object (usually a Hash), return directly
|
183
|
+
value
|
184
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
185
|
+
inner_type = Regexp.last_match[:inner_type]
|
186
|
+
value.map { |v| _deserialize(inner_type, v) }
|
187
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
188
|
+
k_type = Regexp.last_match[:k_type]
|
189
|
+
v_type = Regexp.last_match[:v_type]
|
190
|
+
{}.tap do |hash|
|
191
|
+
value.each do |k, v|
|
192
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
else
|
196
|
+
# model
|
197
|
+
temp_model = GroupDocsParserCloud.const_get(type).new
|
198
|
+
temp_model.build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the string representation of the object
|
203
|
+
# @return [String] String presentation of the object
|
204
|
+
def to_s
|
205
|
+
to_hash.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the object in the form of hash
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
next if value.nil?
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map { |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="container_item_info.rb">
|
4
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsParserCloud
|
31
|
+
# Container item info.
|
32
|
+
class ContainerItemInfo
|
33
|
+
|
34
|
+
# The relative path of the container.
|
35
|
+
attr_accessor :relative_path
|
36
|
+
|
37
|
+
# Password for processing password-protected container item.
|
38
|
+
attr_accessor :password
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'relative_path' => :'RelativePath',
|
44
|
+
:'password' => :'Password'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'relative_path' => :'String',
|
52
|
+
:'password' => :'String'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
|
+
|
64
|
+
if attributes.key?(:'RelativePath')
|
65
|
+
self.relative_path = attributes[:'RelativePath']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'Password')
|
69
|
+
self.password = attributes[:'Password']
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
+
# @return Array for valid properies with the reasons
|
76
|
+
def list_invalid_properties
|
77
|
+
invalid_properties = []
|
78
|
+
return invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(other)
|
90
|
+
return true if self.equal?(other)
|
91
|
+
self.class == other.class &&
|
92
|
+
relative_path == other.relative_path &&
|
93
|
+
password == other.password
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see the `==` method
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def eql?(other)
|
99
|
+
self == other
|
100
|
+
end
|
101
|
+
|
102
|
+
# Calculates hash code according to all attributes.
|
103
|
+
# @return [Fixnum] Hash code
|
104
|
+
def hash
|
105
|
+
[relative_path, password].hash
|
106
|
+
end
|
107
|
+
|
108
|
+
# Downcases first letter.
|
109
|
+
# @return downcased string
|
110
|
+
def uncap(str)
|
111
|
+
str[0, 1].downcase + str[1..-1]
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.swagger_types.each_pair do |key, type|
|
120
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
121
|
+
value = attributes[pname]
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if value.is_a?(Array)
|
126
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !value.nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, value))
|
130
|
+
end
|
131
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Deserializes the data based on type
|
138
|
+
# @param string type Data type
|
139
|
+
# @param string value Value to be deserialized
|
140
|
+
# @return [Object] Deserialized data
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :DateTime
|
144
|
+
Date.parse value
|
145
|
+
when :Date
|
146
|
+
Date.parse value
|
147
|
+
when :String
|
148
|
+
value.to_s
|
149
|
+
when :Integer
|
150
|
+
value.to_i
|
151
|
+
when :Float
|
152
|
+
value.to_f
|
153
|
+
when :BOOLEAN
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
+
true
|
156
|
+
else
|
157
|
+
false
|
158
|
+
end
|
159
|
+
when :Object
|
160
|
+
# generic object (usually a Hash), return directly
|
161
|
+
value
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each do |k, v|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
else
|
174
|
+
# model
|
175
|
+
temp_model = GroupDocsParserCloud.const_get(type).new
|
176
|
+
temp_model.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
next if value.nil?
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|