Class: DynamicPDFApi::Input

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

Overview

Represents the base class for inputs.

Direct Known Subclasses

ConverterInput, DlexInput, ImageInput, PageInput, PdfInput

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource = nil) ⇒ Input

Returns a new instance of Input.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ruby_client/Input.rb', line 9

def initialize(resource = nil)
  @_resources = []
  @template = nil
  @_type = nil
  @_template_id = nil

  if resource.is_a?(String)
    @resource_name = resource
  elsif !resource.nil?
    @_resources << resource
    @resource_name = resource.resource_name
  end

  @id = SecureRandom.uuid
end

Instance Attribute Details

#_resourcesObject

Returns the value of attribute _resources.



25
26
27
# File 'lib/ruby_client/Input.rb', line 25

def _resources
  @_resources
end

#_template_idObject

Returns the value of attribute _template_id.



25
26
27
# File 'lib/ruby_client/Input.rb', line 25

def _template_id
  @_template_id
end

#_typeObject

Returns the value of attribute _type.



25
26
27
# File 'lib/ruby_client/Input.rb', line 25

def _type
  @_type
end

#idObject

Gets or sets the id.



35
36
37
# File 'lib/ruby_client/Input.rb', line 35

def id
  @id
end

#resource_nameObject

Gets or sets the resource name.



30
31
32
# File 'lib/ruby_client/Input.rb', line 30

def resource_name
  @resource_name
end

Instance Method Details

#get_templateObject



45
46
47
# File 'lib/ruby_client/Input.rb', line 45

def get_template
  @template
end

#set_template(template) ⇒ Object

Gets or sets the template.



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

def set_template(template)
  @template = template
  @_template_id = template.id
end

#to_json(_options = {}) ⇒ Object



49
50
51
# File 'lib/ruby_client/Input.rb', line 49

def to_json(_options = {})
  JSON.pretty_generate({})
end