aspose_html_cloud 19.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="base_model.rb">
5
+ </copyright>
6
+ Copyright (c) 2019 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require 'date'
30
+
31
+ module AsposeHtml
32
+ # Base class for models
33
+ class BaseModel
34
+
35
+ # @see the `==` method
36
+ # @param [Object] Object to be compared
37
+ def eql?(o)
38
+ self == o
39
+ end
40
+
41
+ # Builds the object from hash
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @return [Object] Returns the model itself
44
+ def build_from_hash(attributes)
45
+ return nil unless attributes.is_a?(Hash)
46
+ self.class.model_types.each_pair do |key, type|
47
+ if type =~ /\AArray<(.*)>/i
48
+ # check to ensure the input is an array given that the the attribute
49
+ # is documented as an array but the input is not
50
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
51
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
52
+ end
53
+ elsif !attributes[self.class.attribute_map[key]].nil?
54
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
55
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
56
+ end
57
+
58
+ self
59
+ end
60
+
61
+ # Deserializes the data based on type
62
+ # @param string type Data type
63
+ # @param string value Value to be deserialized
64
+ # @return [Object] Deserialized data
65
+ def _deserialize(type, value)
66
+ case type.to_sym
67
+ when :DateTime
68
+ DateTime.parse(value)
69
+ when :Date
70
+ Date.parse(value)
71
+ when :String
72
+ value.to_s
73
+ when :Integer
74
+ value.to_i
75
+ when :Float
76
+ value.to_f
77
+ when :BOOLEAN
78
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
79
+ true
80
+ else
81
+ false
82
+ end
83
+ when :Object
84
+ # generic object (usually a Hash), return directly
85
+ value
86
+ when /\AArray<(?<inner_type>.+)>\z/
87
+ inner_type = Regexp.last_match[:inner_type]
88
+ value.map { |v| _deserialize(inner_type, v) }
89
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
90
+ k_type = Regexp.last_match[:k_type]
91
+ v_type = Regexp.last_match[:v_type]
92
+ {}.tap do |hash|
93
+ value.each do |k, v|
94
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
95
+ end
96
+ end
97
+ else # model
98
+ temp_model = AsposeHtml.const_get(type).new
99
+ temp_model.build_from_hash(value)
100
+ end
101
+ end
102
+
103
+ # Returns the string representation of the object
104
+ # @return [String] String presentation of the object
105
+ def to_s
106
+ to_hash.to_s
107
+ end
108
+
109
+ # to_body is an alias to to_hash (backward compatibility)
110
+ # @return [Hash] Returns the object in the form of hash
111
+ def to_body
112
+ to_hash
113
+ end
114
+
115
+ # Returns the object in the form of hash
116
+ # @return [Hash] Returns the object in the form of hash
117
+ def to_hash
118
+ hash = {}
119
+ self.class.attribute_map.each_pair do |attr, param|
120
+ value = self.send(attr)
121
+ next if value.nil?
122
+ hash[param] = _to_hash(value)
123
+ end
124
+ hash
125
+ end
126
+
127
+ # Outputs non-array value in the form of hash
128
+ # For object, use to_hash. Otherwise, just return the value
129
+ # @param [Object] value Any valid value
130
+ # @return [Hash] Returns the value in the form of hash
131
+ def _to_hash(value)
132
+ if value.is_a?(Array)
133
+ value.compact.map { |v| _to_hash(v) }
134
+ elsif value.is_a?(Hash)
135
+ {}.tap do |hash|
136
+ value.each { |k, v| hash[k] = _to_hash(v) }
137
+ end
138
+ elsif value.respond_to? :to_hash
139
+ value.to_hash
140
+ else
141
+ value
142
+ end
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,113 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="disc_usage.rb">
5
+ </copyright>
6
+ Copyright (c) 2019 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require_relative 'base_model'
30
+
31
+ module AsposeHtml
32
+ # Class for disc space information.
33
+ class DiscUsage < BaseModel
34
+
35
+ # Application used disc space.
36
+ attr_accessor :used_size
37
+
38
+ # Total disc space.
39
+ attr_accessor :total_size
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'used_size' => :'usedSize',
45
+ :'total_size' => :'totalSize'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.model_types
51
+ {
52
+ :'used_size' => :'Integer',
53
+ :'total_size' => :'Integer'
54
+ }
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ if attributes.has_key?(:'usedSize')
66
+ self.used_size = attributes[:'usedSize']
67
+ end
68
+
69
+ if attributes.has_key?(:'totalSize')
70
+ self.total_size = attributes[:'totalSize']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if @used_size.nil?
79
+ invalid_properties.push('invalid value for "used_size", used_size cannot be nil.')
80
+ end
81
+
82
+ if @total_size.nil?
83
+ invalid_properties.push('invalid value for "total_size", total_size cannot be nil.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if @used_size.nil?
93
+ return false if @total_size.nil?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ used_size == o.used_size &&
103
+ total_size == o.total_size
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Fixnum] Hash code
108
+ def hash
109
+ [used_size, total_size].hash
110
+ end
111
+
112
+ end
113
+ end
@@ -0,0 +1,122 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="error.rb">
5
+ </copyright>
6
+ Copyright (c) 2019 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require_relative 'base_model'
30
+
31
+ module AsposeHtml
32
+ # Error
33
+ class Error < BaseModel
34
+ # Code
35
+ attr_accessor :code
36
+
37
+ # Message
38
+ attr_accessor :message
39
+
40
+ # Description
41
+ attr_accessor :description
42
+
43
+ # Inner Error
44
+ attr_accessor :inner_error
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'code' => :'code',
50
+ :'message' => :'message',
51
+ :'description' => :'description',
52
+ :'inner_error' => :'innerError'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.model_types
58
+ {
59
+ :'code' => :'String',
60
+ :'message' => :'String',
61
+ :'description' => :'String',
62
+ :'inner_error' => :'ErrorDetails'
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?(:'code')
75
+ self.code = attributes[:'code']
76
+ end
77
+
78
+ if attributes.has_key?(:'message')
79
+ self.message = attributes[:'message']
80
+ end
81
+
82
+ if attributes.has_key?(:'description')
83
+ self.description = attributes[:'description']
84
+ end
85
+
86
+ if attributes.has_key?(:'inner_error')
87
+ self.inner_error = attributes[:'inner_error']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ code == o.code &&
110
+ message == o.message &&
111
+ description == o.description &&
112
+ inner_error == o.inner_error
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Fixnum] Hash code
117
+ def hash
118
+ [code, message, description, inner_error].hash
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,107 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="error_details.rb">
5
+ </copyright>
6
+ Copyright (c) 2019 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require_relative 'base_model'
30
+
31
+ module AsposeHtml
32
+ # The error details
33
+ class ErrorDetails < BaseModel
34
+ # The request id
35
+ attr_accessor :request_id
36
+
37
+ # Date
38
+ attr_accessor :date
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'request_id' => :'requestId',
44
+ :'date' => :'date'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.model_types
50
+ {
51
+ :'request_id' => :'String',
52
+ :'date' => :'DateTime'
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.has_key?(:'request_id')
65
+ self.request_id = attributes[:'request_id']
66
+ end
67
+
68
+ if attributes.has_key?(:'date')
69
+ self.date = attributes[:'date']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ if @date.nil?
78
+ invalid_properties.push('invalid value for "date", date cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @date.nil?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ request_id == o.request_id &&
97
+ date == o.date
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Fixnum] Hash code
102
+ def hash
103
+ [request_id, date].hash
104
+ end
105
+
106
+ end
107
+ end