Class: TXTextControl::ReportingCloud::MergeBody

Inherits:
Object
  • Object
show all
Defined in:
lib/txtextcontrol/reportingcloud/merge_body.rb

Overview

Passes data to the ReportingCloud#merge_document method.

Author:

  • Thorsten Kummerow (@thomerow)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(merge_data, merge_settings = nil, template = nil) ⇒ MergeBody

The constructor.

Parameters:

  • merge_data (Array<Hash>)

    The merge data. Must be an array of hashes.

  • template (String) (defaults to: nil)

    Base64 encoded template document. Supported formats are RTF, DOC, DOCX and TX.

  • merge_settings (MergeSettings) (defaults to: nil)

    Merge settings to specify merge properties and document properties such as title and author.



38
39
40
41
42
# File 'lib/txtextcontrol/reportingcloud/merge_body.rb', line 38

def initialize(merge_data, merge_settings = nil, template = nil)
  self.merge_data = merge_data
  @template = template
  @merge_settings = merge_settings
end

Instance Attribute Details

#merge_dataArray<Hash>

The merge data. Must be an array of hashes.

Returns:

  • (Array<Hash>)

    the current value of merge_data



27
28
29
# File 'lib/txtextcontrol/reportingcloud/merge_body.rb', line 27

def merge_data
  @merge_data
end

#merge_settingsMergeSettings

Merge settings to specify merge properties and document properties such as title and author.

Returns:



27
28
29
# File 'lib/txtextcontrol/reportingcloud/merge_body.rb', line 27

def merge_settings
  @merge_settings
end

#templateString

Base64 encoded template document. Supported formats are RTF, DOC, DOCX and TX.

Returns:

  • (String)

    the current value of template



27
28
29
# File 'lib/txtextcontrol/reportingcloud/merge_body.rb', line 27

def template
  @template
end

Instance Method Details

#to_camelized_hashHash

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

Returns:

  • (Hash)

    A hash representing the MergeBody instance.



58
59
60
61
62
63
64
# File 'lib/txtextcontrol/reportingcloud/merge_body.rb', line 58

def to_camelized_hash
  return {
    "mergeData" => @merge_data,
    "template" => @template,
    "mergeSettings" => @merge_settings.nil? ? nil : @merge_settings.to_camelized_hash
  }
end