rightsignature 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -222,7 +222,7 @@ Most common use of API, clones a template and sends it for signature.
222
222
  @rs_connection.prepackage_and_send(guid, roles, options={})
223
223
  ```
224
224
  * guid: template guid to use. Should be a template that was prepackaged
225
- * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :name => "a@example.com"}}
225
+ * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :email => "a@example.com"}}
226
226
  Optional options:
227
227
  * subject: document subject. Defaults to the subject in prepackage response.
228
228
  * description: document description that'll appear in the email
@@ -244,11 +244,11 @@ For cloning a Template before sending it.
244
244
  #####Template Prefilling
245
245
  After prepacking, the new template can be updated with prefill data. This won't send out the template as a document.
246
246
  ```
247
- @rs_connection.prefill(guid, subject, roles)
247
+ @rs_connection.prefill(guid, subject, roles, options={})
248
248
  ```
249
249
  * guid: template guid to use. Should be a template that was prepackaged
250
250
  * subject: document subject.
251
- * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :name => "a@example.com"}}
251
+ * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :email => "a@example.com"}}
252
252
  * Optional options:
253
253
  * description: document description that'll appear in the email
254
254
  * merge_fields: document merge fields, should be an array of merge_field_values in a hash with the merge_field_name.
@@ -281,11 +281,11 @@ options = {
281
281
  #####Template Sending
282
282
  Send template as a document for signing. Same options as prefill.
283
283
  ```
284
- @rs_connection.send_template(guid, subject, roles)
284
+ @rs_connection.send_template(guid, subject, roles, options={})
285
285
  ```
286
286
  * guid: template guid to use. Should be a template that was prepackaged
287
287
  * subject: document subject.
288
- * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :name => "a@example.com"}}
288
+ * roles: recipient names in array of {:name => "Person's Name", :email => "Email"} hashed by Role ID. Ex. {"signer_A" => {:name => "Your Name", :email => "a@example.com"}}
289
289
  * Optional options:
290
290
  * description: document description that'll appear in the email
291
291
  * merge_fields: document merge fields, should be an array of merge_field_values in a hash with the merge_field_name.
@@ -55,8 +55,9 @@ module RightSignature
55
55
  end
56
56
 
57
57
  # Uses consumer to generate a request token.
58
- def new_request_token
59
- @request_token = oauth_consumer.get_request_token
58
+ # * <b>o</b>: options hash. Use this to set the :oauth_callback
59
+ def new_request_token(o = {})
60
+ @request_token = oauth_consumer.get_request_token(o)
60
61
  end
61
62
 
62
63
  # Sets request token.
@@ -61,7 +61,7 @@ module RightSignature
61
61
  # Ex. "http://yoursite/callback"
62
62
  #
63
63
  # Ex. call with all options used
64
- # RightSignature::Template.prefill(
64
+ # @rs_connection.prefill(
65
65
  # "a_1_zcfdidf8fi23",
66
66
  # "Your Employee Handbook",
67
67
  # [{"employee" => {:name => "John Employee", :email => "john@employee.com"}}],
@@ -76,6 +76,7 @@ module RightSignature
76
76
  # {:name => 'sent_from_api'},
77
77
  # {:name => 'user_id', :value => '32'}
78
78
  # ],
79
+ # :redirect_location => "http://yoursite/redirect",
79
80
  # :callback_location => "http://yoursite/callback"
80
81
  # })
81
82
  def prefill(guid, subject, roles, options={})
@@ -93,7 +94,7 @@ module RightSignature
93
94
  use_merge_field_ids = options.delete(:use_merge_field_ids)
94
95
  xml_hash[:template][:merge_fields] = MergeFieldsHelper.array_to_xml_hash(options[:merge_fields], use_merge_field_ids) if options[:merge_fields]
95
96
  xml_hash[:template][:tags] = TagsHelper.array_to_xml_hash(options[:tags]) if options[:tags]
96
- [:expires_in, :description, :callback_location, :action].each do |other_option|
97
+ [:expires_in, :description, :callback_location, :redirect_location, :action].each do |other_option|
97
98
  xml_hash[:template][other_option] = options[other_option] if options[other_option]
98
99
  end
99
100
 
@@ -125,7 +126,7 @@ module RightSignature
125
126
  # Ex. "http://yoursite/callback"
126
127
  #
127
128
  # Ex. call with all options used
128
- # RightSignature::Template.prepackage_and_send(
129
+ # @rs_connection.prepackage_and_send(
129
130
  # "a_1_zcfdidf8fi23",
130
131
  # "Your Employee Handbook",
131
132
  # [{"employee" => {:name => "John Employee", :email => "john@employee.com"}}],
@@ -173,7 +174,7 @@ module RightSignature
173
174
  # Ex. "http://yoursite/callback"
174
175
  #
175
176
  # Ex. call with all options used
176
- # RightSignature::Template.send_template(
177
+ # @rs_connection.send_template(
177
178
  # "a_1_zcfdidf8fi23",
178
179
  # "Your Employee Handbook",
179
180
  # [{"employee" => {:name => "John Employee", :email => "john@employee.com"}}],
@@ -252,7 +253,7 @@ module RightSignature
252
253
  # Ex. "http://yoursite/thanks_for_signing"
253
254
  #
254
255
  # Ex. call with all options used
255
- # RightSignature::Template.prefill(
256
+ # @rs_connection.send_as_embedded_signers(
256
257
  # "a_1_zcfdidf8fi23",
257
258
  # "Your Employee Handbook",
258
259
  # [{"employee" => {:name => "John Employee", :email => "john@employee.com"}}],
@@ -267,7 +268,7 @@ module RightSignature
267
268
  # {:name => 'sent_from_api'},
268
269
  # {:name => 'user_id', :value => '32'}
269
270
  # ],
270
- # :callback_location => "http://yoursite/callback"
271
+ # :redirect_location => "http://yoursite/redirect_from_signing"
271
272
  # })
272
273
  def send_as_embedded_signers(guid, recipients, options={})
273
274
  redirect_location = options.delete(:redirect_location)
@@ -1,3 +1,3 @@
1
1
  module RightSignature
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -75,6 +75,16 @@ describe RightSignature::OauthConnection do
75
75
  oauth_connection.new_request_token
76
76
  oauth_connection.request_token.should == request_mock
77
77
  end
78
+
79
+ it "should pass in options" do
80
+ request_mock = mock(OAuth::RequestToken)
81
+ OAuth::Consumer.stub(:new).and_return(@consumer_mock)
82
+ @consumer_mock.should_receive(:get_request_token).with({:oauth_callback => "http://example.com/callback"}).and_return(request_mock)
83
+
84
+ oauth_connection = RightSignature::OauthConnection.new({:consumer_key => "Consumer123", :consumer_secret => "Secret098", :access_token => "AccessToken098", :access_secret => "AccessSecret123"})
85
+ oauth_connection.new_request_token({:oauth_callback => "http://example.com/callback"})
86
+ oauth_connection.request_token.should == request_mock
87
+ end
78
88
  end
79
89
 
80
90
  describe "set_request_token" do
@@ -158,7 +158,7 @@ describe RightSignature::Template do
158
158
  @rs.prefill("MYGUID", "sign me", [], {:tags => [{"I_Key" => "I_Value"}, "Alone"]})
159
159
  end
160
160
 
161
- it "should include options :expires_in, :description, and :callback_location" do
161
+ it "should include options :expires_in, :description, :redirect_location, and :callback_location" do
162
162
  @rs.should_receive(:post).with('/api/templates.xml', {
163
163
  :template => {
164
164
  :guid => "MYGUID",
@@ -167,10 +167,11 @@ describe RightSignature::Template do
167
167
  :roles => [],
168
168
  :expires_in => 15,
169
169
  :description => "Hey, I'm a description",
170
+ :redirect_location => 'http://example.com/redirectme',
170
171
  :callback_location => 'http://example.com/callie'
171
172
  }
172
173
  })
173
- @rs.prefill("MYGUID", "sign me", [], {:expires_in => 15, :description => "Hey, I'm a description", :callback_location => "http://example.com/callie"})
174
+ @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"})
174
175
  end
175
176
  end
176
177
 
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.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-11-13 00:00:00.000000000 Z
14
+ date: 2013-02-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -166,3 +166,4 @@ signing_key:
166
166
  specification_version: 3
167
167
  summary: API wrapper for RightSignature
168
168
  test_files: []
169
+ has_rdoc: