aspose_slides_cloud 20.5.0 → 20.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/TestData/ChartTest.pptx +0 -0
  4. data/TestData/Sections.pptx +0 -0
  5. data/lib/aspose_slides_cloud.rb +12 -5
  6. data/lib/aspose_slides_cloud/api/slides_api.rb +4571 -1683
  7. data/lib/aspose_slides_cloud/api/slides_api_requests.rb +1191 -185
  8. data/lib/aspose_slides_cloud/api_client.rb +30 -23
  9. data/lib/aspose_slides_cloud/configuration.rb +7 -2
  10. data/lib/aspose_slides_cloud/models/add_layout_slide.rb +31 -48
  11. data/lib/aspose_slides_cloud/models/add_master_slide.rb +31 -48
  12. data/lib/aspose_slides_cloud/models/add_shape.rb +31 -48
  13. data/lib/aspose_slides_cloud/models/add_slide.rb +31 -48
  14. data/lib/aspose_slides_cloud/models/api_info.rb +22 -10
  15. data/lib/aspose_slides_cloud/models/arrow_head_properties.rb +22 -10
  16. data/lib/aspose_slides_cloud/models/audio_frame.rb +32 -246
  17. data/lib/aspose_slides_cloud/models/axes.rb +22 -10
  18. data/lib/aspose_slides_cloud/models/axis.rb +22 -10
  19. data/lib/aspose_slides_cloud/models/base64_input_file.rb +31 -57
  20. data/lib/aspose_slides_cloud/models/blur_effect.rb +22 -10
  21. data/lib/aspose_slides_cloud/models/box_and_whisker_series.rb +31 -222
  22. data/lib/aspose_slides_cloud/models/bubble_chart_data_point.rb +30 -48
  23. data/lib/aspose_slides_cloud/models/bubble_series.rb +31 -211
  24. data/lib/aspose_slides_cloud/models/chart.rb +32 -220
  25. data/lib/aspose_slides_cloud/models/chart_category.rb +54 -20
  26. data/lib/aspose_slides_cloud/models/chart_title.rb +22 -10
  27. data/lib/aspose_slides_cloud/models/chart_wall.rb +22 -10
  28. data/lib/aspose_slides_cloud/models/color_scheme.rb +30 -40
  29. data/lib/aspose_slides_cloud/models/common_slide_view_properties.rb +22 -10
  30. data/lib/aspose_slides_cloud/models/connector.rb +32 -244
  31. data/lib/aspose_slides_cloud/models/custom_dash_pattern.rb +22 -10
  32. data/lib/aspose_slides_cloud/models/{resource_uri_element.rb → data_point.rb} +24 -22
  33. data/lib/aspose_slides_cloud/models/disc_usage.rb +22 -10
  34. data/lib/aspose_slides_cloud/models/document.rb +35 -45
  35. data/lib/aspose_slides_cloud/models/document_properties.rb +30 -40
  36. data/lib/aspose_slides_cloud/models/document_property.rb +30 -40
  37. data/lib/aspose_slides_cloud/models/document_replace_result.rb +30 -94
  38. data/lib/aspose_slides_cloud/models/effect.rb +22 -10
  39. data/lib/aspose_slides_cloud/models/effect_format.rb +22 -10
  40. data/lib/aspose_slides_cloud/models/entity_exists.rb +212 -0
  41. data/lib/aspose_slides_cloud/models/error.rb +22 -10
  42. data/lib/aspose_slides_cloud/models/error_details.rb +22 -10
  43. data/lib/aspose_slides_cloud/models/export_format.rb +1 -0
  44. data/lib/aspose_slides_cloud/models/export_options.rb +33 -11
  45. data/lib/aspose_slides_cloud/models/file_version.rb +30 -75
  46. data/lib/aspose_slides_cloud/models/file_versions.rb +22 -10
  47. data/lib/aspose_slides_cloud/models/files_list.rb +22 -10
  48. data/lib/aspose_slides_cloud/models/files_upload_result.rb +22 -10
  49. data/lib/aspose_slides_cloud/models/fill_format.rb +22 -10
  50. data/lib/aspose_slides_cloud/models/fill_overlay_effect.rb +22 -10
  51. data/lib/aspose_slides_cloud/models/font_scheme.rb +30 -40
  52. data/lib/aspose_slides_cloud/models/font_set.rb +22 -10
  53. data/lib/aspose_slides_cloud/models/format_scheme.rb +30 -40
  54. data/lib/aspose_slides_cloud/models/geometry_shape.rb +33 -212
  55. data/lib/aspose_slides_cloud/models/glow_effect.rb +22 -10
  56. data/lib/aspose_slides_cloud/models/gradient_fill.rb +31 -48
  57. data/lib/aspose_slides_cloud/models/gradient_fill_stop.rb +22 -10
  58. data/lib/aspose_slides_cloud/models/graphical_object.rb +31 -219
  59. data/lib/aspose_slides_cloud/models/group_shape.rb +31 -219
  60. data/lib/aspose_slides_cloud/models/header_footer.rb +247 -0
  61. data/lib/aspose_slides_cloud/models/html_export_options.rb +33 -32
  62. data/lib/aspose_slides_cloud/models/i_shape_export_options.rb +22 -20
  63. data/lib/aspose_slides_cloud/models/image.rb +30 -40
  64. data/lib/aspose_slides_cloud/models/image_export_options.rb +33 -32
  65. data/lib/aspose_slides_cloud/models/images.rb +30 -40
  66. data/lib/aspose_slides_cloud/models/inner_shadow_effect.rb +22 -10
  67. data/lib/aspose_slides_cloud/models/input.rb +22 -10
  68. data/lib/aspose_slides_cloud/models/input_file.rb +22 -10
  69. data/lib/aspose_slides_cloud/models/interactive_sequence.rb +22 -10
  70. data/lib/aspose_slides_cloud/models/layout_slide.rb +31 -41
  71. data/lib/aspose_slides_cloud/models/layout_slides.rb +30 -40
  72. data/lib/aspose_slides_cloud/models/legend.rb +22 -10
  73. data/lib/aspose_slides_cloud/models/line_format.rb +22 -10
  74. data/lib/aspose_slides_cloud/models/master_slide.rb +31 -41
  75. data/lib/aspose_slides_cloud/models/master_slides.rb +30 -40
  76. data/lib/aspose_slides_cloud/models/merge.rb +31 -48
  77. data/lib/aspose_slides_cloud/models/merging_source.rb +22 -10
  78. data/lib/aspose_slides_cloud/models/no_fill.rb +29 -46
  79. data/lib/aspose_slides_cloud/models/normal_view_restored_properties.rb +22 -10
  80. data/lib/aspose_slides_cloud/models/notes_slide.rb +30 -40
  81. data/lib/aspose_slides_cloud/models/notes_slide_header_footer.rb +267 -0
  82. data/lib/aspose_slides_cloud/models/object_exist.rb +22 -10
  83. data/lib/aspose_slides_cloud/models/ole_object_frame.rb +32 -220
  84. data/lib/aspose_slides_cloud/models/one_value_chart_data_point.rb +30 -20
  85. data/lib/aspose_slides_cloud/models/one_value_series.rb +31 -211
  86. data/lib/aspose_slides_cloud/models/ordered_merge_request.rb +22 -10
  87. data/lib/aspose_slides_cloud/models/outer_shadow_effect.rb +22 -10
  88. data/lib/aspose_slides_cloud/models/output_file.rb +22 -10
  89. data/lib/aspose_slides_cloud/models/paragraph.rb +30 -40
  90. data/lib/aspose_slides_cloud/models/paragraphs.rb +30 -40
  91. data/lib/aspose_slides_cloud/models/path_input_file.rb +31 -57
  92. data/lib/aspose_slides_cloud/models/path_output_file.rb +31 -48
  93. data/lib/aspose_slides_cloud/models/pattern_fill.rb +31 -48
  94. data/lib/aspose_slides_cloud/models/pdf_export_options.rb +63 -35
  95. data/lib/aspose_slides_cloud/models/picture_fill.rb +32 -49
  96. data/lib/aspose_slides_cloud/models/picture_frame.rb +32 -246
  97. data/lib/aspose_slides_cloud/models/pipeline.rb +22 -10
  98. data/lib/aspose_slides_cloud/models/placeholder.rb +30 -40
  99. data/lib/aspose_slides_cloud/models/placeholders.rb +30 -40
  100. data/lib/aspose_slides_cloud/models/plot_area.rb +22 -10
  101. data/lib/aspose_slides_cloud/models/portion.rb +30 -40
  102. data/lib/aspose_slides_cloud/models/portions.rb +36 -46
  103. data/lib/aspose_slides_cloud/models/pptx_export_options.rb +33 -32
  104. data/lib/aspose_slides_cloud/models/presentation_to_merge.rb +22 -10
  105. data/lib/aspose_slides_cloud/models/presentations_merge_request.rb +22 -10
  106. data/lib/aspose_slides_cloud/models/preset_shadow_effect.rb +22 -10
  107. data/lib/aspose_slides_cloud/models/reflection_effect.rb +22 -10
  108. data/lib/aspose_slides_cloud/models/remove_shape.rb +31 -48
  109. data/lib/aspose_slides_cloud/models/remove_slide.rb +31 -48
  110. data/lib/aspose_slides_cloud/models/reorder_slide.rb +31 -48
  111. data/lib/aspose_slides_cloud/models/replace_text.rb +31 -48
  112. data/lib/aspose_slides_cloud/models/request_input_file.rb +31 -57
  113. data/lib/aspose_slides_cloud/models/reset_slide.rb +31 -48
  114. data/lib/aspose_slides_cloud/models/resource_base.rb +22 -10
  115. data/lib/aspose_slides_cloud/models/resource_uri.rb +22 -10
  116. data/lib/aspose_slides_cloud/models/response_output_file.rb +29 -46
  117. data/lib/aspose_slides_cloud/models/save.rb +33 -50
  118. data/lib/aspose_slides_cloud/models/save_shape.rb +31 -48
  119. data/lib/aspose_slides_cloud/models/save_slide.rb +33 -50
  120. data/lib/aspose_slides_cloud/models/scatter_chart_data_point.rb +30 -20
  121. data/lib/aspose_slides_cloud/models/scatter_series.rb +31 -211
  122. data/lib/aspose_slides_cloud/models/section.rb +234 -0
  123. data/lib/aspose_slides_cloud/models/sections.rb +209 -0
  124. data/lib/aspose_slides_cloud/models/series.rb +45 -12
  125. data/lib/aspose_slides_cloud/models/series_marker.rb +22 -10
  126. data/lib/aspose_slides_cloud/models/shape.rb +32 -244
  127. data/lib/aspose_slides_cloud/models/shape_base.rb +31 -62
  128. data/lib/aspose_slides_cloud/models/shape_image_export_options.rb +22 -10
  129. data/lib/aspose_slides_cloud/models/shapes.rb +30 -40
  130. data/lib/aspose_slides_cloud/models/slide.rb +37 -47
  131. data/lib/aspose_slides_cloud/models/slide_animation.rb +30 -40
  132. data/lib/aspose_slides_cloud/models/slide_background.rb +30 -40
  133. data/lib/aspose_slides_cloud/models/slide_comment.rb +22 -10
  134. data/lib/aspose_slides_cloud/models/slide_comments.rb +30 -40
  135. data/lib/aspose_slides_cloud/models/slide_export_format.rb +1 -0
  136. data/lib/aspose_slides_cloud/models/slide_replace_result.rb +30 -154
  137. data/lib/aspose_slides_cloud/models/slides.rb +30 -40
  138. data/lib/aspose_slides_cloud/models/smart_art.rb +32 -220
  139. data/lib/aspose_slides_cloud/models/smart_art_node.rb +23 -11
  140. data/lib/aspose_slides_cloud/models/smart_art_shape.rb +30 -217
  141. data/lib/aspose_slides_cloud/models/soft_edge_effect.rb +22 -10
  142. data/lib/aspose_slides_cloud/models/solid_fill.rb +31 -48
  143. data/lib/aspose_slides_cloud/models/split_document_result.rb +30 -40
  144. data/lib/aspose_slides_cloud/models/storage_exist.rb +22 -10
  145. data/lib/aspose_slides_cloud/models/storage_file.rb +22 -10
  146. data/lib/aspose_slides_cloud/models/svg_export_options.rb +33 -32
  147. data/lib/aspose_slides_cloud/models/swf_export_options.rb +33 -32
  148. data/lib/aspose_slides_cloud/models/table.rb +32 -220
  149. data/lib/aspose_slides_cloud/models/table_cell.rb +22 -10
  150. data/lib/aspose_slides_cloud/models/table_column.rb +22 -10
  151. data/lib/aspose_slides_cloud/models/table_row.rb +22 -10
  152. data/lib/aspose_slides_cloud/models/task.rb +22 -10
  153. data/lib/aspose_slides_cloud/models/text_item.rb +22 -10
  154. data/lib/aspose_slides_cloud/models/text_items.rb +30 -40
  155. data/lib/aspose_slides_cloud/models/theme.rb +32 -42
  156. data/lib/aspose_slides_cloud/models/tiff_export_options.rb +33 -32
  157. data/lib/aspose_slides_cloud/models/update_background.rb +31 -48
  158. data/lib/aspose_slides_cloud/models/update_shape.rb +31 -48
  159. data/lib/aspose_slides_cloud/models/video_frame.rb +32 -246
  160. data/lib/aspose_slides_cloud/models/view_properties.rb +30 -40
  161. data/lib/aspose_slides_cloud/models/waterfall_chart_data_point.rb +206 -0
  162. data/lib/aspose_slides_cloud/models/waterfall_series.rb +31 -222
  163. data/lib/aspose_slides_cloud/models/xps_export_options.rb +33 -32
  164. data/lib/aspose_slides_cloud/type_registry.rb +320 -0
  165. data/lib/aspose_slides_cloud/version.rb +1 -1
  166. data/spec/api/slides_api_spec.rb +25246 -14028
  167. data/spec/extra/extra_spec.rb +156 -22
  168. data/spec/spec_utils.rb +11 -4
  169. data/testConfig.json +2 -2
  170. data/testRules.json +172 -77
  171. metadata +12 -3
@@ -57,7 +57,7 @@ module AsposeSlidesCloud
57
57
  @config.logger.debug "HTTP response\nHeaders: #{response.headers}\nStatus: #{response.status}\nBody: #{response.body}\n"
58
58
  end
59
59
 
60
- if response.status == 401 and @config.access_token
60
+ if (response.status == 401 || (response.status == 500 && response.body.length == 0)) and @config.access_token
61
61
  @config.access_token = nil
62
62
  return repeat_call_api(http_method, path, opts)
63
63
  end
@@ -147,6 +147,9 @@ module AsposeSlidesCloud
147
147
  opts[:query_params][key] = opts[:query_params][key].join[","]
148
148
  end
149
149
  end
150
+ if @config.http_request_timeout > 0
151
+ req.options.timeout = @config.http_request_timeout
152
+ end
150
153
  req.url path.sub(/^\/+/, '')
151
154
  req.headers = opts[:header_params]
152
155
  req.params = opts[:query_params]
@@ -159,10 +162,9 @@ module AsposeSlidesCloud
159
162
  end
160
163
 
161
164
  def set_headers(headers)
162
- headers['x-aspose-client'] = 'ruby sdk'
163
- headers['x-aspose-version'] = AsposeSlidesCloud::VERSION
165
+ headers['x-aspose-client'] = "ruby sdk v#{AsposeSlidesCloud::VERSION}"
164
166
  if @config.timeout > 0
165
- headers['x-aspose-timeout'] = @config.timeout
167
+ headers['x-aspose-timeout'] = @config.timeout.to_s
166
168
  end
167
169
  @config.custom_headers.each do |key, value|
168
170
  headers[key] = value
@@ -171,26 +173,28 @@ module AsposeSlidesCloud
171
173
  end
172
174
 
173
175
  def set_auth_header(headers)
174
- unless @config.access_token
175
- auth_token_response = Faraday.post(
176
- @config.auth_base_url + '/connect/token',
177
- { :grant_type => 'client_credentials', 'client_id' => @config.app_sid, 'client_secret' => @config.app_key })
178
-
179
- unless auth_token_response.success?
180
- if auth_token_response.status == 0
181
- # Errors from libcurl will be made visible here
182
- fail ApiError.new(:code => 0,
183
- :message => auth_token_response.return_message)
184
- else
185
- fail ApiError.new(:code => 401,
186
- :response_headers => auth_token_response.headers,
187
- :response_body => auth_token_response.body),
188
- "unauthorized"
176
+ if config.app_sid || config.access_token
177
+ unless @config.access_token
178
+ auth_token_response = Faraday.post(
179
+ @config.auth_base_url + '/connect/token',
180
+ { :grant_type => 'client_credentials', 'client_id' => @config.app_sid, 'client_secret' => @config.app_sid })
181
+
182
+ unless auth_token_response.success?
183
+ if auth_token_response.status == 0
184
+ # Errors from libcurl will be made visible here
185
+ fail ApiError.new(:code => 0,
186
+ :message => auth_token_response.return_message)
187
+ else
188
+ fail ApiError.new(:code => 401,
189
+ :response_headers => auth_token_response.headers,
190
+ :response_body => auth_token_response.body),
191
+ "unauthorized"
192
+ end
189
193
  end
194
+ @config.access_token = JSON.parse("[#{auth_token_response.body}]", :symbolize_names => true)[0][:access_token]
190
195
  end
191
- @config.access_token = JSON.parse("[#{auth_token_response.body}]", :symbolize_names => true)[0][:access_token]
196
+ headers['Authorization'] = 'Bearer ' + @config.access_token
192
197
  end
193
- headers['Authorization'] = 'Bearer ' + @config.access_token
194
198
  end
195
199
 
196
200
  # Check if the given MIME is a JSON MIME.
@@ -273,8 +277,11 @@ module AsposeSlidesCloud
273
277
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
274
278
  end
275
279
  else
276
- # models, e.g. Pet
277
- AsposeSlidesCloud.const_get(return_type).new.tap do |model|
280
+ type = AsposeSlidesCloud::TypeRegistry.get_type(return_type, data)
281
+ if !type
282
+ type = return_type
283
+ end
284
+ AsposeSlidesCloud.const_get(type).new.tap do |model|
278
285
  model.build_from_hash data
279
286
  end
280
287
  end
@@ -66,9 +66,13 @@ module AsposeSlidesCloud
66
66
  # @return [String]
67
67
  attr_accessor :temp_folder_path
68
68
 
69
- # The time limit for HTTP request in seconds.
70
- # Default to 0 (never times out).
69
+ # slides operaion timeout in seconds. The timeout applies to the Slides operation, not to the HTTP request.
70
+ # Default to 0 (no timeout).
71
71
  attr_accessor :timeout
72
+
73
+ # The time limit for HTTP request in seconds.
74
+ # Default to 300.
75
+ attr_accessor :http_request_timeout
72
76
 
73
77
  # Set this to false to skip client side validation in the operation.
74
78
  # Default to true.
@@ -129,6 +133,7 @@ module AsposeSlidesCloud
129
133
  @base_url = 'https://api.aspose.cloud'
130
134
  @auth_base_url = 'https://api.aspose.cloud'
131
135
  @version = 'v3.0'
136
+ @http_request_timeout = 300
132
137
  @timeout = 0
133
138
  @custom_headers = Hash.new
134
139
  @client_side_validation = true
@@ -24,10 +24,7 @@ require 'date'
24
24
 
25
25
  module AsposeSlidesCloud
26
26
  # Add layout slide task.
27
- class AddLayoutSlide
28
- # Task type.
29
- attr_accessor :type
30
-
27
+ class AddLayoutSlide < Task
31
28
  # Source file.
32
29
  attr_accessor :clone_from_file
33
30
 
@@ -58,35 +55,24 @@ module AsposeSlidesCloud
58
55
 
59
56
  # Attribute mapping from ruby-style variable name to JSON key.
60
57
  def self.attribute_map
61
- {
62
- :'type' => :'Type',
58
+ super.merge({
63
59
  :'clone_from_file' => :'CloneFromFile',
64
- :'clone_from_position' => :'CloneFromPosition'
65
- }
60
+ :'clone_from_position' => :'CloneFromPosition',
61
+ })
66
62
  end
67
63
 
68
64
  # Attribute type mapping.
69
65
  def self.swagger_types
70
- {
71
- :'type' => :'String',
66
+ super.merge({
72
67
  :'clone_from_file' => :'InputFile',
73
- :'clone_from_position' => :'Integer'
74
- }
68
+ :'clone_from_position' => :'Integer',
69
+ })
75
70
  end
76
71
 
77
72
  # Initializes the object
78
73
  # @param [Hash] attributes Model attributes in the form of hash
79
74
  def initialize(attributes = {})
80
- return unless attributes.is_a?(Hash)
81
-
82
- # convert string to symbol for hash key
83
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
84
-
85
- if attributes.has_key?(:'Type')
86
- self.type = attributes[:'Type']
87
- else
88
- self.type = "AddLayoutSlide"
89
- end
75
+ super
90
76
 
91
77
  if attributes.has_key?(:'CloneFromFile')
92
78
  self.clone_from_file = attributes[:'CloneFromFile']
@@ -95,16 +81,13 @@ module AsposeSlidesCloud
95
81
  if attributes.has_key?(:'CloneFromPosition')
96
82
  self.clone_from_position = attributes[:'CloneFromPosition']
97
83
  end
84
+ self.type = "AddLayoutSlide"
98
85
  end
99
86
 
100
87
  # Show invalid properties with the reasons. Usually used together with valid?
101
88
  # @return Array for valid properties with the reasons
102
89
  def list_invalid_properties
103
- invalid_properties = Array.new
104
- if @type.nil?
105
- invalid_properties.push('invalid value for "type", type cannot be nil.')
106
- end
107
-
90
+ invalid_properties = super
108
91
  if @clone_from_position.nil?
109
92
  invalid_properties.push('invalid value for "clone_from_position", clone_from_position cannot be nil.')
110
93
  end
@@ -115,23 +98,11 @@ module AsposeSlidesCloud
115
98
  # Check to see if the all the properties in the model are valid
116
99
  # @return true if the model is valid
117
100
  def valid?
118
- return false if @type.nil?
119
- type_validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
120
- return false unless type_validator.valid?(@type)
101
+ return false if !super
121
102
  return false if @clone_from_position.nil?
122
103
  true
123
104
  end
124
105
 
125
- # Custom attribute writer method checking allowed values (enum).
126
- # @param [Object] type Object to be assigned
127
- def type=(type)
128
- validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
129
- unless validator.valid?(type)
130
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
131
- end
132
- @type = type
133
- end
134
-
135
106
  # Checks equality by comparing each attribute.
136
107
  # @param [Object] Object to be compared
137
108
  def ==(o)
@@ -160,15 +131,27 @@ module AsposeSlidesCloud
160
131
  def build_from_hash(attributes)
161
132
  return nil unless attributes.is_a?(Hash)
162
133
  self.class.swagger_types.each_pair do |key, type|
163
- if type =~ /\AArray<(.*)>/i
164
- # check to ensure the input is an array given that the the attribute
165
- # is documented as an array but the input is not
166
- if attributes[self.class.attribute_map[key]].is_a?(Array)
167
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ mapKey = self.class.attribute_map[key]
135
+ if !mapKey.nil?
136
+ val = attributes[mapKey]
137
+ if val.nil?
138
+ mapKeyString = mapKey.to_s
139
+ mapKeyString[0] = mapKeyString[0].downcase
140
+ mapKey = mapKeyString.to_sym
141
+ val = attributes[mapKey]
142
+ end
143
+ if !val.nil?
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 val.is_a?(Array)
148
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
149
+ end
150
+ else
151
+ self.send("#{key}=", _deserialize(type, val))
152
+ end
168
153
  end
169
- elsif !attributes[self.class.attribute_map[key]].nil?
170
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
- end # or else data not found in attributes(hash), not an issue as the data can be optional
154
+ end
172
155
  end
173
156
 
174
157
  self
@@ -24,10 +24,7 @@ require 'date'
24
24
 
25
25
  module AsposeSlidesCloud
26
26
  # Add master slide task.
27
- class AddMasterSlide
28
- # Task type.
29
- attr_accessor :type
30
-
27
+ class AddMasterSlide < Task
31
28
  # Source presentation clone from.
32
29
  attr_accessor :clone_from_file
33
30
 
@@ -61,37 +58,26 @@ module AsposeSlidesCloud
61
58
 
62
59
  # Attribute mapping from ruby-style variable name to JSON key.
63
60
  def self.attribute_map
64
- {
65
- :'type' => :'Type',
61
+ super.merge({
66
62
  :'clone_from_file' => :'CloneFromFile',
67
63
  :'clone_from_position' => :'CloneFromPosition',
68
- :'apply_to_all' => :'ApplyToAll'
69
- }
64
+ :'apply_to_all' => :'ApplyToAll',
65
+ })
70
66
  end
71
67
 
72
68
  # Attribute type mapping.
73
69
  def self.swagger_types
74
- {
75
- :'type' => :'String',
70
+ super.merge({
76
71
  :'clone_from_file' => :'InputFile',
77
72
  :'clone_from_position' => :'Integer',
78
- :'apply_to_all' => :'BOOLEAN'
79
- }
73
+ :'apply_to_all' => :'BOOLEAN',
74
+ })
80
75
  end
81
76
 
82
77
  # Initializes the object
83
78
  # @param [Hash] attributes Model attributes in the form of hash
84
79
  def initialize(attributes = {})
85
- return unless attributes.is_a?(Hash)
86
-
87
- # convert string to symbol for hash key
88
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
89
-
90
- if attributes.has_key?(:'Type')
91
- self.type = attributes[:'Type']
92
- else
93
- self.type = "AddMasterSlide"
94
- end
80
+ super
95
81
 
96
82
  if attributes.has_key?(:'CloneFromFile')
97
83
  self.clone_from_file = attributes[:'CloneFromFile']
@@ -104,16 +90,13 @@ module AsposeSlidesCloud
104
90
  if attributes.has_key?(:'ApplyToAll')
105
91
  self.apply_to_all = attributes[:'ApplyToAll']
106
92
  end
93
+ self.type = "AddMasterSlide"
107
94
  end
108
95
 
109
96
  # Show invalid properties with the reasons. Usually used together with valid?
110
97
  # @return Array for valid properties with the reasons
111
98
  def list_invalid_properties
112
- invalid_properties = Array.new
113
- if @type.nil?
114
- invalid_properties.push('invalid value for "type", type cannot be nil.')
115
- end
116
-
99
+ invalid_properties = super
117
100
  if @clone_from_position.nil?
118
101
  invalid_properties.push('invalid value for "clone_from_position", clone_from_position cannot be nil.')
119
102
  end
@@ -128,24 +111,12 @@ module AsposeSlidesCloud
128
111
  # Check to see if the all the properties in the model are valid
129
112
  # @return true if the model is valid
130
113
  def valid?
131
- return false if @type.nil?
132
- type_validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
133
- return false unless type_validator.valid?(@type)
114
+ return false if !super
134
115
  return false if @clone_from_position.nil?
135
116
  return false if @apply_to_all.nil?
136
117
  true
137
118
  end
138
119
 
139
- # Custom attribute writer method checking allowed values (enum).
140
- # @param [Object] type Object to be assigned
141
- def type=(type)
142
- validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
143
- unless validator.valid?(type)
144
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
145
- end
146
- @type = type
147
- end
148
-
149
120
  # Checks equality by comparing each attribute.
150
121
  # @param [Object] Object to be compared
151
122
  def ==(o)
@@ -175,15 +146,27 @@ module AsposeSlidesCloud
175
146
  def build_from_hash(attributes)
176
147
  return nil unless attributes.is_a?(Hash)
177
148
  self.class.swagger_types.each_pair do |key, type|
178
- if type =~ /\AArray<(.*)>/i
179
- # check to ensure the input is an array given that the the attribute
180
- # is documented as an array but the input is not
181
- if attributes[self.class.attribute_map[key]].is_a?(Array)
182
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ mapKey = self.class.attribute_map[key]
150
+ if !mapKey.nil?
151
+ val = attributes[mapKey]
152
+ if val.nil?
153
+ mapKeyString = mapKey.to_s
154
+ mapKeyString[0] = mapKeyString[0].downcase
155
+ mapKey = mapKeyString.to_sym
156
+ val = attributes[mapKey]
157
+ end
158
+ if !val.nil?
159
+ if type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the the attribute
161
+ # is documented as an array but the input is not
162
+ if val.is_a?(Array)
163
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
164
+ end
165
+ else
166
+ self.send("#{key}=", _deserialize(type, val))
167
+ end
183
168
  end
184
- elsif !attributes[self.class.attribute_map[key]].nil?
185
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
- end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
187
170
  end
188
171
 
189
172
  self
@@ -24,10 +24,7 @@ require 'date'
24
24
 
25
25
  module AsposeSlidesCloud
26
26
  # Add shape task.
27
- class AddShape
28
- # Task type.
29
- attr_accessor :type
30
-
27
+ class AddShape < Task
31
28
  # Shape DTO.
32
29
  attr_accessor :shape
33
30
 
@@ -58,35 +55,24 @@ module AsposeSlidesCloud
58
55
 
59
56
  # Attribute mapping from ruby-style variable name to JSON key.
60
57
  def self.attribute_map
61
- {
62
- :'type' => :'Type',
58
+ super.merge({
63
59
  :'shape' => :'Shape',
64
- :'shape_path' => :'ShapePath'
65
- }
60
+ :'shape_path' => :'ShapePath',
61
+ })
66
62
  end
67
63
 
68
64
  # Attribute type mapping.
69
65
  def self.swagger_types
70
- {
71
- :'type' => :'String',
66
+ super.merge({
72
67
  :'shape' => :'ShapeBase',
73
- :'shape_path' => :'String'
74
- }
68
+ :'shape_path' => :'String',
69
+ })
75
70
  end
76
71
 
77
72
  # Initializes the object
78
73
  # @param [Hash] attributes Model attributes in the form of hash
79
74
  def initialize(attributes = {})
80
- return unless attributes.is_a?(Hash)
81
-
82
- # convert string to symbol for hash key
83
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
84
-
85
- if attributes.has_key?(:'Type')
86
- self.type = attributes[:'Type']
87
- else
88
- self.type = "AddShape"
89
- end
75
+ super
90
76
 
91
77
  if attributes.has_key?(:'Shape')
92
78
  self.shape = attributes[:'Shape']
@@ -95,38 +81,23 @@ module AsposeSlidesCloud
95
81
  if attributes.has_key?(:'ShapePath')
96
82
  self.shape_path = attributes[:'ShapePath']
97
83
  end
84
+ self.type = "AddShape"
98
85
  end
99
86
 
100
87
  # Show invalid properties with the reasons. Usually used together with valid?
101
88
  # @return Array for valid properties with the reasons
102
89
  def list_invalid_properties
103
- invalid_properties = Array.new
104
- if @type.nil?
105
- invalid_properties.push('invalid value for "type", type cannot be nil.')
106
- end
107
-
90
+ invalid_properties = super
108
91
  invalid_properties
109
92
  end
110
93
 
111
94
  # Check to see if the all the properties in the model are valid
112
95
  # @return true if the model is valid
113
96
  def valid?
114
- return false if @type.nil?
115
- type_validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
116
- return false unless type_validator.valid?(@type)
97
+ return false if !super
117
98
  true
118
99
  end
119
100
 
120
- # Custom attribute writer method checking allowed values (enum).
121
- # @param [Object] type Object to be assigned
122
- def type=(type)
123
- validator = EnumAttributeValidator.new('String', ['Save', 'SaveSlide', 'SaveShape', 'AddSlide', 'AddMasterSlide', 'AddLayoutSlide', 'RemoveSlide', 'ReoderSlide', 'Merge', 'UpdateBackground', 'ResetSlide', 'AddShape', 'RemoveShape', 'UpdateShape', 'ReplaceText'])
124
- unless validator.valid?(type)
125
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
126
- end
127
- @type = type
128
- end
129
-
130
101
  # Checks equality by comparing each attribute.
131
102
  # @param [Object] Object to be compared
132
103
  def ==(o)
@@ -155,15 +126,27 @@ module AsposeSlidesCloud
155
126
  def build_from_hash(attributes)
156
127
  return nil unless attributes.is_a?(Hash)
157
128
  self.class.swagger_types.each_pair do |key, type|
158
- if type =~ /\AArray<(.*)>/i
159
- # check to ensure the input is an array given that the the attribute
160
- # is documented as an array but the input is not
161
- if attributes[self.class.attribute_map[key]].is_a?(Array)
162
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ mapKey = self.class.attribute_map[key]
130
+ if !mapKey.nil?
131
+ val = attributes[mapKey]
132
+ if val.nil?
133
+ mapKeyString = mapKey.to_s
134
+ mapKeyString[0] = mapKeyString[0].downcase
135
+ mapKey = mapKeyString.to_sym
136
+ val = attributes[mapKey]
137
+ end
138
+ if !val.nil?
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the the attribute
141
+ # is documented as an array but the input is not
142
+ if val.is_a?(Array)
143
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
144
+ end
145
+ else
146
+ self.send("#{key}=", _deserialize(type, val))
147
+ end
163
148
  end
164
- elsif !attributes[self.class.attribute_map[key]].nil?
165
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
- end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
167
150
  end
168
151
 
169
152
  self