aspose_slides_cloud 20.12.0 → 21.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,8 +91,7 @@ module AsposeSlidesCloud
91
91
  else
92
92
  fail ApiError.new(:code => response.status,
93
93
  :response_headers => response.headers,
94
- :response_body => response.body),
95
- response.reason_phrase
94
+ :response_body => response.body)
96
95
  end
97
96
  end
98
97
 
@@ -138,7 +137,6 @@ module AsposeSlidesCloud
138
137
  # @param [String] path URL path (e.g. /account/new)
139
138
  # @option opts [Hash] :header_params Header parameters
140
139
  # @option opts [Hash] :query_params Query parameters
141
- # @option opts [Hash] :form_params Query parameters
142
140
  # @option opts [Object] :body HTTP body (JSON/XML)
143
141
  # @return [Typhoeus::Request] A Typhoeus Request
144
142
  def build_request(req, http_method, path, opts = {})
@@ -153,8 +151,7 @@ module AsposeSlidesCloud
153
151
  req.url path.sub(/^\/+/, '')
154
152
  req.headers = opts[:header_params]
155
153
  req.params = opts[:query_params]
156
- form_params = opts[:form_params] || {}
157
- req.body = build_request_body(req.headers, form_params, opts[:body], opts[:files])
154
+ req.body = build_request_body(req.headers, opts[:body], opts[:files])
158
155
  set_headers(req.headers)
159
156
  if @config.debugging
160
157
  @config.logger.debug "HTTP request\nMethod: #{req.method}\nPath: #{req.path}\nParams: #{req.params}\nHeaders: #{req.headers}\nBody: #{req.body}\n"
@@ -177,8 +174,7 @@ module AsposeSlidesCloud
177
174
  unless @config.access_token
178
175
  auth_token_response = Faraday.post(
179
176
  @config.auth_base_url + '/connect/token',
180
- { :grant_type => 'client_credentials', 'client_id' => @config.app_sid, 'client_secret' => @config.app_sid })
181
-
177
+ { :grant_type => 'client_credentials', 'client_id' => @config.app_sid, 'client_secret' => @config.app_key })
182
178
  unless auth_token_response.success?
183
179
  if auth_token_response.status == 0
184
180
  # Errors from libcurl will be made visible here
@@ -290,11 +286,17 @@ module AsposeSlidesCloud
290
286
  # Builds the HTTP request body
291
287
  #
292
288
  # @param [Hash] header_params Header parameters
293
- # @param [Hash] form_params Query parameters
294
289
  # @param [Object] body HTTP body (JSON/XML)
295
290
  # @return [String] HTTP body data in the form of string
296
- def build_request_body(header_params, form_params, body, files)
297
- if files and files.length > 0
291
+ def build_request_body(header_params, body, files)
292
+ partCount = 0
293
+ if files
294
+ partCount += files.length
295
+ end
296
+ if body
297
+ partCount += 1
298
+ end
299
+ if partCount > 1
298
300
  boundary = "7d70fb31-0eb9-4846-9ea8-933dfb69d8f1"
299
301
  header_params['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
300
302
  data = ""
@@ -305,14 +307,16 @@ module AsposeSlidesCloud
305
307
  put_multipart!(data, boundary, index + 1, val)
306
308
  end
307
309
  data << "\r\n--#{boundary}--\r\n"
308
- data
309
- else
310
- header_params['Content-Type'] = 'text/json'
310
+ elsif partCount == 1
311
311
  if body
312
+ header_params['Content-Type'] = "text/json"
312
313
  data = body.is_a?(String) ? body : body.to_json
313
314
  else
314
- data = nil
315
+ header_params['Content-Type'] = "application/octet-stream"
316
+ data = files[0]
315
317
  end
318
+ else
319
+ data = nil
316
320
  end
317
321
  data
318
322
  end
@@ -320,13 +324,12 @@ module AsposeSlidesCloud
320
324
  # Builds the HTTP request body
321
325
  #
322
326
  # @param [Hash] header_params Header parameters
323
- # @param [Hash] form_params Query parameters
324
327
  # @param [Object] body HTTP body (JSON/XML)
325
328
  # @return [String] HTTP body data in the form of string
326
329
  def put_multipart!(data, boundary, part_index, part_data)
327
330
  data << "\r\n--#{boundary}\r\n"
328
331
  if part_index > 0
329
- data << "Content-Disposition: form-data; name=\"file#{part_index}\";filename=\"null\"\r\n"
332
+ data << "Content-Disposition: form-data; name=\"file#{part_index}\";filename=\"file#{part_index}\"\r\n"
330
333
  data << "Content-Type: application/octet-stream\r\n"
331
334
  elsif
332
335
  data << "Content-Disposition: form-data; name=\"data\"\r\n"
@@ -185,7 +185,7 @@ module AsposeSlidesCloud
185
185
  def valid?
186
186
  return false if !super
187
187
  return false if @chart_type.nil?
188
- chart_type_validator = EnumAttributeValidator.new('String', ['ClusteredColumn', 'StackedColumn', 'PercentsStackedColumn', 'ClusteredColumn3D', 'StackedColumn3D', 'PercentsStackedColumn3D', 'Column3D', 'ClusteredCylinder', 'StackedCylinder', 'PercentsStackedCylinder', 'Cylinder3D', 'ClusteredCone', 'StackedCone', 'PercentsStackedCone', 'Cone3D', 'ClusteredPyramid', 'StackedPyramid', 'PercentsStackedPyramid', 'Pyramid3D', 'Line', 'StackedLine', 'PercentsStackedLine', 'LineWithMarkers', 'StackedLineWithMarkers', 'PercentsStackedLineWithMarkers', 'Line3D', 'Pie', 'Pie3D', 'PieOfPie', 'ExplodedPie', 'ExplodedPie3D', 'BarOfPie', 'PercentsStackedBar', 'ClusteredBar3D', 'ClusteredBar', 'StackedBar', 'StackedBar3D', 'PercentsStackedBar3D', 'ClusteredHorizontalCylinder', 'StackedHorizontalCylinder', 'PercentsStackedHorizontalCylinder', 'ClusteredHorizontalCone', 'StackedHorizontalCone', 'PercentsStackedHorizontalCone', 'ClusteredHorizontalPyramid', 'StackedHorizontalPyramid', 'PercentsStackedHorizontalPyramid', 'Area', 'StackedArea', 'PercentsStackedArea', 'Area3D', 'StackedArea3D', 'PercentsStackedArea3D', 'ScatterWithMarkers', 'ScatterWithSmoothLinesAndMarkers', 'ScatterWithSmoothLines', 'ScatterWithStraightLinesAndMarkers', 'ScatterWithStraightLines', 'HighLowClose', 'OpenHighLowClose', 'VolumeHighLowClose', 'VolumeOpenHighLowClose', 'Surface3D', 'WireframeSurface3D', 'Contour', 'WireframeContour', 'Doughnut', 'ExplodedDoughnut', 'Bubble', 'BubbleWith3D', 'Radar', 'RadarWithMarkers', 'FilledRadar', 'SeriesOfMixedTypes', 'Treemap', 'Sunburst', 'Histogram', 'ParetoLine', 'BoxAndWhisker', 'Waterfall', 'Funnel'])
188
+ chart_type_validator = EnumAttributeValidator.new('String', ['ClusteredColumn', 'StackedColumn', 'PercentsStackedColumn', 'ClusteredColumn3D', 'StackedColumn3D', 'PercentsStackedColumn3D', 'Column3D', 'ClusteredCylinder', 'StackedCylinder', 'PercentsStackedCylinder', 'Cylinder3D', 'ClusteredCone', 'StackedCone', 'PercentsStackedCone', 'Cone3D', 'ClusteredPyramid', 'StackedPyramid', 'PercentsStackedPyramid', 'Pyramid3D', 'Line', 'StackedLine', 'PercentsStackedLine', 'LineWithMarkers', 'StackedLineWithMarkers', 'PercentsStackedLineWithMarkers', 'Line3D', 'Pie', 'Pie3D', 'PieOfPie', 'ExplodedPie', 'ExplodedPie3D', 'BarOfPie', 'PercentsStackedBar', 'ClusteredBar3D', 'ClusteredBar', 'StackedBar', 'StackedBar3D', 'PercentsStackedBar3D', 'ClusteredHorizontalCylinder', 'StackedHorizontalCylinder', 'PercentsStackedHorizontalCylinder', 'ClusteredHorizontalCone', 'StackedHorizontalCone', 'PercentsStackedHorizontalCone', 'ClusteredHorizontalPyramid', 'StackedHorizontalPyramid', 'PercentsStackedHorizontalPyramid', 'Area', 'StackedArea', 'PercentsStackedArea', 'Area3D', 'StackedArea3D', 'PercentsStackedArea3D', 'ScatterWithMarkers', 'ScatterWithSmoothLinesAndMarkers', 'ScatterWithSmoothLines', 'ScatterWithStraightLinesAndMarkers', 'ScatterWithStraightLines', 'HighLowClose', 'OpenHighLowClose', 'VolumeHighLowClose', 'VolumeOpenHighLowClose', 'Surface3D', 'WireframeSurface3D', 'Contour', 'WireframeContour', 'Doughnut', 'ExplodedDoughnut', 'Bubble', 'BubbleWith3D', 'Radar', 'RadarWithMarkers', 'FilledRadar', 'SeriesOfMixedTypes', 'Treemap', 'Sunburst', 'Histogram', 'ParetoLine', 'BoxAndWhisker', 'Waterfall', 'Funnel', 'Map'])
189
189
  return false unless chart_type_validator.valid?(@chart_type)
190
190
  true
191
191
  end
@@ -193,7 +193,7 @@ module AsposeSlidesCloud
193
193
  # Custom attribute writer method checking allowed values (enum).
194
194
  # @param [Object] chart_type Object to be assigned
195
195
  def chart_type=(chart_type)
196
- validator = EnumAttributeValidator.new('String', ['ClusteredColumn', 'StackedColumn', 'PercentsStackedColumn', 'ClusteredColumn3D', 'StackedColumn3D', 'PercentsStackedColumn3D', 'Column3D', 'ClusteredCylinder', 'StackedCylinder', 'PercentsStackedCylinder', 'Cylinder3D', 'ClusteredCone', 'StackedCone', 'PercentsStackedCone', 'Cone3D', 'ClusteredPyramid', 'StackedPyramid', 'PercentsStackedPyramid', 'Pyramid3D', 'Line', 'StackedLine', 'PercentsStackedLine', 'LineWithMarkers', 'StackedLineWithMarkers', 'PercentsStackedLineWithMarkers', 'Line3D', 'Pie', 'Pie3D', 'PieOfPie', 'ExplodedPie', 'ExplodedPie3D', 'BarOfPie', 'PercentsStackedBar', 'ClusteredBar3D', 'ClusteredBar', 'StackedBar', 'StackedBar3D', 'PercentsStackedBar3D', 'ClusteredHorizontalCylinder', 'StackedHorizontalCylinder', 'PercentsStackedHorizontalCylinder', 'ClusteredHorizontalCone', 'StackedHorizontalCone', 'PercentsStackedHorizontalCone', 'ClusteredHorizontalPyramid', 'StackedHorizontalPyramid', 'PercentsStackedHorizontalPyramid', 'Area', 'StackedArea', 'PercentsStackedArea', 'Area3D', 'StackedArea3D', 'PercentsStackedArea3D', 'ScatterWithMarkers', 'ScatterWithSmoothLinesAndMarkers', 'ScatterWithSmoothLines', 'ScatterWithStraightLinesAndMarkers', 'ScatterWithStraightLines', 'HighLowClose', 'OpenHighLowClose', 'VolumeHighLowClose', 'VolumeOpenHighLowClose', 'Surface3D', 'WireframeSurface3D', 'Contour', 'WireframeContour', 'Doughnut', 'ExplodedDoughnut', 'Bubble', 'BubbleWith3D', 'Radar', 'RadarWithMarkers', 'FilledRadar', 'SeriesOfMixedTypes', 'Treemap', 'Sunburst', 'Histogram', 'ParetoLine', 'BoxAndWhisker', 'Waterfall', 'Funnel'])
196
+ validator = EnumAttributeValidator.new('String', ['ClusteredColumn', 'StackedColumn', 'PercentsStackedColumn', 'ClusteredColumn3D', 'StackedColumn3D', 'PercentsStackedColumn3D', 'Column3D', 'ClusteredCylinder', 'StackedCylinder', 'PercentsStackedCylinder', 'Cylinder3D', 'ClusteredCone', 'StackedCone', 'PercentsStackedCone', 'Cone3D', 'ClusteredPyramid', 'StackedPyramid', 'PercentsStackedPyramid', 'Pyramid3D', 'Line', 'StackedLine', 'PercentsStackedLine', 'LineWithMarkers', 'StackedLineWithMarkers', 'PercentsStackedLineWithMarkers', 'Line3D', 'Pie', 'Pie3D', 'PieOfPie', 'ExplodedPie', 'ExplodedPie3D', 'BarOfPie', 'PercentsStackedBar', 'ClusteredBar3D', 'ClusteredBar', 'StackedBar', 'StackedBar3D', 'PercentsStackedBar3D', 'ClusteredHorizontalCylinder', 'StackedHorizontalCylinder', 'PercentsStackedHorizontalCylinder', 'ClusteredHorizontalCone', 'StackedHorizontalCone', 'PercentsStackedHorizontalCone', 'ClusteredHorizontalPyramid', 'StackedHorizontalPyramid', 'PercentsStackedHorizontalPyramid', 'Area', 'StackedArea', 'PercentsStackedArea', 'Area3D', 'StackedArea3D', 'PercentsStackedArea3D', 'ScatterWithMarkers', 'ScatterWithSmoothLinesAndMarkers', 'ScatterWithSmoothLines', 'ScatterWithStraightLinesAndMarkers', 'ScatterWithStraightLines', 'HighLowClose', 'OpenHighLowClose', 'VolumeHighLowClose', 'VolumeOpenHighLowClose', 'Surface3D', 'WireframeSurface3D', 'Contour', 'WireframeContour', 'Doughnut', 'ExplodedDoughnut', 'Bubble', 'BubbleWith3D', 'Radar', 'RadarWithMarkers', 'FilledRadar', 'SeriesOfMixedTypes', 'Treemap', 'Sunburst', 'Histogram', 'ParetoLine', 'BoxAndWhisker', 'Waterfall', 'Funnel', 'Map'])
197
197
  unless validator.valid?(chart_type)
198
198
  fail ArgumentError, 'invalid value for "chart_type", must be one of #{validator.allowable_values}.'
199
199
  end
@@ -40,6 +40,9 @@ module AsposeSlidesCloud
40
40
  # Style.
41
41
  attr_accessor :style
42
42
 
43
+ # Sketch type.
44
+ attr_accessor :sketch_type
45
+
43
46
  # Begin arrowhead.
44
47
  attr_accessor :begin_arrow_head
45
48
 
@@ -88,6 +91,7 @@ module AsposeSlidesCloud
88
91
  :'dash_style' => :'DashStyle',
89
92
  :'join_style' => :'JoinStyle',
90
93
  :'style' => :'Style',
94
+ :'sketch_type' => :'SketchType',
91
95
  :'begin_arrow_head' => :'BeginArrowHead',
92
96
  :'end_arrow_head' => :'EndArrowHead',
93
97
  :'custom_dash_pattern' => :'CustomDashPattern',
@@ -105,6 +109,7 @@ module AsposeSlidesCloud
105
109
  :'dash_style' => :'String',
106
110
  :'join_style' => :'String',
107
111
  :'style' => :'String',
112
+ :'sketch_type' => :'String',
108
113
  :'begin_arrow_head' => :'ArrowHeadProperties',
109
114
  :'end_arrow_head' => :'ArrowHeadProperties',
110
115
  :'custom_dash_pattern' => :'CustomDashPattern',
@@ -142,6 +147,10 @@ module AsposeSlidesCloud
142
147
  self.style = attributes[:'Style']
143
148
  end
144
149
 
150
+ if attributes.has_key?(:'SketchType')
151
+ self.sketch_type = attributes[:'SketchType']
152
+ end
153
+
145
154
  if attributes.has_key?(:'BeginArrowHead')
146
155
  self.begin_arrow_head = attributes[:'BeginArrowHead']
147
156
  end
@@ -187,6 +196,8 @@ module AsposeSlidesCloud
187
196
  return false unless join_style_validator.valid?(@join_style)
188
197
  style_validator = EnumAttributeValidator.new('String', ['Single', 'ThinThin', 'ThinThick', 'ThickThin', 'ThickBetweenThin', 'NotDefined'])
189
198
  return false unless style_validator.valid?(@style)
199
+ sketch_type_validator = EnumAttributeValidator.new('String', ['None', 'Curved', 'Freehand', 'Scribble', 'NotDefined'])
200
+ return false unless sketch_type_validator.valid?(@sketch_type)
190
201
  true
191
202
  end
192
203
 
@@ -240,6 +251,16 @@ module AsposeSlidesCloud
240
251
  @style = style
241
252
  end
242
253
 
254
+ # Custom attribute writer method checking allowed values (enum).
255
+ # @param [Object] sketch_type Object to be assigned
256
+ def sketch_type=(sketch_type)
257
+ validator = EnumAttributeValidator.new('String', ['None', 'Curved', 'Freehand', 'Scribble', 'NotDefined'])
258
+ unless validator.valid?(sketch_type)
259
+ fail ArgumentError, 'invalid value for "sketch_type", must be one of #{validator.allowable_values}.'
260
+ end
261
+ @sketch_type = sketch_type
262
+ end
263
+
243
264
  # Checks equality by comparing each attribute.
244
265
  # @param [Object] Object to be compared
245
266
  def ==(o)
@@ -250,6 +271,7 @@ module AsposeSlidesCloud
250
271
  dash_style == o.dash_style &&
251
272
  join_style == o.join_style &&
252
273
  style == o.style &&
274
+ sketch_type == o.sketch_type &&
253
275
  begin_arrow_head == o.begin_arrow_head &&
254
276
  end_arrow_head == o.end_arrow_head &&
255
277
  custom_dash_pattern == o.custom_dash_pattern &&
@@ -267,7 +289,7 @@ module AsposeSlidesCloud
267
289
  # Calculates hash code according to all attributes.
268
290
  # @return [Fixnum] Hash code
269
291
  def hash
270
- [alignment, cap_style, dash_style, join_style, style, begin_arrow_head, end_arrow_head, custom_dash_pattern, fill_format, miter_limit, width].hash
292
+ [alignment, cap_style, dash_style, join_style, style, sketch_type, begin_arrow_head, end_arrow_head, custom_dash_pattern, fill_format, miter_limit, width].hash
271
293
  end
272
294
 
273
295
  # Builds the object from hash
@@ -34,12 +34,38 @@ module AsposeSlidesCloud
34
34
  # Get or sets the indexes of slides to merge
35
35
  attr_accessor :slides
36
36
 
37
+ # Merge (request or storage).
38
+ attr_accessor :source
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.any?{ |s| s.casecmp(value) == 0 }
59
+ end
60
+ end
61
+
37
62
  # Attribute mapping from ruby-style variable name to JSON key.
38
63
  def self.attribute_map
39
64
  {
40
65
  :'path' => :'Path',
41
66
  :'password' => :'Password',
42
67
  :'slides' => :'Slides',
68
+ :'source' => :'Source',
43
69
  }
44
70
  end
45
71
 
@@ -49,6 +75,7 @@ module AsposeSlidesCloud
49
75
  :'path' => :'String',
50
76
  :'password' => :'String',
51
77
  :'slides' => :'Array<Integer>',
78
+ :'source' => :'String',
52
79
  }
53
80
  end
54
81
 
@@ -73,6 +100,10 @@ module AsposeSlidesCloud
73
100
  self.slides = value
74
101
  end
75
102
  end
103
+
104
+ if attributes.has_key?(:'Source')
105
+ self.source = attributes[:'Source']
106
+ end
76
107
  end
77
108
 
78
109
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,9 +116,21 @@ module AsposeSlidesCloud
85
116
  # Check to see if the all the properties in the model are valid
86
117
  # @return true if the model is valid
87
118
  def valid?
119
+ source_validator = EnumAttributeValidator.new('String', ['Storage', 'Request'])
120
+ return false unless source_validator.valid?(@source)
88
121
  true
89
122
  end
90
123
 
124
+ # Custom attribute writer method checking allowed values (enum).
125
+ # @param [Object] source Object to be assigned
126
+ def source=(source)
127
+ validator = EnumAttributeValidator.new('String', ['Storage', 'Request'])
128
+ unless validator.valid?(source)
129
+ fail ArgumentError, 'invalid value for "source", must be one of #{validator.allowable_values}.'
130
+ end
131
+ @source = source
132
+ end
133
+
91
134
  # Checks equality by comparing each attribute.
92
135
  # @param [Object] Object to be compared
93
136
  def ==(o)
@@ -95,7 +138,8 @@ module AsposeSlidesCloud
95
138
  self.class == o.class &&
96
139
  path == o.path &&
97
140
  password == o.password &&
98
- slides == o.slides
141
+ slides == o.slides &&
142
+ source == o.source
99
143
  end
100
144
 
101
145
  # @see the `==` method
@@ -107,7 +151,7 @@ module AsposeSlidesCloud
107
151
  # Calculates hash code according to all attributes.
108
152
  # @return [Fixnum] Hash code
109
153
  def hash
110
- [path, password, slides].hash
154
+ [path, password, slides, source].hash
111
155
  end
112
156
 
113
157
  # Builds the object from hash
@@ -0,0 +1,267 @@
1
+ =begin
2
+ Copyright (c) 2019 Aspose Pty Ltd
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ =end
22
+
23
+ require 'date'
24
+
25
+ module AsposeSlidesCloud
26
+ # Protection properties.
27
+ class ProtectionProperties < ResourceBase
28
+ # True if document properties are encrypted. Has effect only for password protected presentations.
29
+ attr_accessor :encrypt_document_properties
30
+
31
+ # True if the document should be opened as read-only.
32
+ attr_accessor :read_only_recommended
33
+
34
+ # Password for read protection.
35
+ attr_accessor :read_password
36
+
37
+ # Password for write protection.
38
+ attr_accessor :write_password
39
+
40
+ # Returns true if the presentation protected for editing.
41
+ attr_accessor :is_write_protected
42
+
43
+ # Returns true if the presentation protected for reading.
44
+ attr_accessor :is_encrypted
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ super.merge({
49
+ :'encrypt_document_properties' => :'EncryptDocumentProperties',
50
+ :'read_only_recommended' => :'ReadOnlyRecommended',
51
+ :'read_password' => :'ReadPassword',
52
+ :'write_password' => :'WritePassword',
53
+ :'is_write_protected' => :'IsWriteProtected',
54
+ :'is_encrypted' => :'IsEncrypted',
55
+ })
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.swagger_types
60
+ super.merge({
61
+ :'encrypt_document_properties' => :'BOOLEAN',
62
+ :'read_only_recommended' => :'BOOLEAN',
63
+ :'read_password' => :'String',
64
+ :'write_password' => :'String',
65
+ :'is_write_protected' => :'BOOLEAN',
66
+ :'is_encrypted' => :'BOOLEAN',
67
+ })
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ super
74
+
75
+ if attributes.has_key?(:'EncryptDocumentProperties')
76
+ self.encrypt_document_properties = attributes[:'EncryptDocumentProperties']
77
+ end
78
+
79
+ if attributes.has_key?(:'ReadOnlyRecommended')
80
+ self.read_only_recommended = attributes[:'ReadOnlyRecommended']
81
+ end
82
+
83
+ if attributes.has_key?(:'ReadPassword')
84
+ self.read_password = attributes[:'ReadPassword']
85
+ end
86
+
87
+ if attributes.has_key?(:'WritePassword')
88
+ self.write_password = attributes[:'WritePassword']
89
+ end
90
+
91
+ if attributes.has_key?(:'IsWriteProtected')
92
+ self.is_write_protected = attributes[:'IsWriteProtected']
93
+ end
94
+
95
+ if attributes.has_key?(:'IsEncrypted')
96
+ self.is_encrypted = attributes[:'IsEncrypted']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = super
104
+ if @is_write_protected.nil?
105
+ invalid_properties.push('invalid value for "is_write_protected", is_write_protected cannot be nil.')
106
+ end
107
+
108
+ if @is_encrypted.nil?
109
+ invalid_properties.push('invalid value for "is_encrypted", is_encrypted cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if !super
119
+ return false if @is_write_protected.nil?
120
+ return false if @is_encrypted.nil?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ self_uri == o.self_uri &&
130
+ alternate_links == o.alternate_links &&
131
+ encrypt_document_properties == o.encrypt_document_properties &&
132
+ read_only_recommended == o.read_only_recommended &&
133
+ read_password == o.read_password &&
134
+ write_password == o.write_password &&
135
+ is_write_protected == o.is_write_protected &&
136
+ is_encrypted == o.is_encrypted
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Fixnum] Hash code
147
+ def hash
148
+ [self_uri, alternate_links, encrypt_document_properties, read_only_recommended, read_password, write_password, is_write_protected, is_encrypted].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.swagger_types.each_pair do |key, type|
157
+ mapKey = self.class.attribute_map[key]
158
+ if !mapKey.nil?
159
+ val = attributes[mapKey]
160
+ if val.nil?
161
+ mapKeyString = mapKey.to_s
162
+ mapKeyString[0] = mapKeyString[0].downcase
163
+ mapKey = mapKeyString.to_sym
164
+ val = attributes[mapKey]
165
+ end
166
+ if !val.nil?
167
+ if type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the the attribute
169
+ # is documented as an array but the input is not
170
+ if val.is_a?(Array)
171
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
172
+ end
173
+ else
174
+ self.send("#{key}=", _deserialize(type, val))
175
+ end
176
+ end
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :DateTime
190
+ DateTime.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :BOOLEAN
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ temp_model = AsposeSlidesCloud.const_get(type).new
221
+ temp_model.build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ next if value.nil?
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+ end
267
+ end