Class: AsposeWordsCloud::FieldOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_words_cloud/models/field_options.rb

Overview

DTO for field options.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FieldOptions

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/aspose_words_cloud/models/field_options.rb', line 135

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'BuiltInTemplatesPaths')
    if (value = attributes[:'BuiltInTemplatesPaths']).is_a?(Array)
      self.built_in_templates_paths = value
    end
  end

  if attributes.key?(:'CurrentUser')
    self.current_user = attributes[:'CurrentUser']
  end

  if attributes.key?(:'CustomTocStyleSeparator')
    self.custom_toc_style_separator = attributes[:'CustomTocStyleSeparator']
  end

  if attributes.key?(:'DefaultDocumentAuthor')
    self.default_document_author = attributes[:'DefaultDocumentAuthor']
  end

  if attributes.key?(:'FieldIndexFormat')
    self.field_index_format = attributes[:'FieldIndexFormat']
  end

  if attributes.key?(:'FieldUpdateCultureName')
    self.field_update_culture_name = attributes[:'FieldUpdateCultureName']
  end

  if attributes.key?(:'FieldUpdateCultureSource')
    self.field_update_culture_source = attributes[:'FieldUpdateCultureSource']
  end

  if attributes.key?(:'FileName')
    self.file_name = attributes[:'FileName']
  end

  if attributes.key?(:'IsBidiTextSupportedOnUpdate')
    self.is_bidi_text_supported_on_update = attributes[:'IsBidiTextSupportedOnUpdate']
  end

  if attributes.key?(:'LegacyNumberFormat')
    self.legacy_number_format = attributes[:'LegacyNumberFormat']
  end

  if attributes.key?(:'PreProcessCultureName')
    self.pre_process_culture_name = attributes[:'PreProcessCultureName']
  end

  if attributes.key?(:'TemplateName')
    self.template_name = attributes[:'TemplateName']
  end

  if attributes.key?(:'UseInvariantCultureNumberFormat')
    self.use_invariant_culture_number_format = attributes[:'UseInvariantCultureNumberFormat']
  end
end

Instance Attribute Details

#built_in_templates_pathsObject

Gets or sets BuiltIn Templates Paths.



33
34
35
# File 'lib/aspose_words_cloud/models/field_options.rb', line 33

def built_in_templates_paths
  @built_in_templates_paths
end

#current_userObject

Gets or sets Curren tUser.



36
37
38
# File 'lib/aspose_words_cloud/models/field_options.rb', line 36

def current_user
  @current_user
end

#custom_toc_style_separatorObject

Gets or sets Custom Toc Style Separator.



39
40
41
# File 'lib/aspose_words_cloud/models/field_options.rb', line 39

def custom_toc_style_separator
  @custom_toc_style_separator
end

#default_document_authorObject

Gets or sets Default Document Author.



42
43
44
# File 'lib/aspose_words_cloud/models/field_options.rb', line 42

def default_document_author
  @default_document_author
end

#field_index_formatObject

Gets or sets Field Index Format.



45
46
47
# File 'lib/aspose_words_cloud/models/field_options.rb', line 45

def field_index_format
  @field_index_format
end

#field_update_culture_nameObject

Gets or sets Field Update Culture Name. It is used for all fields if FieldUpdateCultureSource is FieldCode.



49
50
51
# File 'lib/aspose_words_cloud/models/field_options.rb', line 49

def field_update_culture_name
  @field_update_culture_name
end

#field_update_culture_sourceObject

Gets or sets Field Update Culture Source.



52
53
54
# File 'lib/aspose_words_cloud/models/field_options.rb', line 52

def field_update_culture_source
  @field_update_culture_source
end

#file_nameObject

Gets or sets File Name.



55
56
57
# File 'lib/aspose_words_cloud/models/field_options.rb', line 55

def file_name
  @file_name
end

#is_bidi_text_supported_on_updateObject

Gets or sets if Bidi Text Supported OnUpdate.



58
59
60
# File 'lib/aspose_words_cloud/models/field_options.rb', line 58

def is_bidi_text_supported_on_update
  @is_bidi_text_supported_on_update
end

#legacy_number_formatObject

Gets or sets if Legacy Number Format.



61
62
63
# File 'lib/aspose_words_cloud/models/field_options.rb', line 61

def legacy_number_format
  @legacy_number_format
end

#pre_process_culture_nameObject

Gets or sets PreProcess Culture Name. It is a culture code for DOC fields.



65
66
67
# File 'lib/aspose_words_cloud/models/field_options.rb', line 65

def pre_process_culture_name
  @pre_process_culture_name
end

#template_nameObject

Gets or sets Template Name.



68
69
70
# File 'lib/aspose_words_cloud/models/field_options.rb', line 68

def template_name
  @template_name
end

#use_invariant_culture_number_formatObject

Gets or sets if Use Invariant Culture Number Format.



71
72
73
# File 'lib/aspose_words_cloud/models/field_options.rb', line 71

def use_invariant_culture_number_format
  @use_invariant_culture_number_format
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/aspose_words_cloud/models/field_options.rb', line 96

def self.attribute_map
  {
    :'built_in_templates_paths' => :'BuiltInTemplatesPaths',
    :'current_user' => :'CurrentUser',
    :'custom_toc_style_separator' => :'CustomTocStyleSeparator',
    :'default_document_author' => :'DefaultDocumentAuthor',
    :'field_index_format' => :'FieldIndexFormat',
    :'field_update_culture_name' => :'FieldUpdateCultureName',
    :'field_update_culture_source' => :'FieldUpdateCultureSource',
    :'file_name' => :'FileName',
    :'is_bidi_text_supported_on_update' => :'IsBidiTextSupportedOnUpdate',
    :'legacy_number_format' => :'LegacyNumberFormat',
    :'pre_process_culture_name' => :'PreProcessCultureName',
    :'template_name' => :'TemplateName',
    :'use_invariant_culture_number_format' => :'UseInvariantCultureNumberFormat'
  }
end

.swagger_typesObject

Attribute type mapping.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/aspose_words_cloud/models/field_options.rb', line 115

def self.swagger_types
  {
    :'built_in_templates_paths' => :'Array<String>',
    :'current_user' => :'UserInformation',
    :'custom_toc_style_separator' => :'String',
    :'default_document_author' => :'String',
    :'field_index_format' => :'String',
    :'field_update_culture_name' => :'String',
    :'field_update_culture_source' => :'String',
    :'file_name' => :'String',
    :'is_bidi_text_supported_on_update' => :'BOOLEAN',
    :'legacy_number_format' => :'BOOLEAN',
    :'pre_process_culture_name' => :'String',
    :'template_name' => :'String',
    :'use_invariant_culture_number_format' => :'BOOLEAN'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/aspose_words_cloud/models/field_options.rb', line 245

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      built_in_templates_paths == other.built_in_templates_paths &&
      current_user == other.current_user &&
      custom_toc_style_separator == other.custom_toc_style_separator &&
      default_document_author == other.default_document_author &&
      field_index_format == other.field_index_format &&
      field_update_culture_name == other.field_update_culture_name &&
      field_update_culture_source == other.field_update_culture_source &&
      file_name == other.file_name &&
      is_bidi_text_supported_on_update == other.is_bidi_text_supported_on_update &&
      legacy_number_format == other.legacy_number_format &&
      pre_process_culture_name == other.pre_process_culture_name &&
      template_name == other.template_name &&
      use_invariant_culture_number_format == other.use_invariant_culture_number_format
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/aspose_words_cloud/models/field_options.rb', line 300

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Time.at(/\d/.match(value)[0].to_f).to_datetime
  when :Date
    Time.at(/\d/.match(value)[0].to_f).to_date
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else
  # model
    temp_model = AsposeWordsCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/aspose_words_cloud/models/field_options.rb', line 367

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/aspose_words_cloud/models/field_options.rb', line 278

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#collectFilesContent(resultFilesContent) ⇒ Object



381
382
# File 'lib/aspose_words_cloud/models/field_options.rb', line 381

def collectFilesContent(resultFilesContent)
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


265
266
267
# File 'lib/aspose_words_cloud/models/field_options.rb', line 265

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



271
272
273
# File 'lib/aspose_words_cloud/models/field_options.rb', line 271

def hash
  [built_in_templates_paths, current_user, custom_toc_style_separator, default_document_author, field_index_format, field_update_culture_name, field_update_culture_source, file_name, is_bidi_text_supported_on_update, legacy_number_format, pre_process_culture_name, template_name, use_invariant_culture_number_format].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



198
199
200
201
# File 'lib/aspose_words_cloud/models/field_options.rb', line 198

def list_invalid_properties
  invalid_properties = []
  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



347
348
349
# File 'lib/aspose_words_cloud/models/field_options.rb', line 347

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



353
354
355
356
357
358
359
360
361
# File 'lib/aspose_words_cloud/models/field_options.rb', line 353

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



341
342
343
# File 'lib/aspose_words_cloud/models/field_options.rb', line 341

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



205
206
207
208
209
210
211
212
# File 'lib/aspose_words_cloud/models/field_options.rb', line 205

def valid?
  field_index_format_validator = EnumAttributeValidator.new('String', ["Template", "Classic", "Fancy", "Modern", "Bulleted", "Formal", "Simple"])
  return false unless field_index_format_validator.valid?(@field_index_format)
  field_update_culture_source_validator = EnumAttributeValidator.new('String', ["CurrentThread", "FieldCode"])
  return false unless field_update_culture_source_validator.valid?(@field_update_culture_source)

  return true
end