Class: Ilovepdf::Signature::Receiver

Inherits:
Object
  • Object
show all
Defined in:
lib/ilovepdf/signature/receiver.rb

Constant Summary collapse

ALLOWED_TYPES =
[:signer,:validator,:viewer]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name, email, phone = nil) ⇒ Receiver

Returns a new instance of Receiver.



7
8
9
10
11
12
# File 'lib/ilovepdf/signature/receiver.rb', line 7

def initialize(type,name,email, phone=nil)
  @type = type
  @name = name
  @email = email
  @phone = phone
end

Instance Attribute Details

#access_codeObject

Returns the value of attribute access_code.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def access_code
  @access_code
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def email
  @email
end

#force_signature_typeObject

Returns the value of attribute force_signature_type.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def force_signature_type
  @force_signature_type
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def phone
  @phone
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/ilovepdf/signature/receiver.rb', line 6

def type
  @type
end

Instance Method Details

#<<(element) ⇒ Object Also known as: add_receiver



48
49
50
51
52
53
# File 'lib/ilovepdf/signature/receiver.rb', line 48

def <<(element)
  raise ::Ilovepdf::Errors::ArgumentError.new("Only Ilovepdf::Signature::FileElement type of object is allowed") unless element.is_a?(::Ilovepdf::Signature::FileElement)
  @elements ||= []
  @elements << element
  elements
end

#elementsObject



44
45
46
# File 'lib/ilovepdf/signature/receiver.rb', line 44

def elements
  @elements ||= []
end

#to_hObject



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ilovepdf/signature/receiver.rb', line 56

def to_h
  {
    name: name,
    email: email,
    phone: phone,
    type: type,
    access_code: access_code,
    force_signature_type: force_signature_type,
    files: files_to_hash
  }
end