Class: DynamicPDFApi::FormField

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

Overview

Represents a form field in the PDF document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value = nil) ⇒ FormField

Initializes a new instance of the FormField class using the name and the value of the form field as parameters.

Parameters:

  • name (String)

    The name of the form field.

  • value (String) (defaults to: nil)

    The value of the form field.



14
15
16
17
18
19
20
# File 'lib/ruby_client/FormField.rb', line 14

def initialize(name, value = nil)
  @flatten = nil
  @remove = nil

  @name = name
  @value = value
end

Instance Attribute Details

#flattenObject

Gets or sets a boolean indicating whether to flatten the form field.



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

def flatten
  @flatten
end

#nameObject

Gets or sets name of the form field.



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

def name
  @name
end

#removeObject

Gets or sets a boolean indicating whether to remove the form field.



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

def remove
  @remove
end

#valueObject

Gets or sets value of the form field.



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

def value
  @value
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ruby_client/FormField.rb', line 42

def to_json(_options = {})
  json_array = {}
  json_array['name'] = @name
  json_array['value'] = @value unless @value.nil?

  json_array['flatten'] = @flatten unless @flatten.nil?

  json_array['remove'] = @remove unless @remove.nil?

   JSON.pretty_generate(json_array)
end