Class: DynamicPDFApi::DlexInput

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

Overview

Represents a Dlex input.

Instance Attribute Summary collapse

Attributes inherited from Input

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

Instance Method Summary collapse

Methods inherited from Input

#get_template, #set_template

Constructor Details

#initialize(dlex, layout) ⇒ DlexInput

Initializes a new instance of the DlexInput class by posting the DLEX file and the JSON data file from the client to the API to create the PDF report.

Parameters:

  • dlex (String)

    |[DlexResource] The DLEX file path present in the resource manager or the DlexResource file created as per the desired PDF report layout design.

  • layout (String)

    |[LayoutDataResource] The JSON data file path present in the resource manager used to create the PDF report or the LayoutDataResource file used to create the PDF report.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby_client/DlexInput.rb', line 18

def initialize(dlex, layout)
  super()
  @_resources = []
  @_type = InputType::DLEX

  if (dlex.is_a?(String)) == true && layout.is_a?(String)
    # super()
    @resource_name = dlex
    @layout_data_resource_name = layout
  elsif (dlex.is_a?(String)) == true && layout.is_a?(Object)
    @resource_name = dlex
    @layout_data_resource_name = layout.layout_data_resource_name
    @_resources << layout
  elsif (dlex.is_a?(Object)) == true && layout.is_a?(Object)
    @resource_name = dlex.resource_name
    @layout_data_resource_name = layout.layout_data_resource_name
    # dlex.LayoutDataResourceName=@LayoutDataResourceName

    @_resources << layout
    @_resources << dlex
  end
end

Instance Attribute Details

#layout_data_resource_nameObject

Gets or sets the name for layout data resource.



44
45
46
# File 'lib/ruby_client/DlexInput.rb', line 44

def layout_data_resource_name
  @layout_data_resource_name
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ruby_client/DlexInput.rb', line 46

def to_json(_options = {})
  json_array = {}
  json_array['type'] = 'dlex'
  json_array['layoutDataResourceName'] = @layout_data_resource_name

  #---------------------------------------------------
  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