aspose_slides_cloud 21.3.0 → 21.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -61
  3. data/TestData/TemplatingCVDataWithBase64.xml +22 -22
  4. data/TestData/watermark.png +0 -0
  5. data/lib/aspose_slides_cloud.rb +213 -215
  6. data/lib/aspose_slides_cloud/api/slides_api.rb +17689 -17009
  7. data/lib/aspose_slides_cloud/api/slides_api_requests.rb +4742 -4624
  8. data/lib/aspose_slides_cloud/api_client.rb +439 -434
  9. data/lib/aspose_slides_cloud/models/add_layout_slide.rb +244 -244
  10. data/lib/aspose_slides_cloud/models/add_master_slide.rb +259 -259
  11. data/lib/aspose_slides_cloud/models/add_shape.rb +239 -239
  12. data/lib/aspose_slides_cloud/models/add_slide.rb +269 -269
  13. data/lib/aspose_slides_cloud/models/api_info.rb +217 -217
  14. data/lib/aspose_slides_cloud/models/arrow_head_properties.rb +285 -285
  15. data/lib/aspose_slides_cloud/models/audio_frame.rb +359 -359
  16. data/lib/aspose_slides_cloud/models/axes.rb +237 -237
  17. data/lib/aspose_slides_cloud/models/axis.rb +699 -699
  18. data/lib/aspose_slides_cloud/models/base64_input_file.rb +230 -230
  19. data/lib/aspose_slides_cloud/models/blur_effect.rb +227 -227
  20. data/lib/aspose_slides_cloud/models/box_and_whisker_series.rb +299 -299
  21. data/lib/aspose_slides_cloud/models/bubble_chart_data_point.rb +212 -212
  22. data/lib/aspose_slides_cloud/models/bubble_series.rb +248 -248
  23. data/lib/aspose_slides_cloud/models/chart.rb +365 -365
  24. data/lib/aspose_slides_cloud/models/chart_category.rb +271 -271
  25. data/lib/aspose_slides_cloud/models/chart_title.rb +222 -222
  26. data/lib/aspose_slides_cloud/models/chart_wall.rb +281 -281
  27. data/lib/aspose_slides_cloud/models/color_scheme.rb +317 -317
  28. data/lib/aspose_slides_cloud/models/common_slide_view_properties.rb +217 -217
  29. data/lib/aspose_slides_cloud/models/connector.rb +275 -275
  30. data/lib/aspose_slides_cloud/models/custom_dash_pattern.rb +209 -209
  31. data/lib/aspose_slides_cloud/models/data_point.rb +197 -197
  32. data/lib/aspose_slides_cloud/models/disc_usage.rb +227 -227
  33. data/lib/aspose_slides_cloud/models/document.rb +257 -257
  34. data/lib/aspose_slides_cloud/models/document_properties.rb +209 -209
  35. data/lib/aspose_slides_cloud/models/document_property.rb +232 -232
  36. data/lib/aspose_slides_cloud/models/document_replace_result.rb +218 -218
  37. data/lib/aspose_slides_cloud/models/effect.rb +424 -424
  38. data/lib/aspose_slides_cloud/models/effect_format.rb +277 -277
  39. data/lib/aspose_slides_cloud/models/entity_exists.rb +212 -212
  40. data/lib/aspose_slides_cloud/models/error.rb +237 -237
  41. data/lib/aspose_slides_cloud/models/error_details.rb +222 -222
  42. data/lib/aspose_slides_cloud/models/export_format.rb +60 -60
  43. data/lib/aspose_slides_cloud/models/export_options.rb +216 -216
  44. data/lib/aspose_slides_cloud/models/file_version.rb +225 -225
  45. data/lib/aspose_slides_cloud/models/file_versions.rb +209 -209
  46. data/lib/aspose_slides_cloud/models/files_list.rb +209 -209
  47. data/lib/aspose_slides_cloud/models/files_upload_result.rb +221 -221
  48. data/lib/aspose_slides_cloud/models/fill_format.rb +240 -240
  49. data/lib/aspose_slides_cloud/models/fill_overlay_effect.rb +246 -246
  50. data/lib/aspose_slides_cloud/models/font_scheme.rb +227 -227
  51. data/lib/aspose_slides_cloud/models/font_set.rb +227 -227
  52. data/lib/aspose_slides_cloud/models/format_scheme.rb +245 -245
  53. data/lib/aspose_slides_cloud/models/geometry_shape.rb +260 -260
  54. data/lib/aspose_slides_cloud/models/glow_effect.rb +222 -222
  55. data/lib/aspose_slides_cloud/models/gradient_fill.rb +342 -342
  56. data/lib/aspose_slides_cloud/models/gradient_fill_stop.rb +222 -222
  57. data/lib/aspose_slides_cloud/models/graphical_object.rb +234 -234
  58. data/lib/aspose_slides_cloud/models/group_shape.rb +234 -234
  59. data/lib/aspose_slides_cloud/models/header_footer.rb +247 -247
  60. data/lib/aspose_slides_cloud/models/html_export_options.rb +421 -421
  61. data/lib/aspose_slides_cloud/models/i_shape_export_options.rb +197 -197
  62. data/lib/aspose_slides_cloud/models/image.rb +237 -237
  63. data/lib/aspose_slides_cloud/models/image_export_format.rb +43 -43
  64. data/lib/aspose_slides_cloud/models/image_export_options.rb +299 -299
  65. data/lib/aspose_slides_cloud/models/images.rb +209 -209
  66. data/lib/aspose_slides_cloud/models/inner_shadow_effect.rb +252 -252
  67. data/lib/aspose_slides_cloud/models/input.rb +227 -227
  68. data/lib/aspose_slides_cloud/models/input_file.rb +250 -250
  69. data/lib/aspose_slides_cloud/models/interactive_sequence.rb +224 -224
  70. data/lib/aspose_slides_cloud/models/layout_slide.rb +278 -278
  71. data/lib/aspose_slides_cloud/models/layout_slides.rb +209 -209
  72. data/lib/aspose_slides_cloud/models/legend.rb +321 -321
  73. data/lib/aspose_slides_cloud/models/line_format.rb +411 -411
  74. data/lib/aspose_slides_cloud/models/master_slide.rb +231 -231
  75. data/lib/aspose_slides_cloud/models/master_slides.rb +209 -209
  76. data/lib/aspose_slides_cloud/models/merge.rb +231 -231
  77. data/lib/aspose_slides_cloud/models/merging_source.rb +219 -219
  78. data/lib/aspose_slides_cloud/models/no_fill.rb +219 -219
  79. data/lib/aspose_slides_cloud/models/normal_view_restored_properties.rb +217 -217
  80. data/lib/aspose_slides_cloud/models/notes_slide.rb +217 -217
  81. data/lib/aspose_slides_cloud/models/notes_slide_export_format.rb +43 -43
  82. data/lib/aspose_slides_cloud/models/notes_slide_header_footer.rb +267 -267
  83. data/lib/aspose_slides_cloud/models/object_exist.rb +227 -227
  84. data/lib/aspose_slides_cloud/models/ole_object_frame.rb +259 -259
  85. data/lib/aspose_slides_cloud/models/one_value_chart_data_point.rb +210 -210
  86. data/lib/aspose_slides_cloud/models/one_value_series.rb +248 -248
  87. data/lib/aspose_slides_cloud/models/ordered_merge_request.rb +209 -209
  88. data/lib/aspose_slides_cloud/models/outer_shadow_effect.rb +252 -252
  89. data/lib/aspose_slides_cloud/models/output_file.rb +240 -240
  90. data/lib/aspose_slides_cloud/models/paragraph.rb +517 -517
  91. data/lib/aspose_slides_cloud/models/paragraphs.rb +209 -209
  92. data/lib/aspose_slides_cloud/models/path_input_file.rb +240 -240
  93. data/lib/aspose_slides_cloud/models/path_output_file.rb +239 -239
  94. data/lib/aspose_slides_cloud/models/pattern_fill.rb +266 -266
  95. data/lib/aspose_slides_cloud/models/pdf_export_options.rb +547 -547
  96. data/lib/aspose_slides_cloud/models/picture_fill.rb +351 -351
  97. data/lib/aspose_slides_cloud/models/picture_frame.rb +245 -245
  98. data/lib/aspose_slides_cloud/models/pipeline.rb +219 -219
  99. data/lib/aspose_slides_cloud/models/placeholder.rb +325 -325
  100. data/lib/aspose_slides_cloud/models/placeholders.rb +209 -209
  101. data/lib/aspose_slides_cloud/models/plot_area.rb +311 -311
  102. data/lib/aspose_slides_cloud/models/portion.rb +589 -589
  103. data/lib/aspose_slides_cloud/models/portions.rb +209 -209
  104. data/lib/aspose_slides_cloud/models/pptx_export_options.rb +247 -247
  105. data/lib/aspose_slides_cloud/models/presentation_to_merge.rb +273 -273
  106. data/lib/aspose_slides_cloud/models/presentations_merge_request.rb +221 -221
  107. data/lib/aspose_slides_cloud/models/preset_shadow_effect.rb +286 -286
  108. data/lib/aspose_slides_cloud/models/protection_properties.rb +267 -217
  109. data/lib/aspose_slides_cloud/models/reflection_effect.rb +441 -441
  110. data/lib/aspose_slides_cloud/models/remove_shape.rb +229 -229
  111. data/lib/aspose_slides_cloud/models/remove_slide.rb +234 -234
  112. data/lib/aspose_slides_cloud/models/reorder_slide.rb +249 -249
  113. data/lib/aspose_slides_cloud/models/replace_text.rb +269 -269
  114. data/lib/aspose_slides_cloud/models/request_input_file.rb +235 -235
  115. data/lib/aspose_slides_cloud/models/reset_slide.rb +234 -234
  116. data/lib/aspose_slides_cloud/models/resource_base.rb +219 -219
  117. data/lib/aspose_slides_cloud/models/resource_uri.rb +237 -237
  118. data/lib/aspose_slides_cloud/models/response_output_file.rb +219 -219
  119. data/lib/aspose_slides_cloud/models/save.rb +266 -266
  120. data/lib/aspose_slides_cloud/models/save_shape.rb +276 -276
  121. data/lib/aspose_slides_cloud/models/save_slide.rb +301 -301
  122. data/lib/aspose_slides_cloud/models/scatter_chart_data_point.rb +225 -225
  123. data/lib/aspose_slides_cloud/models/scatter_series.rb +248 -248
  124. data/lib/aspose_slides_cloud/models/section.rb +234 -234
  125. data/lib/aspose_slides_cloud/models/sections.rb +209 -209
  126. data/lib/aspose_slides_cloud/models/series.rb +422 -422
  127. data/lib/aspose_slides_cloud/models/series_marker.rb +281 -281
  128. data/lib/aspose_slides_cloud/models/shape.rb +255 -255
  129. data/lib/aspose_slides_cloud/models/shape_base.rb +375 -375
  130. data/lib/aspose_slides_cloud/models/shape_export_format.rb +44 -44
  131. data/lib/aspose_slides_cloud/models/shape_image_export_options.rb +286 -286
  132. data/lib/aspose_slides_cloud/models/shape_thumbnail_bounds.rb +41 -41
  133. data/lib/aspose_slides_cloud/models/shapes.rb +209 -209
  134. data/lib/aspose_slides_cloud/models/{scale_type.rb → shapes_alignment_type.rb} +46 -41
  135. data/lib/aspose_slides_cloud/models/slide.rb +322 -322
  136. data/lib/aspose_slides_cloud/models/slide_animation.rb +221 -221
  137. data/lib/aspose_slides_cloud/models/slide_background.rb +266 -266
  138. data/lib/aspose_slides_cloud/models/slide_comment.rb +239 -239
  139. data/lib/aspose_slides_cloud/models/slide_comments.rb +209 -209
  140. data/lib/aspose_slides_cloud/models/slide_export_format.rb +59 -59
  141. data/lib/aspose_slides_cloud/models/slide_properties.rb +315 -315
  142. data/lib/aspose_slides_cloud/models/slide_replace_result.rb +223 -223
  143. data/lib/aspose_slides_cloud/models/slides.rb +209 -209
  144. data/lib/aspose_slides_cloud/models/smart_art.rb +342 -342
  145. data/lib/aspose_slides_cloud/models/smart_art_node.rb +293 -293
  146. data/lib/aspose_slides_cloud/models/smart_art_shape.rb +235 -235
  147. data/lib/aspose_slides_cloud/models/soft_edge_effect.rb +212 -212
  148. data/lib/aspose_slides_cloud/models/solid_fill.rb +229 -229
  149. data/lib/aspose_slides_cloud/models/split_document_result.rb +209 -209
  150. data/lib/aspose_slides_cloud/models/storage_exist.rb +212 -212
  151. data/lib/aspose_slides_cloud/models/storage_file.rb +257 -257
  152. data/lib/aspose_slides_cloud/models/svg_export_options.rb +379 -379
  153. data/lib/aspose_slides_cloud/models/swf_export_options.rb +529 -529
  154. data/lib/aspose_slides_cloud/models/table.rb +350 -350
  155. data/lib/aspose_slides_cloud/models/table_cell.rb +403 -403
  156. data/lib/aspose_slides_cloud/models/table_column.rb +212 -212
  157. data/lib/aspose_slides_cloud/models/table_row.rb +239 -239
  158. data/lib/aspose_slides_cloud/models/task.rb +240 -240
  159. data/lib/aspose_slides_cloud/models/text_item.rb +217 -217
  160. data/lib/aspose_slides_cloud/models/text_items.rb +209 -209
  161. data/lib/aspose_slides_cloud/models/theme.rb +237 -237
  162. data/lib/aspose_slides_cloud/models/tiff_export_options.rb +423 -423
  163. data/lib/aspose_slides_cloud/models/update_background.rb +241 -241
  164. data/lib/aspose_slides_cloud/models/update_shape.rb +239 -239
  165. data/lib/aspose_slides_cloud/models/video_frame.rb +329 -329
  166. data/lib/aspose_slides_cloud/models/view_properties.rb +357 -357
  167. data/lib/aspose_slides_cloud/models/waterfall_chart_data_point.rb +206 -206
  168. data/lib/aspose_slides_cloud/models/waterfall_series.rb +247 -247
  169. data/lib/aspose_slides_cloud/models/xps_export_options.rb +243 -243
  170. data/lib/aspose_slides_cloud/type_registry.rb +323 -325
  171. data/lib/aspose_slides_cloud/version.rb +25 -25
  172. data/spec/api/slides_api_spec.rb +39435 -38557
  173. data/spec/extra/extra_spec.rb +202 -202
  174. data/spec/spec_utils.rb +182 -180
  175. data/testConfig.json +7 -7
  176. data/testRules.json +511 -495
  177. metadata +4 -4
  178. data/lib/aspose_slides_cloud/models/size_type.rb +0 -55
@@ -1,203 +1,203 @@
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 'spec_helper'
24
-
25
- describe 'SlidesApiExtra' do
26
- describe 'specific cases' do
27
- it 'multipart request' do
28
- pipeline = AsposeSlidesCloud::Pipeline.new
29
- pipeline.input = AsposeSlidesCloud::Input.new
30
- pipeline.input.template_data = AsposeSlidesCloud::RequestInputFile.new
31
- pipeline.input.template_data.type = "Request"
32
- pipeline.input.template_data.index = 0
33
- pipeline.input.template = AsposeSlidesCloud::RequestInputFile.new
34
- pipeline.input.template.type = "Request"
35
- pipeline.input.template.index = 1
36
- pipeline.tasks = []
37
- pipeline.tasks.push(AsposeSlidesCloud::Save.new)
38
- pipeline.tasks[0].type = "Save"
39
- pipeline.tasks[0].format = "pptx"
40
- pipeline.tasks[0].output = AsposeSlidesCloud::OutputFile.new
41
- pipeline.tasks[0].output.type = "Response"
42
- files = []
43
- files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "TemplatingCVDataWithBase64.xml")))
44
- files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "TemplateCV.pptx")))
45
- o, c, _h = AsposeSlidesCloud::SpecUtils.api.pipeline_with_http_info(pipeline, files)
46
- expect(c).to eq(200)
47
- expect(o).not_to be(nil)
48
- end
49
-
50
- it 'base shape' do
51
- AsposeSlidesCloud::SpecUtils.initialize('GetSlideShape', nil, nil)
52
- o = AsposeSlidesCloud::SpecUtils.api.get_shape("test.pptx", 1, 1, "password", "TempSlidesSDK")
53
- expect(o.text).to eq("1")
54
- end
55
-
56
- it 'chart' do
57
- chart = AsposeSlidesCloud::Chart.new
58
- expect(chart.type).to eq("Chart")
59
- end
60
-
61
- it 'timeout' do
62
- #unstable test
63
- #AsposeSlidesCloud::SpecUtils.initialize('post_slide_save_as', nil, nil)
64
-
65
- #config = JSON.parse(File.read('testConfig.json'))
66
- #configuration = AsposeSlidesCloud::Configuration.new
67
- #configuration.base_url = config["BaseUrl"]
68
- #configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
69
- #configuration.app_sid = config["ClientId"]
70
- #configuration.app_key = config["ClientSecret"]
71
- #configuration.debugging = config["Debug"]
72
- #configuration.timeout = 1
73
- #api = AsposeSlidesCloud::SlidesApi.new(configuration)
74
-
75
- #api.download_slide("test.pptx", 1, "svg", "password", "TempSlidesSDK")
76
- end
77
-
78
- it 'nullable properties' do
79
- folderName = "TempSlidesSDK"
80
- fileName = "placeholders.pptx"
81
- password = "password"
82
- min1 = 44.3
83
- min2 = 12
84
- max1 = 104.3
85
- max2 = 87
86
- AsposeSlidesCloud::SpecUtils.initialize("no_method", "no_property", nil)
87
- AsposeSlidesCloud::SpecUtils.api.copy_file("TempTests/" + fileName, folderName + "/" + fileName)
88
-
89
- dto = AsposeSlidesCloud::Chart.new
90
- dto.chart_type = "Line"
91
- dto.width = 400.0
92
- dto.height = 300.0
93
- dto.title = AsposeSlidesCloud::ChartTitle.new
94
- dto.title.has_title = true
95
- dto.title.text = "MyTitle"
96
- dto.series = []
97
- dto.series.push(AsposeSlidesCloud::OneValueSeries.new)
98
- dto.series[0].type = "ClusteredColumn"
99
- dto.series[0].data_point_type = "OneValue"
100
- dto.series[0].name = "Series1"
101
- dto.series[0].data_points = []
102
- dto.series[0].data_points.push(AsposeSlidesCloud::OneValueChartDataPoint.new)
103
- dto.series[0].data_points[0].value = 40.0
104
- dto.series[0].data_points.push(AsposeSlidesCloud::OneValueChartDataPoint.new)
105
- dto.series[0].data_points[1].value = 50.0
106
- dto.axes = AsposeSlidesCloud::Axes.new
107
- dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
108
- dto.axes.horizontal_axis.is_automatic_min_value = false
109
- dto.axes.horizontal_axis.min_value = min1
110
- dto.axes.horizontal_axis.is_automatic_max_value = false
111
- dto.axes.horizontal_axis.max_value = max1
112
- AsposeSlidesCloud::SpecUtils.api.create_shape(fileName, 1, dto, nil, nil, password, folderName)
113
-
114
- result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
115
- expect(result.axes.horizontal_axis.min_value).to eq(min1)
116
- expect(result.axes.horizontal_axis.max_value).to eq(max1)
117
-
118
- dto = AsposeSlidesCloud::Chart.new
119
- dto.axes = AsposeSlidesCloud::Axes.new
120
- dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
121
- dto.axes.horizontal_axis.min_value = min2
122
- AsposeSlidesCloud::SpecUtils.api.update_shape(fileName, 1, 4, dto, password, folderName)
123
-
124
- result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
125
- expect(result.axes.horizontal_axis.min_value).to eq(min2)
126
- expect(result.axes.horizontal_axis.max_value).to eq(max1)
127
-
128
- dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
129
- dto.axes.horizontal_axis.max_value = max2
130
- AsposeSlidesCloud::SpecUtils.api.update_shape(fileName, 1, 4, dto, password, folderName)
131
-
132
- result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
133
- expect(result.axes.horizontal_axis.min_value).to eq(min2)
134
- expect(result.axes.horizontal_axis.max_value).to eq(max2)
135
- end
136
- end
137
-
138
- describe 'authentication' do
139
- it 'good auth' do
140
- config = JSON.parse(File.read('testConfig.json'))
141
- configuration = AsposeSlidesCloud::Configuration.new
142
- configuration.base_url = config["BaseUrl"]
143
- configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
144
- configuration.app_sid = config["ClientId"]
145
- configuration.app_key = config["ClientSecret"]
146
- configuration.debugging = config["Debug"]
147
- api = AsposeSlidesCloud::SlidesApi.new(configuration)
148
- o, c, _h = api.get_api_info_with_http_info
149
- expect(c).to eq(200)
150
- expect(o).not_to be(nil)
151
- end
152
-
153
- it 'bad auth' do
154
- config = JSON.parse(File.read('testConfig.json'))
155
- configuration = AsposeSlidesCloud::Configuration.new
156
- configuration.base_url = config["BaseUrl"]
157
- configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
158
- configuration.app_sid = "invalid"
159
- configuration.app_key = config["ClientSecret"]
160
- configuration.debugging = config["Debug"]
161
- api = AsposeSlidesCloud::SlidesApi.new(configuration)
162
- begin
163
- o, c, _h = api.get_api_info_with_http_info
164
- fail "An exception expected"
165
- rescue AsposeSlidesCloud::ApiError => e
166
- expect(e.code).to eq(401)
167
- expect(e.response_body).to include("invalid_client")
168
- end
169
- end
170
-
171
- it 'good token' do
172
- config = JSON.parse(File.read('testConfig.json'))
173
- configuration = AsposeSlidesCloud::Configuration.new
174
- configuration.base_url = config["BaseUrl"]
175
- configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
176
- configuration.app_sid = config["ClientId"]
177
- configuration.app_key = config["ClientSecret"]
178
- configuration.debugging = config["Debug"]
179
- api = AsposeSlidesCloud::SlidesApi.new(configuration)
180
- api.get_api_info_with_http_info
181
- configuration.app_sid = "invalid"
182
- api = AsposeSlidesCloud::SlidesApi.new(configuration)
183
- o, c, _h = api.get_api_info_with_http_info
184
- expect(c).to eq(200)
185
- expect(o).not_to be(nil)
186
- end
187
-
188
- it 'bad token' do
189
- config = JSON.parse(File.read('testConfig.json'))
190
- configuration = AsposeSlidesCloud::Configuration.new
191
- configuration.base_url = config["BaseUrl"]
192
- configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
193
- configuration.app_sid = config["ClientId"]
194
- configuration.app_key = config["ClientSecret"]
195
- configuration.access_token = "expired.token"
196
- configuration.debugging = config["Debug"]
197
- api = AsposeSlidesCloud::SlidesApi.new(configuration)
198
- o, c, _h = api.get_api_info_with_http_info
199
- expect(c).to eq(200)
200
- expect(o).not_to be(nil)
201
- end
202
- end
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 'spec_helper'
24
+
25
+ describe 'SlidesApiExtra' do
26
+ describe 'specific cases' do
27
+ it 'multipart request' do
28
+ pipeline = AsposeSlidesCloud::Pipeline.new
29
+ pipeline.input = AsposeSlidesCloud::Input.new
30
+ pipeline.input.template_data = AsposeSlidesCloud::RequestInputFile.new
31
+ pipeline.input.template_data.type = "Request"
32
+ pipeline.input.template_data.index = 0
33
+ pipeline.input.template = AsposeSlidesCloud::RequestInputFile.new
34
+ pipeline.input.template.type = "Request"
35
+ pipeline.input.template.index = 1
36
+ pipeline.tasks = []
37
+ pipeline.tasks.push(AsposeSlidesCloud::Save.new)
38
+ pipeline.tasks[0].type = "Save"
39
+ pipeline.tasks[0].format = "pptx"
40
+ pipeline.tasks[0].output = AsposeSlidesCloud::OutputFile.new
41
+ pipeline.tasks[0].output.type = "Response"
42
+ files = []
43
+ files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "TemplatingCVDataWithBase64.xml")))
44
+ files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "TemplateCV.pptx")))
45
+ o, c, _h = AsposeSlidesCloud::SpecUtils.api.pipeline_with_http_info(pipeline, files)
46
+ expect(c).to eq(200)
47
+ expect(o).not_to be(nil)
48
+ end
49
+
50
+ it 'base shape' do
51
+ AsposeSlidesCloud::SpecUtils.initialize('GetSlideShape', nil, nil)
52
+ o = AsposeSlidesCloud::SpecUtils.api.get_shape("test.pptx", 1, 1, "password", "TempSlidesSDK")
53
+ expect(o.text).to eq("1")
54
+ end
55
+
56
+ it 'chart' do
57
+ chart = AsposeSlidesCloud::Chart.new
58
+ expect(chart.type).to eq("Chart")
59
+ end
60
+
61
+ it 'timeout' do
62
+ #unstable test
63
+ #AsposeSlidesCloud::SpecUtils.initialize('post_slide_save_as', nil, nil)
64
+
65
+ #config = JSON.parse(File.read('testConfig.json'))
66
+ #configuration = AsposeSlidesCloud::Configuration.new
67
+ #configuration.base_url = config["BaseUrl"]
68
+ #configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
69
+ #configuration.app_sid = config["ClientId"]
70
+ #configuration.app_key = config["ClientSecret"]
71
+ #configuration.debugging = config["Debug"]
72
+ #configuration.timeout = 1
73
+ #api = AsposeSlidesCloud::SlidesApi.new(configuration)
74
+
75
+ #api.download_slide("test.pptx", 1, "svg", "password", "TempSlidesSDK")
76
+ end
77
+
78
+ it 'nullable properties' do
79
+ folderName = "TempSlidesSDK"
80
+ fileName = "placeholders.pptx"
81
+ password = "password"
82
+ min1 = 44.3
83
+ min2 = 12
84
+ max1 = 104.3
85
+ max2 = 87
86
+ AsposeSlidesCloud::SpecUtils.initialize("no_method", "no_property", nil)
87
+ AsposeSlidesCloud::SpecUtils.api.copy_file("TempTests/" + fileName, folderName + "/" + fileName)
88
+
89
+ dto = AsposeSlidesCloud::Chart.new
90
+ dto.chart_type = "Line"
91
+ dto.width = 400.0
92
+ dto.height = 300.0
93
+ dto.title = AsposeSlidesCloud::ChartTitle.new
94
+ dto.title.has_title = true
95
+ dto.title.text = "MyTitle"
96
+ dto.series = []
97
+ dto.series.push(AsposeSlidesCloud::OneValueSeries.new)
98
+ dto.series[0].type = "ClusteredColumn"
99
+ dto.series[0].data_point_type = "OneValue"
100
+ dto.series[0].name = "Series1"
101
+ dto.series[0].data_points = []
102
+ dto.series[0].data_points.push(AsposeSlidesCloud::OneValueChartDataPoint.new)
103
+ dto.series[0].data_points[0].value = 40.0
104
+ dto.series[0].data_points.push(AsposeSlidesCloud::OneValueChartDataPoint.new)
105
+ dto.series[0].data_points[1].value = 50.0
106
+ dto.axes = AsposeSlidesCloud::Axes.new
107
+ dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
108
+ dto.axes.horizontal_axis.is_automatic_min_value = false
109
+ dto.axes.horizontal_axis.min_value = min1
110
+ dto.axes.horizontal_axis.is_automatic_max_value = false
111
+ dto.axes.horizontal_axis.max_value = max1
112
+ AsposeSlidesCloud::SpecUtils.api.create_shape(fileName, 1, dto, nil, nil, password, folderName)
113
+
114
+ result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
115
+ expect(result.axes.horizontal_axis.min_value).to eq(min1)
116
+ expect(result.axes.horizontal_axis.max_value).to eq(max1)
117
+
118
+ dto = AsposeSlidesCloud::Chart.new
119
+ dto.axes = AsposeSlidesCloud::Axes.new
120
+ dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
121
+ dto.axes.horizontal_axis.min_value = min2
122
+ AsposeSlidesCloud::SpecUtils.api.update_shape(fileName, 1, 4, dto, password, folderName)
123
+
124
+ result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
125
+ expect(result.axes.horizontal_axis.min_value).to eq(min2)
126
+ expect(result.axes.horizontal_axis.max_value).to eq(max1)
127
+
128
+ dto.axes.horizontal_axis = AsposeSlidesCloud::Axis.new
129
+ dto.axes.horizontal_axis.max_value = max2
130
+ AsposeSlidesCloud::SpecUtils.api.update_shape(fileName, 1, 4, dto, password, folderName)
131
+
132
+ result = AsposeSlidesCloud::SpecUtils.api.get_shape(fileName, 1, 4, password, folderName)
133
+ expect(result.axes.horizontal_axis.min_value).to eq(min2)
134
+ expect(result.axes.horizontal_axis.max_value).to eq(max2)
135
+ end
136
+ end
137
+
138
+ describe 'authentication' do
139
+ it 'good auth' do
140
+ config = JSON.parse(File.read('testConfig.json'))
141
+ configuration = AsposeSlidesCloud::Configuration.new
142
+ configuration.base_url = config["BaseUrl"]
143
+ configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
144
+ configuration.app_sid = config["ClientId"]
145
+ configuration.app_key = config["ClientSecret"]
146
+ configuration.debugging = config["Debug"]
147
+ api = AsposeSlidesCloud::SlidesApi.new(configuration)
148
+ o, c, _h = api.get_api_info_with_http_info
149
+ expect(c).to eq(200)
150
+ expect(o).not_to be(nil)
151
+ end
152
+
153
+ it 'bad auth' do
154
+ config = JSON.parse(File.read('testConfig.json'))
155
+ configuration = AsposeSlidesCloud::Configuration.new
156
+ configuration.base_url = config["BaseUrl"]
157
+ configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
158
+ configuration.app_sid = "invalid"
159
+ configuration.app_key = config["ClientSecret"]
160
+ configuration.debugging = config["Debug"]
161
+ api = AsposeSlidesCloud::SlidesApi.new(configuration)
162
+ begin
163
+ o, c, _h = api.get_api_info_with_http_info
164
+ fail "An exception expected"
165
+ rescue AsposeSlidesCloud::ApiError => e
166
+ expect(e.code).to eq(401)
167
+ expect(e.response_body).to include("invalid_client")
168
+ end
169
+ end
170
+
171
+ it 'good token' do
172
+ config = JSON.parse(File.read('testConfig.json'))
173
+ configuration = AsposeSlidesCloud::Configuration.new
174
+ configuration.base_url = config["BaseUrl"]
175
+ configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
176
+ configuration.app_sid = config["ClientId"]
177
+ configuration.app_key = config["ClientSecret"]
178
+ configuration.debugging = config["Debug"]
179
+ api = AsposeSlidesCloud::SlidesApi.new(configuration)
180
+ api.get_api_info_with_http_info
181
+ configuration.app_sid = "invalid"
182
+ api = AsposeSlidesCloud::SlidesApi.new(configuration)
183
+ o, c, _h = api.get_api_info_with_http_info
184
+ expect(c).to eq(200)
185
+ expect(o).not_to be(nil)
186
+ end
187
+
188
+ it 'bad token' do
189
+ config = JSON.parse(File.read('testConfig.json'))
190
+ configuration = AsposeSlidesCloud::Configuration.new
191
+ configuration.base_url = config["BaseUrl"]
192
+ configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
193
+ configuration.app_sid = config["ClientId"]
194
+ configuration.app_key = config["ClientSecret"]
195
+ configuration.access_token = "expired.token"
196
+ configuration.debugging = config["Debug"]
197
+ api = AsposeSlidesCloud::SlidesApi.new(configuration)
198
+ o, c, _h = api.get_api_info_with_http_info
199
+ expect(c).to eq(200)
200
+ expect(o).not_to be(nil)
201
+ end
202
+ end
203
203
  end
data/spec/spec_utils.rb CHANGED
@@ -1,180 +1,182 @@
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
- module AsposeSlidesCloud
24
- class SpecUtils
25
- def self.initialize(method, name, value)
26
- if !@@is_initialized
27
- version = ""
28
- begin
29
- version = SpecUtils.api.download_file("TempTests/version.txt")
30
- rescue AsposeSlidesCloud::ApiError => e
31
- if e.code != 404
32
- fail "Could not read from storage"
33
- end
34
- end
35
- if version != EXPECTED_TEST_DATA_VERSION
36
- Dir.entries(TEST_DATA_PATH).each { |f|
37
- if !File.directory? File.join(TEST_DATA_PATH, f)
38
- fd = File.binread(File.join(TEST_DATA_PATH, f))
39
- SpecUtils.api.upload_file("TempTests/" + f, fd)
40
- end
41
- }
42
- SpecUtils.api.upload_file("TempTests/version.txt", EXPECTED_TEST_DATA_VERSION)
43
- end
44
- @@is_initialized = true
45
- end
46
- files = Hash.new
47
- SpecUtils.test_rules["Files"].each do |rule|
48
- if SpecUtils.good_rule?(rule, name, method)
49
- actual_name = SpecUtils.untemplatize(rule["File"], value)
50
- path = "TempSlidesSDK"
51
- if rule.key?("Folder")
52
- path = SpecUtils.untemplatize(rule["Folder"], value)
53
- end
54
- path = path + "/" + actual_name
55
- files[path] = rule
56
- rule["ActualName"] = actual_name
57
- end
58
- end
59
- files.each do |path, rule|
60
- if rule["Action"] == "Put"
61
- SpecUtils.api.copy_file("TempTests/" + rule['ActualName'], path)
62
- elsif rule["Action"] == "Delete"
63
- SpecUtils.api.delete_file(path)
64
- end
65
- end
66
- end
67
-
68
- def self.get_param_value(name, method, type)
69
- if type == 'File'
70
- fileName = "test.pptx"
71
- if method.casecmp("PostSlidesDocumentFromPdf") == 0
72
- fileName = "test.pdf"
73
- end
74
- return File.binread(File.join(TEST_DATA_PATH, fileName))
75
- end
76
- if type == 'File[]'
77
- files = []
78
- files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test.pptx")))
79
- files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test-unprotected.pptx")))
80
- return files
81
- end
82
- value = "test" + name
83
- SpecUtils.test_rules["Values"].each do |rule|
84
- if SpecUtils.good_rule?(rule, name, method) and rule.key?("Value")
85
- value = rule["Value"]
86
- end
87
- end
88
- value
89
- end
90
-
91
- def self.invalidize_param_value(name, method, value, type)
92
- if type == 'File'
93
- return nil
94
- end
95
- invalid_value = nil
96
- SpecUtils.test_rules["Values"].each do |rule|
97
- if SpecUtils.good_rule?(rule, name, method) and rule.key?("InvalidValue")
98
- invalid_value = rule["InvalidValue"]
99
- end
100
- end
101
- SpecUtils.untemplatize(invalid_value, value)
102
- end
103
-
104
- def self.get_expected_error(method, name, value)
105
- code = 0
106
- message = "Unexpeceted message"
107
- SpecUtils.test_rules["Results"].each do |rule|
108
- if SpecUtils.good_rule?(rule, name, method)
109
- if rule.key?("Code")
110
- code = rule["Code"]
111
- end
112
- if rule.key?("Message")
113
- message = SpecUtils.untemplatize(rule["Message"], value)
114
- end
115
- end
116
- end
117
- return code, message
118
- end
119
-
120
- def self.no_exception?(method, name)
121
- SpecUtils.test_rules["OKToNotFail"].each do |rule|
122
- return true
123
- end
124
- return false
125
- end
126
-
127
- def self.good_rule?(rule, name, method)
128
- (not rule.key?("Language") or rule["Language"].casecmp("Ruby") == 0) \
129
- and (not rule.key?("Invalid") or ((name != nil) == rule["Invalid"])) \
130
- and (not rule.key?("Parameter") or (name != nil and rule["Parameter"].casecmp(name) == 0)) \
131
- and (not rule.key?("Method") or (method != nil and rule["Method"].casecmp(method) == 0))
132
- end
133
-
134
- def self.untemplatize(template, value)
135
- if template == nil
136
- value
137
- else
138
- result = template
139
- if template.is_a? String and template.match("%v")
140
- result = "" + template
141
- if value != nil
142
- result["%v"] = value.to_s
143
- else
144
- result["%v"] = ""
145
- end
146
- end
147
- result
148
- end
149
- end
150
-
151
- def self.test_rules
152
- unless @@test_rules
153
- @@test_rules = JSON.parse(File.read('testRules.json'))
154
- end
155
- @@test_rules
156
- end
157
-
158
- @@test_rules = nil
159
-
160
- def self.api
161
- unless @@api
162
- config = JSON.parse(File.read('testConfig.json'))
163
- configuration = AsposeSlidesCloud::Configuration.new
164
- configuration.base_url = config["BaseUrl"]
165
- configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
166
- configuration.app_sid = config["ClientId"]
167
- configuration.app_key = config["ClientSecret"]
168
- configuration.debugging = config["Debug"]
169
- @@api = AsposeSlidesCloud::SlidesApi.new(configuration)
170
- end
171
- @@api
172
- end
173
-
174
- @@api = nil
175
- @@is_initialized = false
176
-
177
- TEST_DATA_PATH = "TestData"
178
- EXPECTED_TEST_DATA_VERSION = "1"
179
- end
180
- end
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
+ module AsposeSlidesCloud
24
+ class SpecUtils
25
+ def self.initialize(method, name, value)
26
+ if !@@is_initialized
27
+ version = ""
28
+ begin
29
+ version = SpecUtils.api.download_file("TempTests/version.txt")
30
+ rescue AsposeSlidesCloud::ApiError => e
31
+ if e.code != 404
32
+ fail "Could not read from storage"
33
+ end
34
+ end
35
+ if version != EXPECTED_TEST_DATA_VERSION
36
+ Dir.entries(TEST_DATA_PATH).each { |f|
37
+ if !File.directory? File.join(TEST_DATA_PATH, f)
38
+ fd = File.binread(File.join(TEST_DATA_PATH, f))
39
+ SpecUtils.api.upload_file("TempTests/" + f, fd)
40
+ end
41
+ }
42
+ SpecUtils.api.upload_file("TempTests/version.txt", EXPECTED_TEST_DATA_VERSION)
43
+ end
44
+ @@is_initialized = true
45
+ end
46
+ files = Hash.new
47
+ SpecUtils.test_rules["Files"].each do |rule|
48
+ if SpecUtils.good_rule?(rule, name, method)
49
+ actual_name = SpecUtils.untemplatize(rule["File"], value)
50
+ path = "TempSlidesSDK"
51
+ if rule.key?("Folder")
52
+ path = SpecUtils.untemplatize(rule["Folder"], value)
53
+ end
54
+ path = path + "/" + actual_name
55
+ files[path] = rule
56
+ rule["ActualName"] = actual_name
57
+ end
58
+ end
59
+ files.each do |path, rule|
60
+ if rule["Action"] == "Put"
61
+ SpecUtils.api.copy_file("TempTests/" + rule['ActualName'], path)
62
+ elsif rule["Action"] == "Delete"
63
+ SpecUtils.api.delete_file(path)
64
+ end
65
+ end
66
+ end
67
+
68
+ def self.get_param_value(name, method, type)
69
+ if type == 'File'
70
+ fileName = "test.pptx"
71
+ if method.casecmp("PostSlidesDocumentFromPdf") == 0
72
+ fileName = "test.pdf"
73
+ elsif name.casecmp("Image") == 0
74
+ fileName = "watermark.png"
75
+ end
76
+ return File.binread(File.join(TEST_DATA_PATH, fileName))
77
+ end
78
+ if type == 'File[]'
79
+ files = []
80
+ files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test.pptx")))
81
+ files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test-unprotected.pptx")))
82
+ return files
83
+ end
84
+ value = "test" + name
85
+ SpecUtils.test_rules["Values"].each do |rule|
86
+ if SpecUtils.good_rule?(rule, name, method) and rule.key?("Value")
87
+ value = rule["Value"]
88
+ end
89
+ end
90
+ value
91
+ end
92
+
93
+ def self.invalidize_param_value(name, method, value, type)
94
+ if type == 'File'
95
+ return nil
96
+ end
97
+ invalid_value = nil
98
+ SpecUtils.test_rules["Values"].each do |rule|
99
+ if SpecUtils.good_rule?(rule, name, method) and rule.key?("InvalidValue")
100
+ invalid_value = rule["InvalidValue"]
101
+ end
102
+ end
103
+ SpecUtils.untemplatize(invalid_value, value)
104
+ end
105
+
106
+ def self.get_expected_error(method, name, value)
107
+ code = 0
108
+ message = "Unexpeceted message"
109
+ SpecUtils.test_rules["Results"].each do |rule|
110
+ if SpecUtils.good_rule?(rule, name, method)
111
+ if rule.key?("Code")
112
+ code = rule["Code"]
113
+ end
114
+ if rule.key?("Message")
115
+ message = SpecUtils.untemplatize(rule["Message"], value)
116
+ end
117
+ end
118
+ end
119
+ return code, message
120
+ end
121
+
122
+ def self.no_exception?(method, name)
123
+ SpecUtils.test_rules["OKToNotFail"].each do |rule|
124
+ return true
125
+ end
126
+ return false
127
+ end
128
+
129
+ def self.good_rule?(rule, name, method)
130
+ (not rule.key?("Language") or rule["Language"].casecmp("Ruby") == 0) \
131
+ and (not rule.key?("Invalid") or ((name != nil) == rule["Invalid"])) \
132
+ and (not rule.key?("Parameter") or (name != nil and rule["Parameter"].casecmp(name) == 0)) \
133
+ and (not rule.key?("Method") or (method != nil and rule["Method"].casecmp(method) == 0))
134
+ end
135
+
136
+ def self.untemplatize(template, value)
137
+ if template == nil
138
+ value
139
+ else
140
+ result = template
141
+ if template.is_a? String and template.match("%v")
142
+ result = "" + template
143
+ if value != nil
144
+ result["%v"] = value.to_s
145
+ else
146
+ result["%v"] = ""
147
+ end
148
+ end
149
+ result
150
+ end
151
+ end
152
+
153
+ def self.test_rules
154
+ unless @@test_rules
155
+ @@test_rules = JSON.parse(File.read('testRules.json'))
156
+ end
157
+ @@test_rules
158
+ end
159
+
160
+ @@test_rules = nil
161
+
162
+ def self.api
163
+ unless @@api
164
+ config = JSON.parse(File.read('testConfig.json'))
165
+ configuration = AsposeSlidesCloud::Configuration.new
166
+ configuration.base_url = config["BaseUrl"]
167
+ configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
168
+ configuration.app_sid = config["ClientId"]
169
+ configuration.app_key = config["ClientSecret"]
170
+ configuration.debugging = config["Debug"]
171
+ @@api = AsposeSlidesCloud::SlidesApi.new(configuration)
172
+ end
173
+ @@api
174
+ end
175
+
176
+ @@api = nil
177
+ @@is_initialized = false
178
+
179
+ TEST_DATA_PATH = "TestData"
180
+ EXPECTED_TEST_DATA_VERSION = "1"
181
+ end
182
+ end