rightsignature 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CONTRIBUTING.md +26 -0
- data/lib/rightsignature/template.rb +3 -10
- data/lib/rightsignature/version.rb +1 -1
- data/spec/template_spec.rb +47 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjMzYzk2MDBiZTUwMjcyMzMxNzhkNzUwZjI1ZTI5YTQyMjI5NDYwMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTFlYzIzMDcyNzMyMWNmNDM1NjNjZmUwMzQwMjFlZTM1ODJlM2FlNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWVkYTM5OGI2YjBiYjAyYjFlMjczZTA2OTI0MGE0NzZmMDEzZWI0NTM3MDIw
|
10
|
+
YzM5ZWE1NjdhODFjOGM1MDg4NmNjYmI1NzY3ZDUwOWVkNWQ1YjE1MDMzYWYx
|
11
|
+
MDJhNGM4NThlYmUxZjc4YjRhNjI3NDBmYTA3MzBmNTc4MmQ5NTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2Y5MGJkZmM3YzIxZWZmMjVlZjNkZjUwOTRkNzY1MmNkZTAzZGQ0ZGEzMzhm
|
14
|
+
NmNjN2U1NjZlMWNhN2YwOTU3YTBjNGNmYzY4MDIxMDczOTYyY2U0YmRiNmYz
|
15
|
+
YjY5YzIyOGFjNDY5Y2QzZGQyMGI2ZWMzODdhZWE4NzFjYmY1Njg=
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Contributing
|
2
|
+
------------
|
3
|
+
Awesome! Here are some guidelines:
|
4
|
+
* **Contributions will not be accepted without tests.**
|
5
|
+
* If you're creating a small fix or patch to an existing feature, just a simple
|
6
|
+
test will do. Please stay in the confines of the current test suite and use
|
7
|
+
[RSpec](https://github.com/rspec/rspec).
|
8
|
+
* If your contribution changes any behavior, make sure to update the
|
9
|
+
documentation.
|
10
|
+
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
|
11
|
+
when modifying Ruby code.
|
12
|
+
|
13
|
+
Running the tests
|
14
|
+
-----------------
|
15
|
+
```
|
16
|
+
rspec spec/*_spec.rb
|
17
|
+
```
|
18
|
+
|
19
|
+
Basic Steps
|
20
|
+
-----------
|
21
|
+
* Fork it
|
22
|
+
* Create your feature branch (git checkout -b my-new-feature)
|
23
|
+
* Commit your changes (git commit -am 'Add some feature')
|
24
|
+
* Make sure the tests pass (rspec spec/*_spec.rb)
|
25
|
+
* Push to the branch (git push origin my-new-feature)
|
26
|
+
* Create new [Pull Request](https://help.github.com/articles/using-pull-requests)
|
@@ -80,23 +80,20 @@ module RightSignature
|
|
80
80
|
# :callback_location => "http://yoursite/callback"
|
81
81
|
# })
|
82
82
|
def prefill(guid, subject, roles, options={})
|
83
|
+
use_merge_field_ids = options.delete(:use_merge_field_ids)
|
83
84
|
xml_hash = {
|
84
85
|
:template => {
|
85
86
|
:guid => guid,
|
86
87
|
:action => "prefill",
|
87
88
|
:subject => subject
|
88
|
-
}
|
89
|
+
}.merge(options)
|
89
90
|
}
|
90
91
|
|
91
92
|
xml_hash[:template][:roles] = RolesHelper.array_to_xml_hash(roles)
|
92
93
|
|
93
94
|
# Optional arguments
|
94
|
-
use_merge_field_ids = options.delete(:use_merge_field_ids)
|
95
95
|
xml_hash[:template][:merge_fields] = MergeFieldsHelper.array_to_xml_hash(options[:merge_fields], use_merge_field_ids) if options[:merge_fields]
|
96
96
|
xml_hash[:template][:tags] = TagsHelper.array_to_xml_hash(options[:tags]) if options[:tags]
|
97
|
-
[:expires_in, :description, :callback_location, :redirect_location, :action, :document_data].each do |other_option|
|
98
|
-
xml_hash[:template][other_option] = options[other_option] if options[other_option]
|
99
|
-
end
|
100
97
|
|
101
98
|
post "/api/templates.xml", xml_hash
|
102
99
|
end
|
@@ -208,16 +205,12 @@ module RightSignature
|
|
208
205
|
# There will be no free-form name entry when adding merge fields to the Template.
|
209
206
|
# Ex. ["Location", "Tax ID", "Company Name"]
|
210
207
|
def generate_build_url(options={})
|
211
|
-
xml_hash = {:template =>
|
208
|
+
xml_hash = {:template => options}
|
212
209
|
xml_hash[:template][:tags] = TagsHelper.array_to_xml_hash(options[:tags]) if options[:tags]
|
213
210
|
|
214
211
|
[:acceptable_merge_field_names, :acceptable_role_names].each do |option|
|
215
212
|
xml_hash[:template][option] = array_to_acceptable_names_hash(options[option]) if options[option]
|
216
213
|
end
|
217
|
-
|
218
|
-
[:callback_location, :redirect_location].each do |other_option|
|
219
|
-
xml_hash[:template][other_option] = options[other_option] if options[other_option]
|
220
|
-
end
|
221
214
|
|
222
215
|
response = post "/api/templates/generate_build_token.xml", xml_hash
|
223
216
|
|
data/spec/template_spec.rb
CHANGED
@@ -174,6 +174,30 @@ describe RightSignature::Template do
|
|
174
174
|
})
|
175
175
|
@rs.prefill("MYGUID", "sign me", [], {:expires_in => 15, :description => "Hey, I'm a description", :redirect_location => 'http://example.com/redirectme', :callback_location => "http://example.com/callie", :document_data => {:type => 'base64', :filename => "originalfile.pdf", :value => "mOio90cv"}})
|
176
176
|
end
|
177
|
+
|
178
|
+
it "should include extra options" do
|
179
|
+
@rs.should_receive(:post).with('/api/templates.xml', {
|
180
|
+
:template => {
|
181
|
+
:guid => "MYGUID",
|
182
|
+
:action => "prefill",
|
183
|
+
:subject => "sign me",
|
184
|
+
:roles => [
|
185
|
+
{:role => {
|
186
|
+
:name => "John Employee",
|
187
|
+
:email => "john@employee.com",
|
188
|
+
"@role_id" => "signer_A"
|
189
|
+
}}],
|
190
|
+
:expires_in => 15,
|
191
|
+
:description => "Hey, I'm a description",
|
192
|
+
:redirect_location => 'http://example.com/redirectme',
|
193
|
+
:document_data => {:type => 'base64', :filename => "originalfile.pdf", :value => "mOio90cv"},
|
194
|
+
:callback_location => 'http://example.com/callie',
|
195
|
+
:something_else => "else",
|
196
|
+
:merge_fields => [{:merge_field => {:value => "123456", "@merge_field_id" => "123_abc_78"}}]
|
197
|
+
}
|
198
|
+
})
|
199
|
+
@rs.prefill("MYGUID", "sign me", [{"signer_A" => {:name => "John Employee", :email => "john@employee.com"}}], {:expires_in => 15, :description => "Hey, I'm a description", :redirect_location => 'http://example.com/redirectme', :callback_location => "http://example.com/callie", :document_data => {:type => 'base64', :filename => "originalfile.pdf", :value => "mOio90cv"}, :merge_fields => [{"123_abc_78" => "123456"}], :use_merge_field_ids => true, :something_else => "else"})
|
200
|
+
end
|
177
201
|
end
|
178
202
|
|
179
203
|
it "should POST /api/templates.xml with action of 'send', MYGUID guid, roles, and \"sign me\" subject in template hash" do
|
@@ -235,6 +259,29 @@ describe RightSignature::Template do
|
|
235
259
|
|
236
260
|
@rs.generate_build_url(:callback_location => "http://example.com/done_signing", :redirect_location => "http://example.com/come_back_here")
|
237
261
|
end
|
262
|
+
|
263
|
+
it "should include other extra options in params" do
|
264
|
+
@rs.should_receive(:post).with("/api/templates/generate_build_token.xml", {:template => {
|
265
|
+
:tags =>
|
266
|
+
[
|
267
|
+
{:tag => {:name => "Site"}}
|
268
|
+
],
|
269
|
+
:acceptable_merge_field_names =>
|
270
|
+
[
|
271
|
+
{:name => "Site ID"},
|
272
|
+
{:name => "Starting City"}
|
273
|
+
],
|
274
|
+
:acceptable_role_names =>
|
275
|
+
[
|
276
|
+
{:name => "Http Party"}
|
277
|
+
],
|
278
|
+
:callback_location => "http://example.com/done_signing",
|
279
|
+
:redirect_location => "http://example.com/come_back_here",
|
280
|
+
:extras => "stuff here"
|
281
|
+
}}).and_return({"token"=>{"redirect_token" => "REDIRECT_TOKEN"}})
|
282
|
+
|
283
|
+
@rs.generate_build_url(:tags => ["Site"], :acceptable_merge_field_names => ["Site ID", "Starting City"], :acceptable_role_names => ["Http Party"], :callback_location => "http://example.com/done_signing", :redirect_location => "http://example.com/come_back_here", :extras => "stuff here")
|
284
|
+
end
|
238
285
|
end
|
239
286
|
end
|
240
287
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rightsignature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Chee
|
@@ -104,6 +104,7 @@ extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
106
|
- .gitignore
|
107
|
+
- CONTRIBUTING.md
|
107
108
|
- Gemfile
|
108
109
|
- README.md
|
109
110
|
- Rakefile
|