Class: TXTextControl::ReportingCloud::AppendDocument

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

Overview

Passes data to the ReportingCloud#append_documents method.

Author:

  • Thorsten Kummerow (@thomerow)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, document_divider = :none) ⇒ AppendDocument

Returns a new instance of AppendDocument



25
26
27
28
# File 'lib/txtextcontrol/reportingcloud/append_document.rb', line 25

def initialize(document, document_divider = :none)
  self.document = document
  @document_divider = document_divider
end

Instance Attribute Details

#documentString

The document as a Base64 encoded string.

Returns:

  • (String)

    the current value of document



22
23
24
# File 'lib/txtextcontrol/reportingcloud/append_document.rb', line 22

def document
  @document
end

#document_dividerSymbol

The document divider option. Possible values are :none, :new_paragraph and :new_section.

Returns:

  • (Symbol)

    the current value of document_divider



22
23
24
# File 'lib/txtextcontrol/reportingcloud/append_document.rb', line 22

def document_divider
  @document_divider
end

Instance Method Details

#to_camelized_hashHash

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

Returns:

  • (Hash)

    A hash representing the AppendBody instance.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/txtextcontrol/reportingcloud/append_document.rb', line 44

def to_camelized_hash
  result = {
    "document" => @document,
    "documentDivider" => "None"
  }

  case @document_divider
  when :new_paragraph
    result["documentDivider"] = "NewParagraph"
  when :new_section
    result["documentDivider"] = "NewSection"
  end

  return result
end