Class: TXTextControl::ReportingCloud::MergeSettings

Inherits:
DocumentSettings show all
Defined in:
lib/txtextcontrol/reportingcloud/merge_settings.rb

Overview

Holds the merge settings needed by the merge method.

Author:

  • Thorsten Kummerow (@thomerow)

Instance Attribute Summary collapse

Attributes inherited from DocumentSettings

#author, #creation_date, #creator_application, #document_subject, #document_title, #last_modification_date, #user_password

Instance Method Summary collapse

Constructor Details

#initializeMergeSettings

Returns a new instance of MergeSettings



46
47
48
49
50
51
52
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 46

def initialize
  @remove_empty_fields = true
  @remove_empty_blocks = true
  @remove_empty_images = true
  @remove_trailing_whitespace = true
  @merge_html = false
end

Instance Attribute Details

#merge_htmlBoolean Also known as: merge_html?

Specifies whether field data can contain formatted Html content or not. The default value is false. Html content must be enclosed in an <html /> tag element. Only active in the Merge endpoint.

Returns:

  • (Boolean)

    the current value of merge_html



33
34
35
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 33

def merge_html
  @merge_html
end

#remove_empty_blocksBoolean Also known as: remove_empty_blocks?

Specifies whether the content of empty merge blocks should be removed from the template or not.

Returns:

  • (Boolean)

    the current value of remove_empty_blocks



33
34
35
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 33

def remove_empty_blocks
  @remove_empty_blocks
end

#remove_empty_fieldsBoolean Also known as: remove_empty_fields?

Specifies whether empty fields should be removed from the template or not.

Returns:

  • (Boolean)

    the current value of remove_empty_fields



33
34
35
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 33

def remove_empty_fields
  @remove_empty_fields
end

#remove_empty_imagesBoolean Also known as: remove_empty_images?

Specifies whether images which don't have merge data should be removed from the template or not.

Returns:

  • (Boolean)

    the current value of remove_empty_images



33
34
35
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 33

def remove_empty_images
  @remove_empty_images
end

#remove_trailing_whitespaceBoolean Also known as: remove_trailing_whitespace?

Specifies whether trailing whitespace should be removed before saving a document.

Returns:

  • (Boolean)

    the current value of remove_trailing_whitespace



33
34
35
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 33

def remove_trailing_whitespace
  @remove_trailing_whitespace
end

Instance Method Details

#to_camelized_hashHash

Converts a MergeSettings instance to a hash while converting the attribute names from snake case to camel case.

Returns:

  • (Hash)

    A hash representing the MergeSettings instance.



57
58
59
60
61
62
63
64
65
66
# File 'lib/txtextcontrol/reportingcloud/merge_settings.rb', line 57

def to_camelized_hash
  result = {
    "removeEmptyFields" => @remove_empty_fields,
    "removeEmptyBlocks" => @remove_empty_blocks,
    "removeEmptyImages" => @remove_empty_images,
    "removeTrailingWhitespace" => @remove_trailing_whitespace,
    "mergeHtml" => @merge_html,
  }
  result.merge(super)
end