Skip to content

Commit b3fd0ac

Browse files
committed
Update ruby sdk gem
1 parent 89c64f6 commit b3fd0ac

12 files changed

Lines changed: 120 additions & 180 deletions

File tree

Gemfile.lock

Lines changed: 59 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.0.3)
5-
actionpack (= 5.0.3)
4+
actioncable (5.0.6)
5+
actionpack (= 5.0.6)
66
nio4r (>= 1.2, < 3.0)
77
websocket-driver (~> 0.6.1)
8-
actionmailer (5.0.3)
9-
actionpack (= 5.0.3)
10-
actionview (= 5.0.3)
11-
activejob (= 5.0.3)
8+
actionmailer (5.0.6)
9+
actionpack (= 5.0.6)
10+
actionview (= 5.0.6)
11+
activejob (= 5.0.6)
1212
mail (~> 2.5, >= 2.5.4)
1313
rails-dom-testing (~> 2.0)
14-
actionpack (5.0.3)
15-
actionview (= 5.0.3)
16-
activesupport (= 5.0.3)
14+
actionpack (5.0.6)
15+
actionview (= 5.0.6)
16+
activesupport (= 5.0.6)
1717
rack (~> 2.0)
1818
rack-test (~> 0.6.3)
1919
rails-dom-testing (~> 2.0)
2020
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21-
actionview (5.0.3)
22-
activesupport (= 5.0.3)
21+
actionview (5.0.6)
22+
activesupport (= 5.0.6)
2323
builder (~> 3.1)
2424
erubis (~> 2.7.0)
2525
rails-dom-testing (~> 2.0)
2626
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27-
activejob (5.0.3)
28-
activesupport (= 5.0.3)
27+
activejob (5.0.6)
28+
activesupport (= 5.0.6)
2929
globalid (>= 0.3.6)
30-
activemodel (5.0.3)
31-
activesupport (= 5.0.3)
32-
activerecord (5.0.3)
33-
activemodel (= 5.0.3)
34-
activesupport (= 5.0.3)
30+
activemodel (5.0.6)
31+
activesupport (= 5.0.6)
32+
activerecord (5.0.6)
33+
activemodel (= 5.0.6)
34+
activesupport (= 5.0.6)
3535
arel (~> 7.0)
36-
activesupport (5.0.3)
36+
activesupport (5.0.6)
3737
concurrent-ruby (~> 1.0, >= 1.0.2)
3838
i18n (~> 0.7)
3939
minitest (~> 5.1)
4040
tzinfo (~> 1.1)
4141
arel (7.1.4)
4242
bindex (0.5.0)
4343
builder (3.2.3)
44-
byebug (9.0.6)
44+
byebug (9.1.0)
4545
coffee-rails (4.2.2)
4646
coffee-script (>= 2.2.0)
4747
railties (>= 4.0.0)
@@ -56,18 +56,18 @@ GEM
5656
railties (>= 3.2, < 5.2)
5757
erubis (2.7.0)
5858
execjs (2.7.0)
59-
faraday (0.12.1)
59+
faraday (0.13.1)
6060
multipart-post (>= 1.2, < 3)
6161
ffi (1.9.18)
6262
globalid (0.4.0)
6363
activesupport (>= 4.2.0)
64-
hellosign-ruby-sdk (3.2.15)
64+
hellosign-ruby-sdk (3.5.0)
6565
faraday
6666
mime-types
6767
multi_json
68-
i18n (0.8.4)
69-
jbuilder (2.6.4)
70-
activesupport (>= 3.0.0)
68+
i18n (0.8.6)
69+
jbuilder (2.7.0)
70+
activesupport (>= 4.2.0)
7171
multi_json (>= 1.2)
7272
jquery-rails (4.3.1)
7373
rails-dom-testing (>= 1, < 3)
@@ -78,52 +78,56 @@ GEM
7878
rb-inotify (~> 0.9, >= 0.9.7)
7979
loofah (2.0.3)
8080
nokogiri (>= 1.5.9)
81-
mail (2.6.5)
81+
mail (2.6.6)
8282
mime-types (>= 1.16, < 4)
8383
method_source (0.8.2)
8484
mime-types (3.1)
8585
mime-types-data (~> 3.2015)
8686
mime-types-data (3.2016.0521)
87-
mini_portile2 (2.1.0)
88-
minitest (5.10.2)
89-
multi_json (1.12.1)
87+
mini_portile2 (2.2.0)
88+
minitest (5.10.3)
89+
multi_json (1.12.2)
9090
multipart-post (2.0.0)
9191
nio4r (2.1.0)
92-
nokogiri (1.7.2)
93-
mini_portile2 (~> 2.1.0)
92+
nokogiri (1.8.0)
93+
mini_portile2 (~> 2.2.0)
9494
pg (0.21.0)
95-
puma (3.9.0)
95+
puma (3.10.0)
9696
rack (2.0.3)
9797
rack-test (0.6.3)
9898
rack (>= 1.0)
99-
rails (5.0.3)
100-
actioncable (= 5.0.3)
101-
actionmailer (= 5.0.3)
102-
actionpack (= 5.0.3)
103-
actionview (= 5.0.3)
104-
activejob (= 5.0.3)
105-
activemodel (= 5.0.3)
106-
activerecord (= 5.0.3)
107-
activesupport (= 5.0.3)
108-
bundler (>= 1.3.0, < 2.0)
109-
railties (= 5.0.3)
99+
rails (5.0.6)
100+
actioncable (= 5.0.6)
101+
actionmailer (= 5.0.6)
102+
actionpack (= 5.0.6)
103+
actionview (= 5.0.6)
104+
activejob (= 5.0.6)
105+
activemodel (= 5.0.6)
106+
activerecord (= 5.0.6)
107+
activesupport (= 5.0.6)
108+
bundler (>= 1.3.0)
109+
railties (= 5.0.6)
110110
sprockets-rails (>= 2.0.0)
111111
rails-dom-testing (2.0.3)
112112
activesupport (>= 4.2.0)
113113
nokogiri (>= 1.6)
114114
rails-html-sanitizer (1.0.3)
115115
loofah (~> 2.0)
116-
railties (5.0.3)
117-
actionpack (= 5.0.3)
118-
activesupport (= 5.0.3)
116+
railties (5.0.6)
117+
actionpack (= 5.0.6)
118+
activesupport (= 5.0.6)
119119
method_source
120120
rake (>= 0.8.7)
121121
thor (>= 0.18.1, < 2.0)
122-
rake (12.0.0)
123-
rb-fsevent (0.9.8)
124-
rb-inotify (0.9.8)
125-
ffi (>= 0.5.0)
126-
sass (3.4.24)
122+
rake (12.1.0)
123+
rb-fsevent (0.10.2)
124+
rb-inotify (0.9.10)
125+
ffi (>= 0.5.0, < 2)
126+
sass (3.5.1)
127+
sass-listen (~> 4.0.0)
128+
sass-listen (4.0.0)
129+
rb-fsevent (~> 0.9, >= 0.9.4)
130+
rb-inotify (~> 0.9, >= 0.9.7)
127131
sass-rails (5.0.6)
128132
railties (>= 4.0.0, < 6)
129133
sass (~> 3.1)
@@ -138,14 +142,14 @@ GEM
138142
sprockets (3.7.1)
139143
concurrent-ruby (~> 1.0)
140144
rack (> 1, < 3)
141-
sprockets-rails (3.2.0)
145+
sprockets-rails (3.2.1)
142146
actionpack (>= 4.0)
143147
activesupport (>= 4.0)
144148
sprockets (>= 3.0.0)
145149
sqlite3 (1.3.13)
146-
thor (0.19.4)
150+
thor (0.20.0)
147151
thread_safe (0.3.6)
148-
tilt (2.0.7)
152+
tilt (2.0.8)
149153
turbolinks (5.0.1)
150154
turbolinks-source (~> 5)
151155
turbolinks-source (5.0.3)
@@ -186,4 +190,4 @@ DEPENDENCIES
186190
web-console (>= 3.3.0)
187191

188192
BUNDLED WITH
189-
1.15.1
193+
1.16.0.pre.2
-1.87 MB
Binary file not shown.

app/controllers/callbacks_controller.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@ def create
1010
p event
1111
event_type = event[:event][:event_type]
1212
return "Hello API event received" if event_type == "callback_test"
13+
p "******"
14+
p "event type: #{event_type}"
1315

14-
if event[:signature_request][:signature_request_id]
16+
if event_type.include? "signature"
1517
id = event[:signature_request][:signature_request_id]
18+
elsif event_type.include? "template"
19+
id = event[:template][:template_id]
1620
end
1721

22+
# if !event[:signature_request][:signature_request_id].nil?
23+
# id = event[:signature_request][:signature_request_id]
24+
# elsif !event[:template][:template_id].nil?
25+
# id = event[:template][:template_id]
26+
# end
27+
28+
p "******"
29+
p id
30+
1831
case event_type
1932
when "signature_request_sent"
2033
Sign.create(signature_request_id: id,
@@ -30,6 +43,8 @@ def create
3043
status: 'Declined')
3144
when "template_created"
3245
p "TEMPLATE CREATED"
46+
when "template_error"
47+
p "TEMPLATE ERROR"
3348
end
3449
end
3550
end
Lines changed: 11 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,31 @@
11
class EmbeddedsController < ApplicationController
2-
skip_before_action :verify_authenticity_token
2+
def index
3+
end
34

45
def template
5-
client = Embedded.initiate_client
6-
signature_event = client.create_embedded_signature_request_with_template(
7-
test_mode: 1,
8-
client_id: ENV['CLIENT_ID'],
9-
template_id: 'e918bf31ce40b1a66b593992a9ebfcfde2c72648',
10-
signers: [
11-
{
12-
email_address: 'jen.young+1@hellosign.com',
13-
name: 'Jen Test',
14-
role: 'Client'
15-
}
16-
]
17-
)
18-
19-
@sign_url = render_url(signature_event)
206
end
217

228
def file_request
23-
client = Embedded.initiate_client
24-
25-
signature_event = client.create_embedded_signature_request(
26-
test_mode: 1,
27-
client_id: ENV['CLIENT_ID'],
28-
subject: 'Embedded Signature Request with File',
29-
message: 'Hey!',
30-
signers: [
31-
{
32-
email_address: 'jen.young+1@hellosign.com',
33-
name: 'Jen Test'
34-
}
35-
],
36-
file_url: 'http://www.pdf995.com/samples/pdf.pdf',
37-
)
38-
39-
p signature_event
40-
41-
@sign_url = render_url(signature_event)
429
end
4310

4411
def unclaimed_draft
45-
client = Embedded.initiate_client
46-
47-
signature_event = client.create_embedded_unclaimed_draft(
48-
test_mode: 1,
49-
client_id: ENV['CLIENT_ID'],
50-
type: 'request_signature',
51-
subject: 'Embedded Unclaimed Draft',
52-
requester_email_address: 'jen.young@hellosign.com',
53-
file_url: 'http://www.pdf995.com/samples/pdf.pdf',
54-
is_for_embedded_signing: 1
55-
)
56-
57-
@sign_url = render_url(signature_event)
5812
end
5913

6014
def unclaimed_draft_template
61-
client = Embedded.initiate_client
62-
63-
signature_event = client.create_embedded_unclaimed_draft_with_template(
64-
test_mode: 1,
65-
client_id: ENV['CLIENT_ID'],
66-
template_id: '396695d8ef08b4c5a51f176057c6a7aa62ba50cc',
67-
requester_email_address: 'jen.young@hellosign.com',
68-
signing_redirect_url: 'http://www.google.com',
69-
requesting_redirect_url: 'http://www.google.com',
70-
signers: [
71-
{
72-
email_address: 'jen.young+1@hellosign.com',
73-
name: 'Jen Test',
74-
role: 'Client'
75-
}
76-
]
77-
)
78-
79-
response = JSON.parse(signature_event.to_json, symbolize_names: true)
80-
@sign_url = response[:raw_data][:claim_url]
8115
end
8216

8317
def template_draft
84-
client = Embedded.initiate_client
85-
file = params[:file]
86-
87-
request = client.create_embedded_template_draft(
88-
test_mode: 1,
89-
client_id: ENV['CLIENT_ID'],
90-
file_url: 'http://www.pdf995.com/samples/pdf.pdf',
91-
title: 'Test title',
92-
subject: 'test subject',
93-
message: 'test message',
94-
signer_roles: [
95-
{
96-
name: 'Client',
97-
order: 0
98-
},
99-
{
100-
name: 'Client 2',
101-
order: 1
102-
}
103-
],
104-
merge_fields: '[
105-
{
106-
"name":"Test Merge",
107-
"type":"text"
108-
},
109-
{
110-
"name":"Test Merge 2",
111-
"type":"text"
112-
}]'
113-
)
114-
115-
p request
116-
p "*****"
117-
p request.data['template_id']
118-
@sign_url = request.data['edit_url']
11918
end
12019

121-
private
122-
123-
def render_url(response)
20+
def edit_unclaimed_draft
12421
client = Embedded.initiate_client
125-
126-
response_object = JSON.parse(response.to_json, symbolize_names: true)
127-
signature_id = response_object[:raw_data][:signatures][0][:signature_id]
128-
129-
get_url = client.get_embedded_sign_url :signature_id => signature_id
130-
131-
url_response = JSON.parse(get_url.to_json, symbolize_names: true)
132-
url_response[:raw_data][:sign_url]
22+
@draft = client.edit_and_resend_unclaimed_draft(
23+
:signature_request_id => '596e1b9288c7c726c603fc3080689e6c89c1a397',
24+
:client_id => ENV['CLIENT_ID'],
25+
:test_mode => true
26+
)
27+
p "***"
28+
p @draft.claim_url
13329
end
30+
13431
end

0 commit comments

Comments
 (0)