groupdocs_viewer_cloud 19.3 → 20.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_viewer_cloud.rb +21 -3
  3. data/lib/groupdocs_viewer_cloud/api/file_api.rb +7 -7
  4. data/lib/groupdocs_viewer_cloud/api/folder_api.rb +7 -7
  5. data/lib/groupdocs_viewer_cloud/api/info_api.rb +266 -0
  6. data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
  7. data/lib/groupdocs_viewer_cloud/api/{viewer_api.rb → view_api.rb} +22 -168
  8. data/lib/groupdocs_viewer_cloud/api_client.rb +1 -1
  9. data/lib/groupdocs_viewer_cloud/api_error.rb +7 -4
  10. data/lib/groupdocs_viewer_cloud/configuration.rb +1 -1
  11. data/lib/groupdocs_viewer_cloud/models/archive_options.rb +214 -0
  12. data/lib/groupdocs_viewer_cloud/models/archive_view_info.rb +216 -0
  13. data/lib/groupdocs_viewer_cloud/models/attachment_info.rb +1 -1
  14. data/lib/groupdocs_viewer_cloud/models/attachment_view.rb +1 -1
  15. data/lib/groupdocs_viewer_cloud/models/cad_options.rb +54 -5
  16. data/lib/groupdocs_viewer_cloud/models/cad_view_info.rb +228 -0
  17. data/lib/groupdocs_viewer_cloud/models/character.rb +274 -0
  18. data/lib/groupdocs_viewer_cloud/models/delete_view_options.rb +15 -5
  19. data/lib/groupdocs_viewer_cloud/models/disc_usage.rb +1 -1
  20. data/lib/groupdocs_viewer_cloud/models/email_options.rb +44 -2
  21. data/lib/groupdocs_viewer_cloud/models/error.rb +1 -1
  22. data/lib/groupdocs_viewer_cloud/models/error_details.rb +1 -1
  23. data/lib/groupdocs_viewer_cloud/models/field_label.rb +1 -1
  24. data/lib/groupdocs_viewer_cloud/models/file_info.rb +1 -1
  25. data/lib/groupdocs_viewer_cloud/models/file_version.rb +1 -1
  26. data/lib/groupdocs_viewer_cloud/models/file_versions.rb +1 -1
  27. data/lib/groupdocs_viewer_cloud/models/files_list.rb +1 -1
  28. data/lib/groupdocs_viewer_cloud/models/files_upload_result.rb +1 -1
  29. data/lib/groupdocs_viewer_cloud/models/format.rb +1 -1
  30. data/lib/groupdocs_viewer_cloud/models/formats_result.rb +1 -1
  31. data/lib/groupdocs_viewer_cloud/models/html_options.rb +146 -10
  32. data/lib/groupdocs_viewer_cloud/models/html_resource.rb +1 -1
  33. data/lib/groupdocs_viewer_cloud/models/image_options.rb +86 -7
  34. data/lib/groupdocs_viewer_cloud/models/info_result.rb +75 -5
  35. data/lib/groupdocs_viewer_cloud/models/layer.rb +229 -0
  36. data/lib/groupdocs_viewer_cloud/models/layout.rb +244 -0
  37. data/lib/groupdocs_viewer_cloud/models/{row.rb → line.rb} +60 -72
  38. data/lib/groupdocs_viewer_cloud/models/object_exist.rb +1 -1
  39. data/lib/groupdocs_viewer_cloud/models/outlook_options.rb +249 -0
  40. data/lib/groupdocs_viewer_cloud/models/outlook_view_info.rb +216 -0
  41. data/lib/groupdocs_viewer_cloud/models/page_info.rb +28 -13
  42. data/lib/groupdocs_viewer_cloud/models/page_rotation.rb +271 -0
  43. data/lib/groupdocs_viewer_cloud/models/page_view.rb +1 -1
  44. data/lib/groupdocs_viewer_cloud/models/pdf_document_options.rb +316 -0
  45. data/lib/groupdocs_viewer_cloud/models/pdf_options.rb +490 -0
  46. data/lib/groupdocs_viewer_cloud/models/pdf_view_info.rb +219 -0
  47. data/lib/groupdocs_viewer_cloud/models/project_management_options.rb +66 -3
  48. data/lib/groupdocs_viewer_cloud/models/project_management_view_info.rb +234 -0
  49. data/lib/groupdocs_viewer_cloud/models/render_options.rb +89 -10
  50. data/lib/groupdocs_viewer_cloud/models/resource.rb +1 -1
  51. data/lib/groupdocs_viewer_cloud/models/spreadsheet_options.rb +57 -5
  52. data/lib/groupdocs_viewer_cloud/models/storage_exist.rb +1 -1
  53. data/lib/groupdocs_viewer_cloud/models/storage_file.rb +1 -1
  54. data/lib/groupdocs_viewer_cloud/models/text_element.rb +274 -0
  55. data/lib/groupdocs_viewer_cloud/models/tile.rb +264 -0
  56. data/lib/groupdocs_viewer_cloud/models/view_options.rb +15 -5
  57. data/lib/groupdocs_viewer_cloud/models/view_result.rb +1 -1
  58. data/lib/groupdocs_viewer_cloud/models/watermark.rb +44 -2
  59. data/lib/groupdocs_viewer_cloud/models/word.rb +286 -0
  60. data/lib/groupdocs_viewer_cloud/models/word_processing_options.rb +219 -0
  61. data/lib/groupdocs_viewer_cloud/version.rb +2 -2
  62. metadata +22 -4
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="render_options.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -37,43 +37,71 @@ module GroupDocsViewerCloud
37
37
  # Count pages which should be rendered
38
38
  attr_accessor :count_pages_to_render
39
39
 
40
+ # Pages list to render. Ignored, if StartPageNumber and CountPagesToRender are provided
41
+ attr_accessor :pages_to_render
42
+
43
+ # Page rotations
44
+ attr_accessor :page_rotations
45
+
40
46
  # Default font name may be specified in following cases: - You want to generally specify the default font to fall back on, if particular font in the document cannot be found during rendering. - Your document uses fonts, that contain non-English characters and you want to make sure any missing font is replaced with one that has the same character set available.
41
47
  attr_accessor :default_font_name
42
48
 
43
49
  # Default encoding for the plain text files such as .csv, .txt and .eml files when encoding is not specified in header
44
50
  attr_accessor :default_encoding
45
51
 
46
- # When enabled comments will be rendered to the output.
52
+ # When enabled comments will be rendered to the output
47
53
  attr_accessor :render_comments
48
54
 
55
+ # When enabled notes will be rendered to the output
56
+ attr_accessor :render_notes
57
+
49
58
  # When enabled hidden pages, sheets or slides will be rendered to the output
50
59
  attr_accessor :render_hidden_pages
51
60
 
52
- # Rendering options for Spreadsheet file formats. Spreadsheet file formats include files with extensions: .xls, .xlsx, .xlsm, .xlsb, .csv, .ods, .ots, .xltx, .xltm, .tsv
61
+ # Rendering options for Spreadsheet source file formats Spreadsheet file formats include files with extensions: .xls, .xlsx, .xlsm, .xlsb, .csv, .ods, .ots, .xltx, .xltm, .tsv
53
62
  attr_accessor :spreadsheet_options
54
63
 
55
- # Rendering options for CAD file formats. CAD file formats include files with extensions: .dwg, .dxf, .dgn, .ifc, .stl
64
+ # Rendering options for CAD source file formats CAD file formats include files with extensions: .dwg, .dxf, .dgn, .ifc, .stl
56
65
  attr_accessor :cad_options
57
66
 
58
- # Rendering options for Email file formats. Email file formats include files with extensions: .msg, .eml, .emlx, .ifc, .stl
67
+ # Rendering options for Email source file formats Email file formats include files with extensions: .msg, .eml, .emlx, .ifc, .stl
59
68
  attr_accessor :email_options
60
69
 
61
- # Rendering options for Project file formats. Project file formats include files with extensions: .mpt, .mpp
70
+ # Rendering options for MS Project source file formats Project file formats include files with extensions: .mpt, .mpp
62
71
  attr_accessor :project_management_options
63
72
 
73
+ # Rendering options for PDF source file formats
74
+ attr_accessor :pdf_document_options
75
+
76
+ # Rendering options for WordProcessing source file formats
77
+ attr_accessor :word_processing_options
78
+
79
+ # Rendering options for Outlook source file formats
80
+ attr_accessor :outlook_options
81
+
82
+ # Rendering options for Archive source file formats
83
+ attr_accessor :archive_options
84
+
64
85
  # Attribute mapping from ruby-style variable name to JSON key.
65
86
  def self.attribute_map
66
87
  {
67
88
  :'start_page_number' => :'StartPageNumber',
68
89
  :'count_pages_to_render' => :'CountPagesToRender',
90
+ :'pages_to_render' => :'PagesToRender',
91
+ :'page_rotations' => :'PageRotations',
69
92
  :'default_font_name' => :'DefaultFontName',
70
93
  :'default_encoding' => :'DefaultEncoding',
71
94
  :'render_comments' => :'RenderComments',
95
+ :'render_notes' => :'RenderNotes',
72
96
  :'render_hidden_pages' => :'RenderHiddenPages',
73
97
  :'spreadsheet_options' => :'SpreadsheetOptions',
74
98
  :'cad_options' => :'CadOptions',
75
99
  :'email_options' => :'EmailOptions',
76
- :'project_management_options' => :'ProjectManagementOptions'
100
+ :'project_management_options' => :'ProjectManagementOptions',
101
+ :'pdf_document_options' => :'PdfDocumentOptions',
102
+ :'word_processing_options' => :'WordProcessingOptions',
103
+ :'outlook_options' => :'OutlookOptions',
104
+ :'archive_options' => :'ArchiveOptions'
77
105
  }
78
106
  end
79
107
 
@@ -82,14 +110,21 @@ module GroupDocsViewerCloud
82
110
  {
83
111
  :'start_page_number' => :'Integer',
84
112
  :'count_pages_to_render' => :'Integer',
113
+ :'pages_to_render' => :'Array<Integer>',
114
+ :'page_rotations' => :'Array<PageRotation>',
85
115
  :'default_font_name' => :'String',
86
116
  :'default_encoding' => :'String',
87
117
  :'render_comments' => :'BOOLEAN',
118
+ :'render_notes' => :'BOOLEAN',
88
119
  :'render_hidden_pages' => :'BOOLEAN',
89
120
  :'spreadsheet_options' => :'SpreadsheetOptions',
90
121
  :'cad_options' => :'CadOptions',
91
122
  :'email_options' => :'EmailOptions',
92
- :'project_management_options' => :'ProjectManagementOptions'
123
+ :'project_management_options' => :'ProjectManagementOptions',
124
+ :'pdf_document_options' => :'PdfDocumentOptions',
125
+ :'word_processing_options' => :'WordProcessingOptions',
126
+ :'outlook_options' => :'OutlookOptions',
127
+ :'archive_options' => :'ArchiveOptions'
93
128
  }
94
129
  end
95
130
 
@@ -109,6 +144,18 @@ module GroupDocsViewerCloud
109
144
  self.count_pages_to_render = attributes[:'CountPagesToRender']
110
145
  end
111
146
 
147
+ if attributes.key?(:'PagesToRender')
148
+ if (value = attributes[:'PagesToRender']).is_a?(Array)
149
+ self.pages_to_render = value
150
+ end
151
+ end
152
+
153
+ if attributes.key?(:'PageRotations')
154
+ if (value = attributes[:'PageRotations']).is_a?(Array)
155
+ self.page_rotations = value
156
+ end
157
+ end
158
+
112
159
  if attributes.key?(:'DefaultFontName')
113
160
  self.default_font_name = attributes[:'DefaultFontName']
114
161
  end
@@ -121,6 +168,10 @@ module GroupDocsViewerCloud
121
168
  self.render_comments = attributes[:'RenderComments']
122
169
  end
123
170
 
171
+ if attributes.key?(:'RenderNotes')
172
+ self.render_notes = attributes[:'RenderNotes']
173
+ end
174
+
124
175
  if attributes.key?(:'RenderHiddenPages')
125
176
  self.render_hidden_pages = attributes[:'RenderHiddenPages']
126
177
  end
@@ -141,6 +192,22 @@ module GroupDocsViewerCloud
141
192
  self.project_management_options = attributes[:'ProjectManagementOptions']
142
193
  end
143
194
 
195
+ if attributes.key?(:'PdfDocumentOptions')
196
+ self.pdf_document_options = attributes[:'PdfDocumentOptions']
197
+ end
198
+
199
+ if attributes.key?(:'WordProcessingOptions')
200
+ self.word_processing_options = attributes[:'WordProcessingOptions']
201
+ end
202
+
203
+ if attributes.key?(:'OutlookOptions')
204
+ self.outlook_options = attributes[:'OutlookOptions']
205
+ end
206
+
207
+ if attributes.key?(:'ArchiveOptions')
208
+ self.archive_options = attributes[:'ArchiveOptions']
209
+ end
210
+
144
211
  end
145
212
 
146
213
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -159,6 +226,10 @@ module GroupDocsViewerCloud
159
226
  invalid_properties.push("invalid value for 'render_comments', render_comments cannot be nil.")
160
227
  end
161
228
 
229
+ if @render_notes.nil?
230
+ invalid_properties.push("invalid value for 'render_notes', render_notes cannot be nil.")
231
+ end
232
+
162
233
  if @render_hidden_pages.nil?
163
234
  invalid_properties.push("invalid value for 'render_hidden_pages', render_hidden_pages cannot be nil.")
164
235
  end
@@ -172,6 +243,7 @@ module GroupDocsViewerCloud
172
243
  return false if @start_page_number.nil?
173
244
  return false if @count_pages_to_render.nil?
174
245
  return false if @render_comments.nil?
246
+ return false if @render_notes.nil?
175
247
  return false if @render_hidden_pages.nil?
176
248
  return true
177
249
  end
@@ -183,14 +255,21 @@ module GroupDocsViewerCloud
183
255
  self.class == other.class &&
184
256
  start_page_number == other.start_page_number &&
185
257
  count_pages_to_render == other.count_pages_to_render &&
258
+ pages_to_render == other.pages_to_render &&
259
+ page_rotations == other.page_rotations &&
186
260
  default_font_name == other.default_font_name &&
187
261
  default_encoding == other.default_encoding &&
188
262
  render_comments == other.render_comments &&
263
+ render_notes == other.render_notes &&
189
264
  render_hidden_pages == other.render_hidden_pages &&
190
265
  spreadsheet_options == other.spreadsheet_options &&
191
266
  cad_options == other.cad_options &&
192
267
  email_options == other.email_options &&
193
- project_management_options == other.project_management_options
268
+ project_management_options == other.project_management_options &&
269
+ pdf_document_options == other.pdf_document_options &&
270
+ word_processing_options == other.word_processing_options &&
271
+ outlook_options == other.outlook_options &&
272
+ archive_options == other.archive_options
194
273
  end
195
274
 
196
275
  # @see the `==` method
@@ -202,7 +281,7 @@ module GroupDocsViewerCloud
202
281
  # Calculates hash code according to all attributes.
203
282
  # @return [Fixnum] Hash code
204
283
  def hash
205
- [start_page_number, count_pages_to_render, default_font_name, default_encoding, render_comments, render_hidden_pages, spreadsheet_options, cad_options, email_options, project_management_options].hash
284
+ [start_page_number, count_pages_to_render, pages_to_render, page_rotations, default_font_name, default_encoding, render_comments, render_notes, render_hidden_pages, spreadsheet_options, cad_options, email_options, project_management_options, pdf_document_options, word_processing_options, outlook_options, archive_options].hash
206
285
  end
207
286
 
208
287
  # Downcases first letter.
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="resource.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="spreadsheet_options.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -55,6 +55,30 @@ module GroupDocsViewerCloud
55
55
  # Enables rendering worksheet(s) sections which is defined as print area. Renders each print area in a worksheet as a separate page.
56
56
  attr_accessor :render_print_area_only
57
57
 
58
+ # The text overflow mode for rendering spreadsheet documents into HTML
59
+ attr_accessor :text_overflow_mode
60
+ class EnumAttributeValidator
61
+ attr_reader :datatype
62
+ attr_reader :allowable_values
63
+
64
+ def initialize(datatype, allowable_values)
65
+ @allowable_values = allowable_values.map do |value|
66
+ case datatype.to_s
67
+ when /Integer/i
68
+ value.to_i
69
+ when /Float/i
70
+ value.to_f
71
+ else
72
+ value
73
+ end
74
+ end
75
+ end
76
+
77
+ def valid?(value)
78
+ !value || allowable_values.include?(value)
79
+ end
80
+ end
81
+
58
82
  # Attribute mapping from ruby-style variable name to JSON key.
59
83
  def self.attribute_map
60
84
  {
@@ -65,7 +89,8 @@ module GroupDocsViewerCloud
65
89
  :'render_empty_columns' => :'RenderEmptyColumns',
66
90
  :'render_hidden_rows' => :'RenderHiddenRows',
67
91
  :'render_hidden_columns' => :'RenderHiddenColumns',
68
- :'render_print_area_only' => :'RenderPrintAreaOnly'
92
+ :'render_print_area_only' => :'RenderPrintAreaOnly',
93
+ :'text_overflow_mode' => :'TextOverflowMode'
69
94
  }
70
95
  end
71
96
 
@@ -79,7 +104,8 @@ module GroupDocsViewerCloud
79
104
  :'render_empty_columns' => :'BOOLEAN',
80
105
  :'render_hidden_rows' => :'BOOLEAN',
81
106
  :'render_hidden_columns' => :'BOOLEAN',
82
- :'render_print_area_only' => :'BOOLEAN'
107
+ :'render_print_area_only' => :'BOOLEAN',
108
+ :'text_overflow_mode' => :'String'
83
109
  }
84
110
  end
85
111
 
@@ -123,6 +149,10 @@ module GroupDocsViewerCloud
123
149
  self.render_print_area_only = attributes[:'RenderPrintAreaOnly']
124
150
  end
125
151
 
152
+ if attributes.key?(:'TextOverflowMode')
153
+ self.text_overflow_mode = attributes[:'TextOverflowMode']
154
+ end
155
+
126
156
  end
127
157
 
128
158
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -161,6 +191,10 @@ module GroupDocsViewerCloud
161
191
  invalid_properties.push("invalid value for 'render_print_area_only', render_print_area_only cannot be nil.")
162
192
  end
163
193
 
194
+ if @text_overflow_mode.nil?
195
+ invalid_properties.push("invalid value for 'text_overflow_mode', text_overflow_mode cannot be nil.")
196
+ end
197
+
164
198
  return invalid_properties
165
199
  end
166
200
 
@@ -175,9 +209,26 @@ module GroupDocsViewerCloud
175
209
  return false if @render_hidden_rows.nil?
176
210
  return false if @render_hidden_columns.nil?
177
211
  return false if @render_print_area_only.nil?
212
+ return false if @text_overflow_mode.nil?
213
+ text_overflow_mode_validator = EnumAttributeValidator.new('String', ["Overlay", "OverlayIfNextIsEmpty", "AutoFitColumn", "HideText"])
214
+ return false unless text_overflow_mode_validator.valid?(@text_overflow_mode)
178
215
  return true
179
216
  end
180
217
 
218
+ # Custom attribute writer method checking allowed values (enum).
219
+ # @param [Object] text_overflow_mode Object to be assigned
220
+ def text_overflow_mode=(text_overflow_mode)
221
+ validator = EnumAttributeValidator.new('String', ["Overlay", "OverlayIfNextIsEmpty", "AutoFitColumn", "HideText"])
222
+ if text_overflow_mode.to_i == 0
223
+ unless validator.valid?(text_overflow_mode)
224
+ raise ArgumentError, "invalid value for 'text_overflow_mode', must be one of #{validator.allowable_values}."
225
+ end
226
+ @text_overflow_mode = text_overflow_mode
227
+ else
228
+ @text_overflow_mode = validator.allowable_values[text_overflow_mode.to_i]
229
+ end
230
+ end
231
+
181
232
  # Checks equality by comparing each attribute.
182
233
  # @param [Object] Object to be compared
183
234
  def ==(other)
@@ -190,7 +241,8 @@ module GroupDocsViewerCloud
190
241
  render_empty_columns == other.render_empty_columns &&
191
242
  render_hidden_rows == other.render_hidden_rows &&
192
243
  render_hidden_columns == other.render_hidden_columns &&
193
- render_print_area_only == other.render_print_area_only
244
+ render_print_area_only == other.render_print_area_only &&
245
+ text_overflow_mode == other.text_overflow_mode
194
246
  end
195
247
 
196
248
  # @see the `==` method
@@ -202,7 +254,7 @@ module GroupDocsViewerCloud
202
254
  # Calculates hash code according to all attributes.
203
255
  # @return [Fixnum] Hash code
204
256
  def hash
205
- [paginate_sheets, count_rows_per_page, render_grid_lines, render_empty_rows, render_empty_columns, render_hidden_rows, render_hidden_columns, render_print_area_only].hash
257
+ [paginate_sheets, count_rows_per_page, render_grid_lines, render_empty_rows, render_empty_columns, render_hidden_rows, render_hidden_columns, render_print_area_only, text_overflow_mode].hash
206
258
  end
207
259
 
208
260
  # Downcases first letter.
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="storage_exist.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="storage_file.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,274 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="text_element.rb">
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsViewerCloud
31
+ # Text element
32
+ class TextElement
33
+
34
+ # The X coordinate of the highest left point on the page layout where the rectangle that contains element begins.
35
+ attr_accessor :x
36
+
37
+ # The Y coordinate of the highest left point on the page layout where the rectangle that contains element begins.
38
+ attr_accessor :y
39
+
40
+ # The width of the rectangle which contains the element (in pixels).
41
+ attr_accessor :width
42
+
43
+ # The height of the rectangle which contains the element (in pixels).
44
+ attr_accessor :height
45
+
46
+ # The element value
47
+ attr_accessor :value
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'x' => :'X',
53
+ :'y' => :'Y',
54
+ :'width' => :'Width',
55
+ :'height' => :'Height',
56
+ :'value' => :'Value'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'x' => :'Float',
64
+ :'y' => :'Float',
65
+ :'width' => :'Float',
66
+ :'height' => :'Float',
67
+ :'value' => :'String'
68
+ }
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+
79
+ if attributes.key?(:'X')
80
+ self.x = attributes[:'X']
81
+ end
82
+
83
+ if attributes.key?(:'Y')
84
+ self.y = attributes[:'Y']
85
+ end
86
+
87
+ if attributes.key?(:'Width')
88
+ self.width = attributes[:'Width']
89
+ end
90
+
91
+ if attributes.key?(:'Height')
92
+ self.height = attributes[:'Height']
93
+ end
94
+
95
+ if attributes.key?(:'Value')
96
+ self.value = attributes[:'Value']
97
+ end
98
+
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properies with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = []
105
+ if @x.nil?
106
+ invalid_properties.push("invalid value for 'x', x cannot be nil.")
107
+ end
108
+
109
+ if @y.nil?
110
+ invalid_properties.push("invalid value for 'y', y cannot be nil.")
111
+ end
112
+
113
+ if @width.nil?
114
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
115
+ end
116
+
117
+ if @height.nil?
118
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
119
+ end
120
+
121
+ return invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ return false if @x.nil?
128
+ return false if @y.nil?
129
+ return false if @width.nil?
130
+ return false if @height.nil?
131
+ return true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(other)
137
+ return true if self.equal?(other)
138
+ self.class == other.class &&
139
+ x == other.x &&
140
+ y == other.y &&
141
+ width == other.width &&
142
+ height == other.height &&
143
+ value == other.value
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(other)
149
+ self == other
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Fixnum] Hash code
154
+ def hash
155
+ [x, y, width, height, value].hash
156
+ end
157
+
158
+ # Downcases first letter.
159
+ # @return downcased string
160
+ def uncap(str)
161
+ str[0, 1].downcase + str[1..-1]
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.swagger_types.each_pair do |key, type|
170
+ pname = uncap(self.class.attribute_map[key]).intern
171
+ value = attributes[pname]
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the the attribute
174
+ # is documented as an array but the input is not
175
+ if value.is_a?(Array)
176
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !value.nil?
179
+ self.send("#{key}=", _deserialize(type, value))
180
+ end
181
+ # or else data not found in attributes(hash), not an issue as the data can be optional
182
+ end
183
+
184
+ self
185
+ end
186
+
187
+ # Deserializes the data based on type
188
+ # @param string type Data type
189
+ # @param string value Value to be deserialized
190
+ # @return [Object] Deserialized data
191
+ def _deserialize(type, value)
192
+ case type.to_sym
193
+ when :DateTime
194
+ Date.parse value
195
+ when :Date
196
+ Date.parse value
197
+ when :String
198
+ value.to_s
199
+ when :Integer
200
+ value.to_i
201
+ when :Float
202
+ value.to_f
203
+ when :BOOLEAN
204
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
205
+ true
206
+ else
207
+ false
208
+ end
209
+ when :Object
210
+ # generic object (usually a Hash), return directly
211
+ value
212
+ when /\AArray<(?<inner_type>.+)>\z/
213
+ inner_type = Regexp.last_match[:inner_type]
214
+ value.map { |v| _deserialize(inner_type, v) }
215
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
216
+ k_type = Regexp.last_match[:k_type]
217
+ v_type = Regexp.last_match[:v_type]
218
+ {}.tap do |hash|
219
+ value.each do |k, v|
220
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
221
+ end
222
+ end
223
+ else
224
+ # model
225
+ temp_model = GroupDocsViewerCloud.const_get(type).new
226
+ temp_model.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ next if value.nil?
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end