Skip to content

Commit 91205b0

Browse files
Merge branch 'master' of github.com:docusign/code-examples-ruby-private
2 parents afd8f37 + 10157fa commit 91205b0

File tree

6 files changed

+161
-199
lines changed

6 files changed

+161
-199
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ group :test do
6666
gem 'chromedriver-helper', '~> 2.1.1'
6767
end
6868

69-
gem 'docusign_esign', '~> 3.13.0.rc1'
69+
gem 'docusign_esign', '~> 3.14.0'
7070
gem 'docusign_monitor', '~> 1.0.0'
7171
gem 'docusign_rooms', '~> 1.2.0.rc1'
7272
gem 'docusign_click', '~> 1.0.0'

Gemfile.lock

Lines changed: 72 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (6.0.4.1)
5-
actionpack (= 6.0.4.1)
4+
actioncable (6.0.4.4)
5+
actionpack (= 6.0.4.4)
66
nio4r (~> 2.0)
77
websocket-driver (>= 0.6.1)
8-
actionmailbox (6.0.4.1)
9-
actionpack (= 6.0.4.1)
10-
activejob (= 6.0.4.1)
11-
activerecord (= 6.0.4.1)
12-
activestorage (= 6.0.4.1)
13-
activesupport (= 6.0.4.1)
8+
actionmailbox (6.0.4.4)
9+
actionpack (= 6.0.4.4)
10+
activejob (= 6.0.4.4)
11+
activerecord (= 6.0.4.4)
12+
activestorage (= 6.0.4.4)
13+
activesupport (= 6.0.4.4)
1414
mail (>= 2.7.1)
15-
actionmailer (6.0.4.1)
16-
actionpack (= 6.0.4.1)
17-
actionview (= 6.0.4.1)
18-
activejob (= 6.0.4.1)
15+
actionmailer (6.0.4.4)
16+
actionpack (= 6.0.4.4)
17+
actionview (= 6.0.4.4)
18+
activejob (= 6.0.4.4)
1919
mail (~> 2.5, >= 2.5.4)
2020
rails-dom-testing (~> 2.0)
21-
actionpack (6.0.4.1)
22-
actionview (= 6.0.4.1)
23-
activesupport (= 6.0.4.1)
21+
actionpack (6.0.4.4)
22+
actionview (= 6.0.4.4)
23+
activesupport (= 6.0.4.4)
2424
rack (~> 2.0, >= 2.0.8)
2525
rack-test (>= 0.6.3)
2626
rails-dom-testing (~> 2.0)
2727
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28-
actiontext (6.0.4.1)
29-
actionpack (= 6.0.4.1)
30-
activerecord (= 6.0.4.1)
31-
activestorage (= 6.0.4.1)
32-
activesupport (= 6.0.4.1)
28+
actiontext (6.0.4.4)
29+
actionpack (= 6.0.4.4)
30+
activerecord (= 6.0.4.4)
31+
activestorage (= 6.0.4.4)
32+
activesupport (= 6.0.4.4)
3333
nokogiri (>= 1.8.5)
34-
actionview (6.0.4.1)
35-
activesupport (= 6.0.4.1)
34+
actionview (6.0.4.4)
35+
activesupport (= 6.0.4.4)
3636
builder (~> 3.1)
3737
erubi (~> 1.4)
3838
rails-dom-testing (~> 2.0)
3939
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40-
activejob (6.0.4.1)
41-
activesupport (= 6.0.4.1)
40+
activejob (6.0.4.4)
41+
activesupport (= 6.0.4.4)
4242
globalid (>= 0.3.6)
43-
activemodel (6.0.4.1)
44-
activesupport (= 6.0.4.1)
45-
activerecord (6.0.4.1)
46-
activemodel (= 6.0.4.1)
47-
activesupport (= 6.0.4.1)
48-
activestorage (6.0.4.1)
49-
actionpack (= 6.0.4.1)
50-
activejob (= 6.0.4.1)
51-
activerecord (= 6.0.4.1)
43+
activemodel (6.0.4.4)
44+
activesupport (= 6.0.4.4)
45+
activerecord (6.0.4.4)
46+
activemodel (= 6.0.4.4)
47+
activesupport (= 6.0.4.4)
48+
activestorage (6.0.4.4)
49+
actionpack (= 6.0.4.4)
50+
activejob (= 6.0.4.4)
51+
activerecord (= 6.0.4.4)
5252
marcel (~> 1.0.0)
53-
activesupport (6.0.4.1)
53+
activesupport (6.0.4.4)
5454
concurrent-ruby (~> 1.0, >= 1.0.2)
5555
i18n (>= 0.7, < 2)
5656
minitest (~> 5.1)
@@ -97,7 +97,7 @@ GEM
9797
json (~> 2.1, >= 2.1.0)
9898
jwt (~> 2.2, >= 2.2.1)
9999
typhoeus (~> 1.0, >= 1.0.1)
100-
docusign_esign (3.13.0)
100+
docusign_esign (3.14.0)
101101
addressable (~> 2.7, >= 2.7.0)
102102
json (~> 2.1, >= 2.1.0)
103103
jwt (~> 2.2, >= 2.2.1)
@@ -116,29 +116,33 @@ GEM
116116
ethon (0.15.0)
117117
ffi (>= 1.15.0)
118118
execjs (2.8.1)
119-
faraday (1.8.0)
119+
faraday (1.9.3)
120120
faraday-em_http (~> 1.0)
121121
faraday-em_synchrony (~> 1.0)
122122
faraday-excon (~> 1.1)
123-
faraday-httpclient (~> 1.0.1)
123+
faraday-httpclient (~> 1.0)
124+
faraday-multipart (~> 1.0)
124125
faraday-net_http (~> 1.0)
125-
faraday-net_http_persistent (~> 1.1)
126+
faraday-net_http_persistent (~> 1.0)
126127
faraday-patron (~> 1.0)
127128
faraday-rack (~> 1.0)
128-
multipart-post (>= 1.2, < 3)
129+
faraday-retry (~> 1.0)
129130
ruby2_keywords (>= 0.0.4)
130131
faraday-em_http (1.0.0)
131132
faraday-em_synchrony (1.0.0)
132133
faraday-excon (1.1.0)
133134
faraday-httpclient (1.0.1)
135+
faraday-multipart (1.0.3)
136+
multipart-post (>= 1.2, < 3)
134137
faraday-net_http (1.0.1)
135138
faraday-net_http_persistent (1.2.0)
136139
faraday-patron (1.0.0)
137140
faraday-rack (1.0.0)
138-
ffi (1.15.4)
139-
globalid (0.5.2)
141+
faraday-retry (1.0.3)
142+
ffi (1.15.5)
143+
globalid (1.0.0)
140144
activesupport (>= 5.0)
141-
hashie (4.1.0)
145+
hashie (5.0.0)
142146
i18n (1.8.11)
143147
concurrent-ruby (~> 1.0)
144148
io-like (0.3.1)
@@ -149,23 +153,23 @@ GEM
149153
listen (3.2.1)
150154
rb-fsevent (~> 0.10, >= 0.10.3)
151155
rb-inotify (~> 0.9, >= 0.9.10)
152-
loofah (2.12.0)
156+
loofah (2.13.0)
153157
crass (~> 1.0.2)
154158
nokogiri (>= 1.5.9)
155159
mail (2.7.1)
156160
mini_mime (>= 0.1.1)
157161
marcel (1.0.2)
158162
method_source (0.9.2)
159163
mini_mime (1.1.2)
160-
minitest (5.14.4)
164+
minitest (5.15.0)
161165
msgpack (1.4.2)
162166
multi_json (1.15.0)
163167
multi_xml (0.6.0)
164168
multipart-post (2.1.1)
165169
nio4r (2.5.8)
166-
nokogiri (1.12.5-x86_64-darwin)
170+
nokogiri (1.13.1-x86_64-darwin)
167171
racc (~> 1.4)
168-
nokogiri (1.12.5-x86_64-linux)
172+
nokogiri (1.13.1-x86_64-linux)
169173
racc (~> 1.4)
170174
oauth2 (1.4.7)
171175
faraday (>= 0.8, < 2.0)
@@ -199,29 +203,29 @@ GEM
199203
rack
200204
rack-test (1.1.0)
201205
rack (>= 1.0, < 3)
202-
rails (6.0.4.1)
203-
actioncable (= 6.0.4.1)
204-
actionmailbox (= 6.0.4.1)
205-
actionmailer (= 6.0.4.1)
206-
actionpack (= 6.0.4.1)
207-
actiontext (= 6.0.4.1)
208-
actionview (= 6.0.4.1)
209-
activejob (= 6.0.4.1)
210-
activemodel (= 6.0.4.1)
211-
activerecord (= 6.0.4.1)
212-
activestorage (= 6.0.4.1)
213-
activesupport (= 6.0.4.1)
206+
rails (6.0.4.4)
207+
actioncable (= 6.0.4.4)
208+
actionmailbox (= 6.0.4.4)
209+
actionmailer (= 6.0.4.4)
210+
actionpack (= 6.0.4.4)
211+
actiontext (= 6.0.4.4)
212+
actionview (= 6.0.4.4)
213+
activejob (= 6.0.4.4)
214+
activemodel (= 6.0.4.4)
215+
activerecord (= 6.0.4.4)
216+
activestorage (= 6.0.4.4)
217+
activesupport (= 6.0.4.4)
214218
bundler (>= 1.3.0)
215-
railties (= 6.0.4.1)
219+
railties (= 6.0.4.4)
216220
sprockets-rails (>= 2.0.0)
217221
rails-dom-testing (2.0.3)
218222
activesupport (>= 4.2.0)
219223
nokogiri (>= 1.6)
220224
rails-html-sanitizer (1.4.2)
221225
loofah (~> 2.3)
222-
railties (6.0.4.1)
223-
actionpack (= 6.0.4.1)
224-
activesupport (= 6.0.4.1)
226+
railties (6.0.4.4)
227+
actionpack (= 6.0.4.4)
228+
activesupport (= 6.0.4.4)
225229
method_source
226230
rake (>= 0.8.7)
227231
thor (>= 0.20.3, < 2.0)
@@ -252,12 +256,12 @@ GEM
252256
sprockets (4.0.2)
253257
concurrent-ruby (~> 1.0)
254258
rack (> 1, < 3)
255-
sprockets-rails (3.2.2)
256-
actionpack (>= 4.0)
257-
activesupport (>= 4.0)
259+
sprockets-rails (3.4.2)
260+
actionpack (>= 5.2)
261+
activesupport (>= 5.2)
258262
sprockets (>= 3.0.0)
259263
sqlite3 (1.4.2)
260-
thor (1.1.0)
264+
thor (1.2.1)
261265
thread_safe (0.3.6)
262266
tilt (2.0.10)
263267
turbolinks (5.2.1)
@@ -279,7 +283,7 @@ GEM
279283
websocket-extensions (0.1.5)
280284
xpath (3.2.0)
281285
nokogiri (~> 1.8)
282-
zeitwerk (2.5.1)
286+
zeitwerk (2.5.3)
283287

284288
PLATFORMS
285289
x86_64-darwin-20
@@ -293,7 +297,7 @@ DEPENDENCIES
293297
coffee-rails (~> 5.0.0)
294298
docusign_admin (~> 1.0.0)
295299
docusign_click (~> 1.0.0)
296-
docusign_esign (~> 3.13.0.rc1)
300+
docusign_esign (~> 3.14.0)
297301
docusign_monitor (~> 1.0.0)
298302
docusign_rooms (~> 1.2.0.rc1)
299303
jbuilder (~> 2.10.0)

app/controllers/e_sign/eg031_bulk_sending_envelopes_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ class ESign::Eg031BulkSendingEnvelopesController < EgController
55
def create
66
minimum_buffer_min = 3
77
if check_token(minimum_buffer_min)
8-
begin
8+
begin
99
results = ESign::Eg031BulkSendingEnvelopesService.new(request, session).call
1010
# Step 4. a) Call the eSignature API
11-
# b) Display the JSON response
12-
@title = 'Bulk sent'
13-
@h1 = 'Bulk send envelope was successfully performed!'
14-
@message = "Bulk request queued to #{results.queued} user lists."
11+
# b) Display the JSON response
12+
@title = 'Bulk send envelopes'
13+
@h1 = 'Bulk send envelopes'
14+
@message = 'Results from BulkSend:getBulkSendBatchStatus method:'
1515
@json = results.to_json.to_json
1616

1717
render 'ds_common/example_done'

app/services/e_sign/eg031_bulk_sending_envelopes_service.rb

Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ class ESign::Eg031BulkSendingEnvelopesService
66

77
def initialize(request, session)
88
@signers = {
9-
signer_email: request.params['signerEmail'].gsub(/([^\w \-\@\.\,])+/, ''),
10-
signer_name: request.params['signerName'].gsub(/([^\w \-\@\.\,])+/, ''),
11-
cc_email: request.params['ccEmail'].gsub(/([^\w \-\@\.\,])+/, ''),
12-
cc_name: request.params['ccName'].gsub(/([^\w \-\@\.\,])+/, ''),
9+
signer_email: request.params['signerEmail1'].gsub(/([^\w \-\@\.\,])+/, ''),
10+
signer_name: request.params['signerName1'].gsub(/([^\w \-\@\.\,])+/, ''),
11+
cc_email: request.params['ccEmail1'].gsub(/([^\w \-\@\.\,])+/, ''),
12+
cc_name: request.params['ccName1'].gsub(/([^\w \-\@\.\,])+/, ''),
1313
status: 'created',
1414

15-
signer_email1: request.params['signerEmail1'].gsub(/([^\w \-\@\.\,])+/, ''),
16-
signer_name1: request.params['signerName1'].gsub(/([^\w \-\@\.\,])+/, ''),
17-
cc_email1: request.params['ccEmail1'].gsub(/([^\w \-\@\.\,])+/, ''),
18-
cc_name1: request.params['ccName1'].gsub(/([^\w \-\@\.\,])+/, '')
15+
signer_email1: request.params['signerEmail2'].gsub(/([^\w \-\@\.\,])+/, ''),
16+
signer_name1: request.params['signerName2'].gsub(/([^\w \-\@\.\,])+/, ''),
17+
cc_email1: request.params['ccEmail2'].gsub(/([^\w \-\@\.\,])+/, ''),
18+
cc_name1: request.params['ccName2'].gsub(/([^\w \-\@\.\,])+/, '')
1919
}
2020
@args = {
2121
account_id: session['ds_account_id'],
@@ -54,24 +54,17 @@ def call
5454
envelope_api.create_custom_fields(args[:account_id], envelope_id, custom_fields(bulk_list_id))
5555
# Step 5-1 end
5656

57-
# Add placeholder recipients
58-
# Step 6-1 start
59-
recipients = recipients_data
60-
recipients = DocuSign_eSign::Recipients.new(signers: [recipients[0]], cc: [recipients[1]])
61-
envelope_api.create_recipient(args[:account_id], envelope_id, recipients, options = DocuSign_eSign::CreateRecipientOptions.default)
62-
# Step 6-1 end
63-
6457
# Initiate bulk send
65-
# Step 7 start
58+
# Step 6 start
6659
bulk_send_request = DocuSign_eSign::BulkSendRequest.new(envelopeOrTemplateId: envelope_id)
6760
batch = bulk_envelopes_api.create_bulk_send_request(args[:account_id], bulk_list_id, bulk_send_request)
6861
batch_id = batch.batch_id
69-
# Step 7 end
62+
# Step 6 end
7063

7164
# Confirm successful batch send
72-
# Step 8 start
65+
# Step 7 start
7366
bulk_envelopes_api.get_bulk_send_batch_status(args[:account_id], batch_id)
74-
# Step 8 end
67+
# Step 7 end
7568
end
7669

7770
private
@@ -150,37 +143,6 @@ def custom_fields(bulk_list_id)
150143
end
151144
# Step 5-2 end
152145

153-
# Step 6-2 start
154-
def recipients_data
155-
signer = DocuSign_eSign::Signer.new(
156-
name: "Multi Bulk Recipient::signer",
157-
email: "multiBulkRecipients-signer@docusign.com",
158-
roleName: "signer",
159-
note: "",
160-
routingOrder: 1,
161-
status: "created",
162-
templateAccessCodeRequired: "null",
163-
deliveryMethod: "email",
164-
recipientId: "1",
165-
recipientType: "signer"
166-
)
167-
168-
cc = DocuSign_eSign::CarbonCopy.new(
169-
name: "Multi Bulk Recipient::cc",
170-
email: "multiBulkRecipients-cc@docusign.com",
171-
roleName: "cc",
172-
note: "",
173-
routingOrder: 1,
174-
status: "created",
175-
deliveryMethod: "email",
176-
recipientId: "2",
177-
recipientType: "cc"
178-
)
179-
180-
[signer, cc]
181-
end
182-
# Step 6-2 end
183-
184146
# Step 4-2 start
185147
def make_envelope
186148
# Create the envelope definition
@@ -212,7 +174,7 @@ def make_envelope
212174
email: "multiBulkRecipients-cc@docusign.com",
213175
roleName: "cc",
214176
note: "",
215-
routingOrder: 1,
177+
routingOrder: 2,
216178
status: "created",
217179
deliveryMethod: "email",
218180
recipientId: "2",

0 commit comments

Comments
 (0)