legalizer 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,10 +36,46 @@ Or template id
36
36
 
37
37
  legalizer.find.template(id)
38
38
 
39
- Sending is simplified right now, but will be enhanced later. For now you can just send a template to an email address with these parameters:
39
+ Sending is simplified right now, but will be enhanced later. For now you can just send a template by providing a valid xml document as described in the RightSignature API documentation (https://rightsignature.com/apidocs/api_calls?api_method=prefillTemplate):
40
40
 
41
41
  template = legalizer.find.template(id)
42
- template.send('SUBJECT LINE', 'SENDERS NAME', 'SENDERS EMAIL','RECIPIENTS NAME','RECIPIENTS EMAIL','TAG')
42
+
43
+ xml_request = '<template>
44
+ <guid>a_956_1f68556eba674af0b5dc35cdeec58b38</guid>
45
+ <subject>Test Subject</subject>
46
+ <description>Test Description</description>
47
+ <action>prefill</action>
48
+ <expires_in>5 days</expires_in>
49
+ <roles>
50
+ <role role_name="Employee Address">
51
+ <name>John Employee</name>
52
+ <email>john@employee.com</email>
53
+ <locked>true</locked>
54
+ </role>
55
+ <role role_id="a_2313_lf79870f3dv_2">
56
+ <name>Jane Employee</name>
57
+ <email>jane@employee.com</email>
58
+ <locked>true</locked>
59
+ </role>
60
+ </roles>
61
+ <merge_fields>
62
+ <merge_field merge_field_id="a_233_f309f82jklnm_232">
63
+ <value>$100 per hour</value>
64
+ <locked>true</locked>
65
+ </merge_field>
66
+ <merge_field merge_field_name="Employee Name">
67
+ <value>J. Employee</value>
68
+ </merge_field>
69
+ </merge_fields>
70
+ <tags>
71
+ <tag>
72
+ <value>company1</value>
73
+ </tag>
74
+ </tags>
75
+ <callback_location>http://localhost/doc_callback</callback_location>
76
+ </template>'
77
+
78
+ template.send(xml_request)
43
79
 
44
80
  == REQUIREMENTS:
45
81
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{legalizer}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darby Frey"]
12
- s.date = %q{2010-12-07}
12
+ s.date = %q{2010-12-09}
13
13
  s.description = %q{}
14
14
  s.email = %q{darbyfrey@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -5,37 +5,12 @@ module Legalizer
5
5
  @source = options[:object]
6
6
  end
7
7
 
8
- def send(subject, sender_name, sender_email, recipient_name, recipient_email, tag)
8
+ def send(request_xml)
9
9
  template_guid = self.source["guid"]
10
10
  package = @config.connection.request(:get, "/api/templates/#{template_guid}/prepackage.json", @config.token, {})
11
11
  package_guid = JSON.parse(package.body)["template"]["guid"]
12
- xml = build_xml(package_guid, subject, sender_name, sender_email, recipient_name, recipient_email, tag)
13
- response = JSON.parse(@config.connection.request(:post, '/api/templates.json', @config.token, {}, xml, { 'Content-Type' => 'application/xml' }).body)
12
+ response = JSON.parse(@config.connection.request(:post, '/api/templates.json', @config.token, {}, request_xml, { 'Content-Type' => 'application/xml' }).body)
14
13
  response["document"]["guid"]
15
14
  end
16
-
17
- private
18
- def build_xml(guid, subject, sender_name, sender_email, recipient_name, recipient_email, tag)
19
- "<template>
20
- <guid>#{guid}</guid>
21
- <subject>#{subject}</subject>
22
- <action>send</action>
23
- <roles>
24
- <role role_name='Document Sender'>
25
- <name>#{sender_name}</name>
26
- <email>#{sender_email}</email>
27
- </role>
28
- <role role_name='Client'>
29
- <name>#{recipient_name}</name>
30
- <email>#{recipient_email}</email>
31
- </role>
32
- </roles>
33
- <tags>
34
- <tag>
35
- <value>#{tag}</value>
36
- </tag>
37
- </tags>
38
- </template>"
39
- end
40
15
  end
41
16
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legalizer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darby Frey
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-07 00:00:00 -06:00
18
+ date: 2010-12-09 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency