AsposeDiagramCloud 18.10 → 20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/AsposeDiagramCloud.gemspec +46 -0
- data/Gemfile +7 -0
- data/README.md +74 -0
- data/Rakefile +8 -0
- data/git_push.sh +55 -0
- data/lib/AsposeDiagramCloud.rb +85 -0
- data/lib/AsposeDiagramCloud/api/diagram_api.rb +768 -0
- data/lib/AsposeDiagramCloud/api/o_auth_api.rb +93 -0
- data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
- data/lib/AsposeDiagramCloud/api_client.rb +391 -0
- data/lib/AsposeDiagramCloud/api_error.rb +38 -0
- data/lib/AsposeDiagramCloud/configuration.rb +209 -0
- data/lib/AsposeDiagramCloud/models/access_token_response.rb +251 -0
- data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
- data/lib/AsposeDiagramCloud/models/create_new_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
- data/lib/AsposeDiagramCloud/models/disc_usage.rb +209 -0
- data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/error.rb +219 -0
- data/lib/AsposeDiagramCloud/models/error_details.rb +204 -0
- data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
- data/lib/AsposeDiagramCloud/models/file_versions.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
- data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
- data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
- data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
- data/lib/AsposeDiagramCloud/models/object_exist.rb +209 -0
- data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
- data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
- data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
- data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
- data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
- data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
- data/lib/AsposeDiagramCloud/models/point_f.rb +221 -0
- data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
- data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
- data/lib/AsposeDiagramCloud/models/saa_spose_response.rb +179 -0
- data/lib/AsposeDiagramCloud/models/save_as_response.rb +208 -0
- data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
- data/lib/AsposeDiagramCloud/models/save_options_request.rb +206 -0
- data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
- data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
- data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
- data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
- data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
- data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
- data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
- data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/version.rb +15 -0
- data/spec/_spec.rb +308 -0
- data/spec/api/test_convert_spec.rb +308 -0
- data/spec/api/test_drawing_spec.rb +136 -0
- data/spec/api/test_page_spec.rb +92 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/spec_helper.rb +120 -0
- data/testData/FileUpload.vdx +437 -0
- metadata +118 -49
@@ -0,0 +1,188 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AsposeDiagramCloud
|
16
|
+
|
17
|
+
class UploadResponse
|
18
|
+
attr_accessor :uploaded
|
19
|
+
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'uploaded' => :'Uploaded'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'uploaded' => :'String'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
42
|
+
|
43
|
+
if attributes.has_key?(:'Uploaded')
|
44
|
+
self.uploaded = attributes[:'Uploaded']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
50
|
+
# @return Array for valid properies with the reasons
|
51
|
+
def list_invalid_properties
|
52
|
+
invalid_properties = Array.new
|
53
|
+
return invalid_properties
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check to see if the all the properties in the model are valid
|
57
|
+
# @return true if the model is valid
|
58
|
+
def valid?
|
59
|
+
return true
|
60
|
+
end
|
61
|
+
|
62
|
+
# Checks equality by comparing each attribute.
|
63
|
+
# @param [Object] Object to be compared
|
64
|
+
def ==(o)
|
65
|
+
return true if self.equal?(o)
|
66
|
+
self.class == o.class &&
|
67
|
+
uploaded == o.uploaded
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see the `==` method
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def eql?(o)
|
73
|
+
self == o
|
74
|
+
end
|
75
|
+
|
76
|
+
# Calculates hash code according to all attributes.
|
77
|
+
# @return [Fixnum] Hash code
|
78
|
+
def hash
|
79
|
+
[uploaded].hash
|
80
|
+
end
|
81
|
+
|
82
|
+
# Builds the object from hash
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
# @return [Object] Returns the model itself
|
85
|
+
def build_from_hash(attributes)
|
86
|
+
return nil unless attributes.is_a?(Hash)
|
87
|
+
self.class.swagger_types.each_pair do |key, type|
|
88
|
+
if type =~ /\AArray<(.*)>/i
|
89
|
+
# check to ensure the input is an array given that the the attribute
|
90
|
+
# is documented as an array but the input is not
|
91
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
92
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
93
|
+
end
|
94
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
95
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
96
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
97
|
+
end
|
98
|
+
|
99
|
+
self
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deserializes the data based on type
|
103
|
+
# @param string type Data type
|
104
|
+
# @param string value Value to be deserialized
|
105
|
+
# @return [Object] Deserialized data
|
106
|
+
def _deserialize(type, value)
|
107
|
+
case type.to_sym
|
108
|
+
when :DateTime
|
109
|
+
DateTime.parse(value)
|
110
|
+
when :Date
|
111
|
+
Date.parse(value)
|
112
|
+
when :String
|
113
|
+
value.to_s
|
114
|
+
when :Integer
|
115
|
+
value.to_i
|
116
|
+
when :Float
|
117
|
+
value.to_f
|
118
|
+
when :BOOLEAN
|
119
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
120
|
+
true
|
121
|
+
else
|
122
|
+
false
|
123
|
+
end
|
124
|
+
when :Object
|
125
|
+
# generic object (usually a Hash), return directly
|
126
|
+
value
|
127
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
128
|
+
inner_type = Regexp.last_match[:inner_type]
|
129
|
+
value.map { |v| _deserialize(inner_type, v) }
|
130
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
131
|
+
k_type = Regexp.last_match[:k_type]
|
132
|
+
v_type = Regexp.last_match[:v_type]
|
133
|
+
{}.tap do |hash|
|
134
|
+
value.each do |k, v|
|
135
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
else # model
|
139
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
140
|
+
temp_model.build_from_hash(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the string representation of the object
|
145
|
+
# @return [String] String presentation of the object
|
146
|
+
def to_s
|
147
|
+
to_hash.to_s
|
148
|
+
end
|
149
|
+
|
150
|
+
# to_body is an alias to to_hash (backward compatibility)
|
151
|
+
# @return [Hash] Returns the object in the form of hash
|
152
|
+
def to_body
|
153
|
+
to_hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the object in the form of hash
|
157
|
+
# @return [Hash] Returns the object in the form of hash
|
158
|
+
def to_hash
|
159
|
+
hash = {}
|
160
|
+
self.class.attribute_map.each_pair do |attr, param|
|
161
|
+
value = self.send(attr)
|
162
|
+
next if value.nil?
|
163
|
+
hash[param] = _to_hash(value)
|
164
|
+
end
|
165
|
+
hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Outputs non-array value in the form of hash
|
169
|
+
# For object, use to_hash. Otherwise, just return the value
|
170
|
+
# @param [Object] value Any valid value
|
171
|
+
# @return [Hash] Returns the value in the form of hash
|
172
|
+
def _to_hash(value)
|
173
|
+
if value.is_a?(Array)
|
174
|
+
value.compact.map{ |v| _to_hash(v) }
|
175
|
+
elsif value.is_a?(Hash)
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
178
|
+
end
|
179
|
+
elsif value.respond_to? :to_hash
|
180
|
+
value.to_hash
|
181
|
+
else
|
182
|
+
value
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AsposeDiagramCloud
|
16
|
+
|
17
|
+
class XAMLSaveOptions
|
18
|
+
attr_accessor :save_format
|
19
|
+
|
20
|
+
attr_accessor :default_font
|
21
|
+
|
22
|
+
attr_accessor :page_count
|
23
|
+
|
24
|
+
attr_accessor :page_index
|
25
|
+
|
26
|
+
attr_accessor :save_foreground_pages_only
|
27
|
+
|
28
|
+
class EnumAttributeValidator
|
29
|
+
attr_reader :datatype
|
30
|
+
attr_reader :allowable_values
|
31
|
+
|
32
|
+
def initialize(datatype, allowable_values)
|
33
|
+
@allowable_values = allowable_values.map do |value|
|
34
|
+
case datatype.to_s
|
35
|
+
when /Integer/i
|
36
|
+
value.to_i
|
37
|
+
when /Float/i
|
38
|
+
value.to_f
|
39
|
+
else
|
40
|
+
value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def valid?(value)
|
46
|
+
!value || allowable_values.include?(value)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
51
|
+
def self.attribute_map
|
52
|
+
{
|
53
|
+
:'save_format' => :'SaveFormat',
|
54
|
+
:'default_font' => :'DefaultFont',
|
55
|
+
:'page_count' => :'PageCount',
|
56
|
+
:'page_index' => :'PageIndex',
|
57
|
+
:'save_foreground_pages_only' => :'SaveForegroundPagesOnly'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute type mapping.
|
62
|
+
def self.swagger_types
|
63
|
+
{
|
64
|
+
:'save_format' => :'String',
|
65
|
+
:'default_font' => :'String',
|
66
|
+
:'page_count' => :'Integer',
|
67
|
+
:'page_index' => :'Integer',
|
68
|
+
:'save_foreground_pages_only' => :'BOOLEAN'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
return unless attributes.is_a?(Hash)
|
76
|
+
|
77
|
+
# convert string to symbol for hash key
|
78
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
79
|
+
|
80
|
+
if attributes.has_key?(:'SaveFormat')
|
81
|
+
self.save_format = attributes[:'SaveFormat']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'DefaultFont')
|
85
|
+
self.default_font = attributes[:'DefaultFont']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'PageCount')
|
89
|
+
self.page_count = attributes[:'PageCount']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'PageIndex')
|
93
|
+
self.page_index = attributes[:'PageIndex']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'SaveForegroundPagesOnly')
|
97
|
+
self.save_foreground_pages_only = attributes[:'SaveForegroundPagesOnly']
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
+
# @return Array for valid properies with the reasons
|
104
|
+
def list_invalid_properties
|
105
|
+
invalid_properties = Array.new
|
106
|
+
if @save_format.nil?
|
107
|
+
invalid_properties.push("invalid value for 'save_format', save_format cannot be nil.")
|
108
|
+
end
|
109
|
+
|
110
|
+
return invalid_properties
|
111
|
+
end
|
112
|
+
|
113
|
+
# Check to see if the all the properties in the model are valid
|
114
|
+
# @return true if the model is valid
|
115
|
+
def valid?
|
116
|
+
return false if @save_format.nil?
|
117
|
+
save_format_validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
118
|
+
return false unless save_format_validator.valid?(@save_format)
|
119
|
+
return true
|
120
|
+
end
|
121
|
+
|
122
|
+
# Custom attribute writer method checking allowed values (enum).
|
123
|
+
# @param [Object] save_format Object to be assigned
|
124
|
+
def save_format=(save_format)
|
125
|
+
validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
126
|
+
unless validator.valid?(save_format)
|
127
|
+
fail ArgumentError, "invalid value for 'save_format', must be one of #{validator.allowable_values}."
|
128
|
+
end
|
129
|
+
@save_format = save_format
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
save_format == o.save_format &&
|
138
|
+
default_font == o.default_font &&
|
139
|
+
page_count == o.page_count &&
|
140
|
+
page_index == o.page_index &&
|
141
|
+
save_foreground_pages_only == o.save_foreground_pages_only
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def eql?(o)
|
147
|
+
self == o
|
148
|
+
end
|
149
|
+
|
150
|
+
# Calculates hash code according to all attributes.
|
151
|
+
# @return [Fixnum] Hash code
|
152
|
+
def hash
|
153
|
+
[save_format, default_font, page_count, page_index, save_foreground_pages_only].hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def build_from_hash(attributes)
|
160
|
+
return nil unless attributes.is_a?(Hash)
|
161
|
+
self.class.swagger_types.each_pair do |key, type|
|
162
|
+
if type =~ /\AArray<(.*)>/i
|
163
|
+
# check to ensure the input is an array given that the the attribute
|
164
|
+
# is documented as an array but the input is not
|
165
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
167
|
+
end
|
168
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
169
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
170
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
171
|
+
end
|
172
|
+
|
173
|
+
self
|
174
|
+
end
|
175
|
+
|
176
|
+
# Deserializes the data based on type
|
177
|
+
# @param string type Data type
|
178
|
+
# @param string value Value to be deserialized
|
179
|
+
# @return [Object] Deserialized data
|
180
|
+
def _deserialize(type, value)
|
181
|
+
case type.to_sym
|
182
|
+
when :DateTime
|
183
|
+
DateTime.parse(value)
|
184
|
+
when :Date
|
185
|
+
Date.parse(value)
|
186
|
+
when :String
|
187
|
+
value.to_s
|
188
|
+
when :Integer
|
189
|
+
value.to_i
|
190
|
+
when :Float
|
191
|
+
value.to_f
|
192
|
+
when :BOOLEAN
|
193
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
194
|
+
true
|
195
|
+
else
|
196
|
+
false
|
197
|
+
end
|
198
|
+
when :Object
|
199
|
+
# generic object (usually a Hash), return directly
|
200
|
+
value
|
201
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
202
|
+
inner_type = Regexp.last_match[:inner_type]
|
203
|
+
value.map { |v| _deserialize(inner_type, v) }
|
204
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
205
|
+
k_type = Regexp.last_match[:k_type]
|
206
|
+
v_type = Regexp.last_match[:v_type]
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each do |k, v|
|
209
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
else # model
|
213
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
214
|
+
temp_model.build_from_hash(value)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the string representation of the object
|
219
|
+
# @return [String] String presentation of the object
|
220
|
+
def to_s
|
221
|
+
to_hash.to_s
|
222
|
+
end
|
223
|
+
|
224
|
+
# to_body is an alias to to_hash (backward compatibility)
|
225
|
+
# @return [Hash] Returns the object in the form of hash
|
226
|
+
def to_body
|
227
|
+
to_hash
|
228
|
+
end
|
229
|
+
|
230
|
+
# Returns the object in the form of hash
|
231
|
+
# @return [Hash] Returns the object in the form of hash
|
232
|
+
def to_hash
|
233
|
+
hash = {}
|
234
|
+
self.class.attribute_map.each_pair do |attr, param|
|
235
|
+
value = self.send(attr)
|
236
|
+
next if value.nil?
|
237
|
+
hash[param] = _to_hash(value)
|
238
|
+
end
|
239
|
+
hash
|
240
|
+
end
|
241
|
+
|
242
|
+
# Outputs non-array value in the form of hash
|
243
|
+
# For object, use to_hash. Otherwise, just return the value
|
244
|
+
# @param [Object] value Any valid value
|
245
|
+
# @return [Hash] Returns the value in the form of hash
|
246
|
+
def _to_hash(value)
|
247
|
+
if value.is_a?(Array)
|
248
|
+
value.compact.map{ |v| _to_hash(v) }
|
249
|
+
elsif value.is_a?(Hash)
|
250
|
+
{}.tap do |hash|
|
251
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
252
|
+
end
|
253
|
+
elsif value.respond_to? :to_hash
|
254
|
+
value.to_hash
|
255
|
+
else
|
256
|
+
value
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AsposeDiagramCloud
|
16
|
+
|
17
|
+
class XPSSaveOptions
|
18
|
+
attr_accessor :save_format
|
19
|
+
|
20
|
+
attr_accessor :default_font
|
21
|
+
|
22
|
+
attr_accessor :page_count
|
23
|
+
|
24
|
+
attr_accessor :export_hidden_page
|
25
|
+
|
26
|
+
attr_accessor :page_index
|
27
|
+
|
28
|
+
attr_accessor :save_foreground_pages_only
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'save_format' => :'SaveFormat',
|
56
|
+
:'default_font' => :'DefaultFont',
|
57
|
+
:'page_count' => :'PageCount',
|
58
|
+
:'export_hidden_page' => :'ExportHiddenPage',
|
59
|
+
:'page_index' => :'PageIndex',
|
60
|
+
:'save_foreground_pages_only' => :'SaveForegroundPagesOnly'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.swagger_types
|
66
|
+
{
|
67
|
+
:'save_format' => :'String',
|
68
|
+
:'default_font' => :'String',
|
69
|
+
:'page_count' => :'Integer',
|
70
|
+
:'export_hidden_page' => :'BOOLEAN',
|
71
|
+
:'page_index' => :'Integer',
|
72
|
+
:'save_foreground_pages_only' => :'BOOLEAN'
|
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?(:'SaveFormat')
|
85
|
+
self.save_format = attributes[:'SaveFormat']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'DefaultFont')
|
89
|
+
self.default_font = attributes[:'DefaultFont']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'PageCount')
|
93
|
+
self.page_count = attributes[:'PageCount']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'ExportHiddenPage')
|
97
|
+
self.export_hidden_page = attributes[:'ExportHiddenPage']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:'PageIndex')
|
101
|
+
self.page_index = attributes[:'PageIndex']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'SaveForegroundPagesOnly')
|
105
|
+
self.save_foreground_pages_only = attributes[:'SaveForegroundPagesOnly']
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
111
|
+
# @return Array for valid properies with the reasons
|
112
|
+
def list_invalid_properties
|
113
|
+
invalid_properties = Array.new
|
114
|
+
if @save_format.nil?
|
115
|
+
invalid_properties.push("invalid value for 'save_format', save_format cannot be nil.")
|
116
|
+
end
|
117
|
+
|
118
|
+
return invalid_properties
|
119
|
+
end
|
120
|
+
|
121
|
+
# Check to see if the all the properties in the model are valid
|
122
|
+
# @return true if the model is valid
|
123
|
+
def valid?
|
124
|
+
return false if @save_format.nil?
|
125
|
+
save_format_validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
126
|
+
return false unless save_format_validator.valid?(@save_format)
|
127
|
+
return true
|
128
|
+
end
|
129
|
+
|
130
|
+
# Custom attribute writer method checking allowed values (enum).
|
131
|
+
# @param [Object] save_format Object to be assigned
|
132
|
+
def save_format=(save_format)
|
133
|
+
validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
134
|
+
unless validator.valid?(save_format)
|
135
|
+
fail ArgumentError, "invalid value for 'save_format', must be one of #{validator.allowable_values}."
|
136
|
+
end
|
137
|
+
@save_format = save_format
|
138
|
+
end
|
139
|
+
|
140
|
+
# Checks equality by comparing each attribute.
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def ==(o)
|
143
|
+
return true if self.equal?(o)
|
144
|
+
self.class == o.class &&
|
145
|
+
save_format == o.save_format &&
|
146
|
+
default_font == o.default_font &&
|
147
|
+
page_count == o.page_count &&
|
148
|
+
export_hidden_page == o.export_hidden_page &&
|
149
|
+
page_index == o.page_index &&
|
150
|
+
save_foreground_pages_only == o.save_foreground_pages_only
|
151
|
+
end
|
152
|
+
|
153
|
+
# @see the `==` method
|
154
|
+
# @param [Object] Object to be compared
|
155
|
+
def eql?(o)
|
156
|
+
self == o
|
157
|
+
end
|
158
|
+
|
159
|
+
# Calculates hash code according to all attributes.
|
160
|
+
# @return [Fixnum] Hash code
|
161
|
+
def hash
|
162
|
+
[save_format, default_font, page_count, export_hidden_page, page_index, save_foreground_pages_only].hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Builds the object from hash
|
166
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
167
|
+
# @return [Object] Returns the model itself
|
168
|
+
def build_from_hash(attributes)
|
169
|
+
return nil unless attributes.is_a?(Hash)
|
170
|
+
self.class.swagger_types.each_pair do |key, type|
|
171
|
+
if type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
176
|
+
end
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
180
|
+
end
|
181
|
+
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def _deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :DateTime
|
192
|
+
DateTime.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :BOOLEAN
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
223
|
+
temp_model.build_from_hash(value)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the string representation of the object
|
228
|
+
# @return [String] String presentation of the object
|
229
|
+
def to_s
|
230
|
+
to_hash.to_s
|
231
|
+
end
|
232
|
+
|
233
|
+
# to_body is an alias to to_hash (backward compatibility)
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_body
|
236
|
+
to_hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns the object in the form of hash
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
241
|
+
def to_hash
|
242
|
+
hash = {}
|
243
|
+
self.class.attribute_map.each_pair do |attr, param|
|
244
|
+
value = self.send(attr)
|
245
|
+
next if value.nil?
|
246
|
+
hash[param] = _to_hash(value)
|
247
|
+
end
|
248
|
+
hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Outputs non-array value in the form of hash
|
252
|
+
# For object, use to_hash. Otherwise, just return the value
|
253
|
+
# @param [Object] value Any valid value
|
254
|
+
# @return [Hash] Returns the value in the form of hash
|
255
|
+
def _to_hash(value)
|
256
|
+
if value.is_a?(Array)
|
257
|
+
value.compact.map{ |v| _to_hash(v) }
|
258
|
+
elsif value.is_a?(Hash)
|
259
|
+
{}.tap do |hash|
|
260
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
261
|
+
end
|
262
|
+
elsif value.respond_to? :to_hash
|
263
|
+
value.to_hash
|
264
|
+
else
|
265
|
+
value
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|