aspose_words_cloud 20.4.0 → 20.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose_words_cloud.rb +30 -0
  3. data/lib/aspose_words_cloud/api/words_api.rb +4292 -2201
  4. data/lib/aspose_words_cloud/api_client.rb +1 -0
  5. data/lib/aspose_words_cloud/models/bmp_save_options_data.rb +61 -4
  6. data/lib/aspose_words_cloud/models/csv_data_load_options.rb +237 -0
  7. data/lib/aspose_words_cloud/models/doc_save_options_data.rb +58 -1
  8. data/lib/aspose_words_cloud/models/emf_save_options_data.rb +61 -4
  9. data/lib/aspose_words_cloud/models/epub_save_options_data.rb +37 -1
  10. data/lib/aspose_words_cloud/models/fixed_page_save_options_data.rb +58 -1
  11. data/lib/aspose_words_cloud/models/gif_save_options_data.rb +61 -4
  12. data/lib/aspose_words_cloud/models/html_fixed_save_options_data.rb +71 -4
  13. data/lib/aspose_words_cloud/models/html_save_options_data.rb +37 -1
  14. data/lib/aspose_words_cloud/models/image_save_options_data.rb +58 -1
  15. data/lib/aspose_words_cloud/models/jpeg_save_options_data.rb +61 -4
  16. data/lib/aspose_words_cloud/models/list_format.rb +236 -0
  17. data/lib/aspose_words_cloud/models/list_format_update.rb +217 -0
  18. data/lib/aspose_words_cloud/models/list_info.rb +274 -0
  19. data/lib/aspose_words_cloud/models/list_insert.rb +244 -0
  20. data/lib/aspose_words_cloud/models/list_level.rb +393 -0
  21. data/lib/aspose_words_cloud/models/list_level_update.rb +366 -0
  22. data/lib/aspose_words_cloud/models/list_levels.rb +218 -0
  23. data/lib/aspose_words_cloud/models/list_response.rb +216 -0
  24. data/lib/aspose_words_cloud/models/list_update.rb +207 -0
  25. data/lib/aspose_words_cloud/models/lists.rb +218 -0
  26. data/lib/aspose_words_cloud/models/lists_response.rb +216 -0
  27. data/lib/aspose_words_cloud/models/mhtml_save_options_data.rb +37 -1
  28. data/lib/aspose_words_cloud/models/odt_save_options_data.rb +47 -1
  29. data/lib/aspose_words_cloud/models/ooxml_save_options_data.rb +58 -1
  30. data/lib/aspose_words_cloud/models/paragraph_format.rb +10 -1
  31. data/lib/aspose_words_cloud/models/paragraph_list_format_response.rb +216 -0
  32. data/lib/aspose_words_cloud/models/pcl_save_options_data.rb +58 -1
  33. data/lib/aspose_words_cloud/models/pdf_save_options_data.rb +47 -1
  34. data/lib/aspose_words_cloud/models/png_save_options_data.rb +61 -4
  35. data/lib/aspose_words_cloud/models/ps_save_options_data.rb +58 -1
  36. data/lib/aspose_words_cloud/models/report_build_options.rb +26 -0
  37. data/lib/aspose_words_cloud/models/report_engine_settings.rb +275 -0
  38. data/lib/aspose_words_cloud/models/requests/ApplyStyleToDocumentElementRequest.rb +81 -0
  39. data/lib/aspose_words_cloud/models/requests/BuildReportOnlineRequest.rb +57 -0
  40. data/lib/aspose_words_cloud/models/requests/BuildReportRequest.rb +73 -0
  41. data/lib/aspose_words_cloud/models/requests/CopyStyleRequest.rb +77 -0
  42. data/lib/aspose_words_cloud/models/requests/DeleteAllParagraphTabStopsRequest.rb +73 -0
  43. data/lib/aspose_words_cloud/models/requests/DeleteParagraphListFormatRequest.rb +81 -0
  44. data/lib/aspose_words_cloud/models/requests/DeleteParagraphTabStopRequest.rb +77 -0
  45. data/lib/aspose_words_cloud/models/requests/ExecuteMailMergeOnlineRequest.rb +2 -2
  46. data/lib/aspose_words_cloud/models/requests/ExecuteMailMergeRequest.rb +2 -2
  47. data/lib/aspose_words_cloud/models/requests/GetDocumentFieldNamesRequest.rb +2 -2
  48. data/lib/aspose_words_cloud/models/requests/GetListRequest.rb +65 -0
  49. data/lib/aspose_words_cloud/models/requests/GetListsRequest.rb +61 -0
  50. data/lib/aspose_words_cloud/models/requests/GetParagraphListFormatRequest.rb +69 -0
  51. data/lib/aspose_words_cloud/models/requests/GetParagraphListFormatWithoutNodePathRequest.rb +65 -0
  52. data/lib/aspose_words_cloud/models/requests/GetParagraphTabStopsRequest.rb +69 -0
  53. data/lib/aspose_words_cloud/models/requests/GetStyleFromDocumentElementRequest.rb +65 -0
  54. data/lib/aspose_words_cloud/models/requests/GetStyleRequest.rb +65 -0
  55. data/lib/aspose_words_cloud/models/requests/GetStylesRequest.rb +61 -0
  56. data/lib/aspose_words_cloud/models/requests/InsertListRequest.rb +77 -0
  57. data/lib/aspose_words_cloud/models/requests/InsertOrUpdateParagraphTabStopRequest.rb +77 -0
  58. data/lib/aspose_words_cloud/models/requests/InsertStyleRequest.rb +77 -0
  59. data/lib/aspose_words_cloud/models/requests/UpdateListLevelRequest.rb +85 -0
  60. data/lib/aspose_words_cloud/models/requests/UpdateListRequest.rb +81 -0
  61. data/lib/aspose_words_cloud/models/requests/UpdateParagraphListFormatRequest.rb +85 -0
  62. data/lib/aspose_words_cloud/models/requests/UpdateStyleRequest.rb +81 -0
  63. data/lib/aspose_words_cloud/models/rtf_save_options_data.rb +58 -1
  64. data/lib/aspose_words_cloud/models/save_options_data.rb +61 -4
  65. data/lib/aspose_words_cloud/models/shading.rb +262 -0
  66. data/lib/aspose_words_cloud/models/style.rb +370 -0
  67. data/lib/aspose_words_cloud/models/style_apply.rb +207 -0
  68. data/lib/aspose_words_cloud/models/style_copy.rb +207 -0
  69. data/lib/aspose_words_cloud/models/style_insert.rb +254 -0
  70. data/lib/aspose_words_cloud/models/style_response.rb +216 -0
  71. data/lib/aspose_words_cloud/models/style_update.rb +237 -0
  72. data/lib/aspose_words_cloud/models/styles.rb +218 -0
  73. data/lib/aspose_words_cloud/models/styles_response.rb +216 -0
  74. data/lib/aspose_words_cloud/models/svg_save_options_data.rb +58 -1
  75. data/lib/aspose_words_cloud/models/tab_stop.rb +290 -0
  76. data/lib/aspose_words_cloud/models/tab_stop_base.rb +280 -0
  77. data/lib/aspose_words_cloud/models/tab_stop_insert.rb +280 -0
  78. data/lib/aspose_words_cloud/models/tab_stops_response.rb +219 -0
  79. data/lib/aspose_words_cloud/models/text_save_options_data.rb +37 -1
  80. data/lib/aspose_words_cloud/models/tiff_save_options_data.rb +58 -1
  81. data/lib/aspose_words_cloud/models/word_ml_save_options_data.rb +58 -1
  82. data/lib/aspose_words_cloud/models/xaml_fixed_save_options_data.rb +58 -1
  83. data/lib/aspose_words_cloud/models/xaml_flow_save_options_data.rb +58 -1
  84. data/lib/aspose_words_cloud/models/xps_save_options_data.rb +58 -1
  85. data/lib/aspose_words_cloud/version.rb +1 -1
  86. metadata +52 -2
@@ -0,0 +1,207 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeWordsCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="StyleApply.rb">
8
+ # Copyright (c) 2019 Aspose.Words for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Represents a single document style to insert.
33
+ class StyleApply
34
+ # Gets or sets the case sensitive name of the style to apply.
35
+ attr_accessor :style_name
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'style_name' => :'StyleName'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'style_name' => :'String'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ if attributes.key?(:'StyleName')
61
+ self.style_name = attributes[:'StyleName']
62
+ end
63
+
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properies with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = []
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(other)
82
+ return true if self.equal?(other)
83
+ self.class == other.class &&
84
+ style_name == other.style_name
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(other)
90
+ self == other
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Fixnum] Hash code
95
+ def hash
96
+ [style_name].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.swagger_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end
114
+ # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
128
+ when :Date
129
+ Time.at(/\d/.match(value)[0].to_f).to_date
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else
157
+ # model
158
+ temp_model = AsposeWordsCloud.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,207 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeWordsCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="StyleCopy.rb">
8
+ # Copyright (c) 2019 Aspose.Words for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Represents a single document style to insert.
33
+ class StyleCopy
34
+ # Gets or sets the case sensitive name of the style to copy from it.
35
+ attr_accessor :style_name
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'style_name' => :'StyleName'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'style_name' => :'String'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ if attributes.key?(:'StyleName')
61
+ self.style_name = attributes[:'StyleName']
62
+ end
63
+
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properies with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = []
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(other)
82
+ return true if self.equal?(other)
83
+ self.class == other.class &&
84
+ style_name == other.style_name
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(other)
90
+ self == other
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Fixnum] Hash code
95
+ def hash
96
+ [style_name].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.swagger_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end
114
+ # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
128
+ when :Date
129
+ Time.at(/\d/.match(value)[0].to_f).to_date
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else
157
+ # model
158
+ temp_model = AsposeWordsCloud.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,254 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeWordsCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="StyleInsert.rb">
8
+ # Copyright (c) 2019 Aspose.Words for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Represents a single document style to insert.
33
+ class StyleInsert
34
+ # Gets or sets the case sensitive name of the style to create.
35
+ attr_accessor :style_name
36
+
37
+ # Gets or sets the StyleType value that specifies the type of the style to create.
38
+ attr_accessor :style_type
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'style_name' => :'StyleName',
66
+ :'style_type' => :'StyleType'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ :'style_name' => :'String',
74
+ :'style_type' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
85
+
86
+ if attributes.key?(:'StyleName')
87
+ self.style_name = attributes[:'StyleName']
88
+ end
89
+
90
+ if attributes.key?(:'StyleType')
91
+ self.style_type = attributes[:'StyleType']
92
+ end
93
+
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properies with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = []
100
+ return invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ style_type_validator = EnumAttributeValidator.new('String', ["Paragraph", "Character", "Table", "List"])
107
+ return false unless style_type_validator.valid?(@style_type)
108
+ return true
109
+ end
110
+
111
+ # Custom attribute writer method checking allowed values (enum).
112
+ # @param [Object] style_type Object to be assigned
113
+ def style_type=(style_type)
114
+ validator = EnumAttributeValidator.new('String', ["Paragraph", "Character", "Table", "List"])
115
+ if style_type.to_i == 0
116
+ unless validator.valid?(style_type)
117
+ raise ArgumentError, "invalid value for 'style_type', must be one of #{validator.allowable_values}."
118
+ end
119
+ @style_type = style_type
120
+ else
121
+ @style_type = validator.allowable_values[style_type.to_i]
122
+ end
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(other)
128
+ return true if self.equal?(other)
129
+ self.class == other.class &&
130
+ style_name == other.style_name &&
131
+ style_type == other.style_type
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(other)
137
+ self == other
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Fixnum] Hash code
142
+ def hash
143
+ [style_name, style_type].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.swagger_types.each_pair do |key, type|
152
+ if type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end
161
+ # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
175
+ when :Date
176
+ Time.at(/\d/.match(value)[0].to_f).to_date
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :BOOLEAN
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else
204
+ # model
205
+ temp_model = AsposeWordsCloud.const_get(type).new
206
+ temp_model.build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = self.send(attr)
228
+ next if value.nil?
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end