forked from workatbest/eversign-ruby-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_document.rb
45 lines (37 loc) · 1.1 KB
/
create_document.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require_relative 'config'
document = Eversign::Models::Document.new
document.title = 'Tile goes here'
document.message = 'tester@gmail.com'
recipient = Eversign::Models::Recipient.new(name='Test', email='recipient@gmail.com')
file = Eversign::Models::File.new(name="Test")
file.file_url = 'pic.jpg'
signer = Eversign::Models::Signer.new
signer.id="1"
signer.name = "Jane Doe"
signer.email = 'signer@gmail.com'
field = Eversign::Models::CheckboxField.new
field.identifier = "Test"
field.x = "120.43811219947"
field.y = "479.02760463045"
field.page = 1
field.signer = 1
field.width = 120
field.height = 35
field.required = 1
field.readonly = 1
field.merge = 0
field.validation_type = 'letters_only'
field.text_style = 'IBU'
field.text_font = 'calibri'
if field.valid?
document.add_field(field)
document.add_file(file)
document.add_signer(signer)
document.add_recipient(recipient)
recipient = Eversign::Models::Recipient.new(name='Test2', email='recipient2@gmail.com')
document.add_recipient(recipient)
client = Eversign::Client.new
p client.create_document(document)
else
p field.errors.full_messages
end