Skip to content

Commit dcf8504

Browse files
SDK regenerated by CI server [ci skip]
1 parent 584bef6 commit dcf8504

File tree

5 files changed

+499
-4
lines changed

5 files changed

+499
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This repository contains Aspose.Words Cloud SDK for Ruby source code. This SDK a
1717

1818
- Removed 'GraphicsQualityOptions' image save option as it no longer supported.
1919
- Added query parameter 'displayIntermediateResults' for batch requests. If 'false', the last response in batch will be returned only. Default is 'true'
20+
- Added 'JsonDataLoadOptions' and 'XmlDataLoadOptions' to 'ReportEngineSettings'
2021

2122

2223
## Enhancements in Version 21.8

lib/aspose_words_cloud.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
require_relative 'aspose_words_cloud/models/hyperlinks_response'
137137
require_relative 'aspose_words_cloud/models/image_save_options_data'
138138
require_relative 'aspose_words_cloud/models/jpeg_save_options_data'
139+
require_relative 'aspose_words_cloud/models/json_data_load_options'
139140
require_relative 'aspose_words_cloud/models/link'
140141
require_relative 'aspose_words_cloud/models/link_element'
141142
require_relative 'aspose_words_cloud/models/list_format'
@@ -274,6 +275,7 @@
274275
require_relative 'aspose_words_cloud/models/xaml_fixed_save_options_data'
275276
require_relative 'aspose_words_cloud/models/xaml_flow_save_options_data'
276277
require_relative 'aspose_words_cloud/models/xml_color'
278+
require_relative 'aspose_words_cloud/models/xml_data_load_options'
277279
require_relative 'aspose_words_cloud/models/xps_save_options_data'
278280

279281
# Model requests
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# ------------------------------------------------------------------------------------
2+
# <copyright company="Aspose" file="json_data_load_options.rb">
3+
# Copyright (c) 2021 Aspose.Words for Cloud
4+
# </copyright>
5+
# <summary>
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
# </summary>
24+
# ------------------------------------------------------------------------------------
25+
26+
require 'date'
27+
28+
module AsposeWordsCloud
29+
30+
# Represents options for parsing JSON data.
31+
class JsonDataLoadOptions
32+
# Gets or sets a value indicating whether a generated data source will always contain
33+
# an object for a JSON root element. If a JSON root element contains a single complex
34+
# property, such an object is not created by default.
35+
attr_accessor :always_generate_root_object
36+
37+
# Gets or sets exact formats for parsing JSON date-time values while loading JSON.
38+
# The default is null.
39+
attr_accessor :exact_date_time_parse_formats
40+
41+
# Gets or sets a mode for parsing JSON simple values (null, boolean, number, integer,
42+
# and string) while loading JSON. Such a mode does not affect parsing of date-time
43+
# values. The default is Aspose.Words.Reporting.JsonSimpleValueParseMode.Loose.
44+
attr_accessor :simple_value_parse_mode
45+
46+
class EnumAttributeValidator
47+
attr_reader :datatype
48+
attr_reader :allowable_values
49+
50+
def initialize(datatype, allowable_values)
51+
@allowable_values = allowable_values.map do |value|
52+
case datatype.to_s
53+
when /Integer/i
54+
value.to_i
55+
when /Float/i
56+
value.to_f
57+
else
58+
value
59+
end
60+
end
61+
end
62+
63+
def valid?(value)
64+
!value || allowable_values.include?(value)
65+
end
66+
end
67+
68+
# Attribute mapping from ruby-style variable name to JSON key.
69+
def self.attribute_map
70+
{
71+
:'always_generate_root_object' => :'AlwaysGenerateRootObject',
72+
:'exact_date_time_parse_formats' => :'ExactDateTimeParseFormats',
73+
:'simple_value_parse_mode' => :'SimpleValueParseMode'
74+
}
75+
end
76+
77+
# Attribute type mapping.
78+
def self.swagger_types
79+
{
80+
:'always_generate_root_object' => :'BOOLEAN',
81+
:'exact_date_time_parse_formats' => :'Array<String>',
82+
:'simple_value_parse_mode' => :'String'
83+
}
84+
end
85+
86+
# Initializes the object
87+
# @param [Hash] attributes Model attributes in the form of hash
88+
def initialize(attributes = {})
89+
return unless attributes.is_a?(Hash)
90+
91+
# convert string to symbol for hash key
92+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
93+
94+
if attributes.key?(:'AlwaysGenerateRootObject')
95+
self.always_generate_root_object = attributes[:'AlwaysGenerateRootObject']
96+
end
97+
98+
if attributes.key?(:'ExactDateTimeParseFormats')
99+
if (value = attributes[:'ExactDateTimeParseFormats']).is_a?(Array)
100+
self.exact_date_time_parse_formats = value
101+
end
102+
end
103+
104+
if attributes.key?(:'SimpleValueParseMode')
105+
self.simple_value_parse_mode = attributes[:'SimpleValueParseMode']
106+
end
107+
end
108+
109+
# Show invalid properties with the reasons. Usually used together with valid?
110+
# @return Array for valid properies with the reasons
111+
def list_invalid_properties
112+
invalid_properties = []
113+
return invalid_properties
114+
end
115+
116+
# Check to see if the all the properties in the model are valid
117+
# @return true if the model is valid
118+
def valid?
119+
simple_value_parse_mode_validator = EnumAttributeValidator.new('String', ["Loose", "Strict"])
120+
return false unless simple_value_parse_mode_validator.valid?(@simple_value_parse_mode)
121+
122+
return true
123+
end
124+
125+
# Custom attribute writer method checking allowed values (enum).
126+
# @param [Object] simple_value_parse_mode Object to be assigned
127+
def simple_value_parse_mode=(simple_value_parse_mode)
128+
validator = EnumAttributeValidator.new('String', ["Loose", "Strict"])
129+
if simple_value_parse_mode.to_i == 0
130+
unless validator.valid?(simple_value_parse_mode)
131+
raise ArgumentError, "invalid value for 'simple_value_parse_mode', must be one of #{validator.allowable_values}."
132+
end
133+
@simple_value_parse_mode = simple_value_parse_mode
134+
else
135+
@simple_value_parse_mode = validator.allowable_values[simple_value_parse_mode.to_i]
136+
end
137+
end
138+
139+
140+
# Checks equality by comparing each attribute.
141+
# @param [Object] Object to be compared
142+
def ==(other)
143+
return true if self.equal?(other)
144+
self.class == other.class &&
145+
always_generate_root_object == other.always_generate_root_object &&
146+
exact_date_time_parse_formats == other.exact_date_time_parse_formats &&
147+
simple_value_parse_mode == other.simple_value_parse_mode
148+
end
149+
150+
# @see the `==` method
151+
# @param [Object] Object to be compared
152+
def eql?(other)
153+
self == other
154+
end
155+
156+
# Calculates hash code according to all attributes.
157+
# @return [Fixnum] Hash code
158+
def hash
159+
[always_generate_root_object, exact_date_time_parse_formats, simple_value_parse_mode].hash
160+
end
161+
162+
# Builds the object from hash
163+
# @param [Hash] attributes Model attributes in the form of hash
164+
# @return [Object] Returns the model itself
165+
def build_from_hash(attributes)
166+
return nil unless attributes.is_a?(Hash)
167+
self.class.swagger_types.each_pair do |key, type|
168+
if type =~ /\AArray<(.*)>/i
169+
# check to ensure the input is an array given that the the attribute
170+
# is documented as an array but the input is not
171+
if attributes[self.class.attribute_map[key]].is_a?(Array)
172+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
173+
end
174+
elsif !attributes[self.class.attribute_map[key]].nil?
175+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176+
end
177+
# or else data not found in attributes(hash), not an issue as the data can be optional
178+
end
179+
180+
self
181+
end
182+
183+
# Deserializes the data based on type
184+
# @param string type Data type
185+
# @param string value Value to be deserialized
186+
# @return [Object] Deserialized data
187+
def _deserialize(type, value)
188+
case type.to_sym
189+
when :DateTime
190+
Time.at(/\d/.match(value)[0].to_f).to_datetime
191+
when :Date
192+
Time.at(/\d/.match(value)[0].to_f).to_date
193+
when :String
194+
value.to_s
195+
when :Integer
196+
value.to_i
197+
when :Float
198+
value.to_f
199+
when :BOOLEAN
200+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201+
true
202+
else
203+
false
204+
end
205+
when :Object
206+
# generic object (usually a Hash), return directly
207+
value
208+
when /\AArray<(?<inner_type>.+)>\z/
209+
inner_type = Regexp.last_match[:inner_type]
210+
value.map { |v| _deserialize(inner_type, v) }
211+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212+
k_type = Regexp.last_match[:k_type]
213+
v_type = Regexp.last_match[:v_type]
214+
{}.tap do |hash|
215+
value.each do |k, v|
216+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217+
end
218+
end
219+
else
220+
# model
221+
temp_model = AsposeWordsCloud.const_get(type).new
222+
temp_model.build_from_hash(value)
223+
end
224+
end
225+
226+
# Returns the string representation of the object
227+
# @return [String] String presentation of the object
228+
def to_s
229+
to_hash.to_s
230+
end
231+
232+
# to_body is an alias to to_hash (backward compatibility)
233+
# @return [Hash] Returns the object in the form of hash
234+
def to_body
235+
to_hash
236+
end
237+
238+
# Returns the object in the form of hash
239+
# @return [Hash] Returns the object in the form of hash
240+
def to_hash
241+
hash = {}
242+
self.class.attribute_map.each_pair do |attr, param|
243+
value = self.send(attr)
244+
next if value.nil?
245+
hash[param] = _to_hash(value)
246+
end
247+
hash
248+
end
249+
250+
# Outputs non-array value in the form of hash
251+
# For object, use to_hash. Otherwise, just return the value
252+
# @param [Object] value Any valid value
253+
# @return [Hash] Returns the value in the form of hash
254+
def _to_hash(value)
255+
if value.is_a?(Array)
256+
value.compact.map { |v| _to_hash(v) }
257+
elsif value.is_a?(Hash)
258+
{}.tap do |hash|
259+
value.each { |k, v| hash[k] = _to_hash(v) }
260+
end
261+
elsif value.respond_to? :to_hash
262+
value.to_hash
263+
else
264+
value
265+
end
266+
end
267+
268+
end
269+
end

lib/aspose_words_cloud/models/report_engine_settings.rb

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,15 @@ class ReportEngineSettings
3838
# Gets or sets type of datasource.
3939
attr_accessor :data_source_type
4040

41+
# Gets or sets the options for parsing JSON data.
42+
attr_accessor :json_data_load_options
43+
4144
# Gets or sets type of options to build report.
4245
attr_accessor :report_build_options
4346

47+
# Gets or sets the options for parsing XML data.
48+
attr_accessor :xml_data_load_options
49+
4450
class EnumAttributeValidator
4551
attr_reader :datatype
4652
attr_reader :allowable_values
@@ -69,7 +75,9 @@ def self.attribute_map
6975
:'csv_data_load_options' => :'CsvDataLoadOptions',
7076
:'data_source_name' => :'DataSourceName',
7177
:'data_source_type' => :'DataSourceType',
72-
:'report_build_options' => :'ReportBuildOptions'
78+
:'json_data_load_options' => :'JsonDataLoadOptions',
79+
:'report_build_options' => :'ReportBuildOptions',
80+
:'xml_data_load_options' => :'XmlDataLoadOptions'
7381
}
7482
end
7583

@@ -79,7 +87,9 @@ def self.swagger_types
7987
:'csv_data_load_options' => :'CsvDataLoadOptions',
8088
:'data_source_name' => :'String',
8189
:'data_source_type' => :'String',
82-
:'report_build_options' => :'Array<String>'
90+
:'json_data_load_options' => :'JsonDataLoadOptions',
91+
:'report_build_options' => :'Array<String>',
92+
:'xml_data_load_options' => :'XmlDataLoadOptions'
8393
}
8494
end
8595

@@ -103,11 +113,19 @@ def initialize(attributes = {})
103113
self.data_source_type = attributes[:'DataSourceType']
104114
end
105115

116+
if attributes.key?(:'JsonDataLoadOptions')
117+
self.json_data_load_options = attributes[:'JsonDataLoadOptions']
118+
end
119+
106120
if attributes.key?(:'ReportBuildOptions')
107121
if (value = attributes[:'ReportBuildOptions']).is_a?(Array)
108122
self.report_build_options = value
109123
end
110124
end
125+
126+
if attributes.key?(:'XmlDataLoadOptions')
127+
self.xml_data_load_options = attributes[:'XmlDataLoadOptions']
128+
end
111129
end
112130

113131
# Show invalid properties with the reasons. Usually used together with valid?
@@ -149,7 +167,9 @@ def ==(other)
149167
csv_data_load_options == other.csv_data_load_options &&
150168
data_source_name == other.data_source_name &&
151169
data_source_type == other.data_source_type &&
152-
report_build_options == other.report_build_options
170+
json_data_load_options == other.json_data_load_options &&
171+
report_build_options == other.report_build_options &&
172+
xml_data_load_options == other.xml_data_load_options
153173
end
154174

155175
# @see the `==` method
@@ -161,7 +181,7 @@ def eql?(other)
161181
# Calculates hash code according to all attributes.
162182
# @return [Fixnum] Hash code
163183
def hash
164-
[csv_data_load_options, data_source_name, data_source_type, report_build_options].hash
184+
[csv_data_load_options, data_source_name, data_source_type, json_data_load_options, report_build_options, xml_data_load_options].hash
165185
end
166186

167187
# Builds the object from hash

0 commit comments

Comments
 (0)