Class: DynamicPDFApi::PdfInput

Inherits:
Input
  • Object
show all
Defined in:
lib/ruby_client/PdfInput.rb

Overview

Represents a pdf input.

Instance Attribute Summary collapse

Attributes inherited from Input

#_resources, #_template_id, #id, #resource_name

Instance Method Summary collapse

Methods inherited from Input

#get_template, #set_template

Constructor Details

#initialize(resource, options = nil) ⇒ PdfInput

Initializes a new instance of the PdfInput class.

Parameters:

  • resource (String)

    |[PdfResource] The resource path in cloud resource manager or the resource of type PdfResource.

  • options (MergeOptions) (defaults to: nil)

    The merge options for the pdf.



17
18
19
20
21
22
23
24
# File 'lib/ruby_client/PdfInput.rb', line 17

def initialize(resource, options = nil)
  @id = nil
  @_type = InputType::PDF
  @start_page = nil
  @page_count = nil
  @merge_options = options
  super(resource)
end

Instance Attribute Details

#_typeObject

Returns the value of attribute _type.



26
27
28
# File 'lib/ruby_client/PdfInput.rb', line 26

def _type
  @_type
end

#merge_optionsObject

Gets or sets the merge options MergeOptions.



31
32
33
# File 'lib/ruby_client/PdfInput.rb', line 31

def merge_options
  @merge_options
end

#page_countObject

Gets or sets the page count.



41
42
43
# File 'lib/ruby_client/PdfInput.rb', line 41

def page_count
  @page_count
end

#start_pageObject

Gets or sets the start page.



36
37
38
# File 'lib/ruby_client/PdfInput.rb', line 36

def start_page
  @start_page
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ruby_client/PdfInput.rb', line 43

def to_json(_options = {})
  @template = get_template
  json_array = {}

  json_array['type'] = 'pdf'

  json_array['mergeOptions'] = @merge_options unless @merge_options.nil?

  json_array['startPage'] = @start_page unless @start_page.nil?

  json_array['pageCount'] = @page_count unless @page_count.nil?

  #---------------------------------------------------

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

  json_array['resourceName'] = @resource_name

  json_array['id'] = @id

  JSON.pretty_generate(json_array)
end