Class: DynamicPDFApi::ExcelInput

Inherits:
ConverterInput show all
Defined in:
lib/ruby_client/ExcelInput.rb

Overview

Represents a Excel input.

Instance Attribute Summary

Attributes inherited from ConverterInput

#_larger, #_smaller, #bottom_margin, #left_margin, #page_height, #page_width, #right_margin, #top_margin

Attributes inherited from Input

#_resources, #_template_id, #_type, #id, #resource_name

Instance Method Summary collapse

Methods inherited from ConverterInput

#page_orientation=, #page_size=

Methods inherited from Input

#get_template, #set_template

Constructor Details

#initialize(resource, size = nil, orientation = nil, margins = nil) ⇒ ExcelInput

Initializes a new instance of the ExcelInput“/> class.

Parameters:

  • name= ("resource")

    The resource of type ExcelResource.

  • name= ("size")

    The page size of the output PDF.

  • name= ("orientation")

    The page orientation of the output PDF.

  • name= ("margins")

    The page margins of the output PDF.



17
18
19
20
21
# File 'lib/ruby_client/ExcelInput.rb', line 17

def initialize(resource, size = nil, orientation = nil, margins = nil)
  super(resource, size, orientation, margins)
  @_type = InputType::EXCEL

end

Instance Method Details

#to_json(_options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ruby_client/ExcelInput.rb', line 23

def to_json(_options = {})
  json_array = {}

  json_array["type"] = "excel"

  json_array["topMargin"] = @top_margin unless @top_margin.nil?

  json_array["leftMargin"] = @left_margin unless @left_margin.nil?

  json_array["bottomMargin"] = @bottom_margin unless @bottom_margin.nil?

  json_array["rightMargin"] = @right_margin unless @right_margin.nil?

  json_array["pageWidth"] = @page_width unless @page_width.nil?

  json_array["pageHeight"] = @page_height unless @page_height.nil?

  json_array["templateId"] = @_template_id unless @_template_id.nil?

  json_array["resourceName"] = @resource_name unless @resource_name.nil?

  json_array["id"] = @id unless @id.nil?

  JSON.pretty_generate(json_array)
end