hellosign-ruby-sdk 3.6.4 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hello_sign/api/signature_request.rb +1 -2
- data/lib/hello_sign/client.rb +8 -4
- data/lib/hello_sign/configuration.rb +2 -2
- data/lib/hello_sign/resource/base_resource.rb +8 -18
- data/lib/hello_sign/resource/resource_array.rb +9 -9
- data/lib/hello_sign/version.rb +1 -1
- data/spec/fixtures/account.json +1 -1
- data/spec/fixtures/headers.json +18 -0
- data/spec/fixtures/signature_request.json +9 -2
- data/spec/hello_sign/api/account_spec.rb +8 -0
- data/spec/hello_sign/api/api_app_spec.rb +16 -0
- data/spec/hello_sign/api/embedded_spec.rb +4 -0
- data/spec/hello_sign/api/signature_request_spec.rb +32 -0
- data/spec/hello_sign/api/team_spec.rb +20 -11
- data/spec/hello_sign/api/template_spec.rb +36 -0
- data/spec/hello_sign/api/unclaimed_draft_spec.rb +28 -0
- data/spec/hello_sign/resource/base_resource_spec.rb +13 -12
- data/spec/spec_helper.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d224546529e45bbf240730e4c079b9cccf010dd
|
4
|
+
data.tar.gz: 15db47269ee84594c900b3ed9d58716f86bc233b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc509aaec300240195a8901ff3cd6f0569301fb6e5bee023e2908c1ba90d753dfe3b5e3bc17484f55700841b6f2fee3c1df6b810c683b5c153b0b866dfafa441
|
7
|
+
data.tar.gz: 25c883d15ba8404abdfbb00974cf4d57f78881902514c1aef0cd3ee00e75e1836179b8becf161cc1ca5b826e53963ed02a60697d4a5e78ee355066a75fd8dd47
|
@@ -68,7 +68,6 @@ module HelloSign
|
|
68
68
|
query = create_query_string(opts, [:page, :page_size, :ux_version, :query])
|
69
69
|
path += query
|
70
70
|
HelloSign::Resource::ResourceArray.new get(path, opts), 'signature_requests', HelloSign::Resource::SignatureRequest
|
71
|
-
|
72
71
|
end
|
73
72
|
|
74
73
|
#
|
@@ -125,7 +124,7 @@ module HelloSign
|
|
125
124
|
prepare_form_fields opts
|
126
125
|
prepare_custom_fields opts
|
127
126
|
|
128
|
-
HelloSign::Resource::SignatureRequest.new post('/signature_request/send', :body => opts)
|
127
|
+
request = HelloSign::Resource::SignatureRequest.new post('/signature_request/send', :body => opts)
|
129
128
|
end
|
130
129
|
|
131
130
|
#
|
data/lib/hello_sign/client.rb
CHANGED
@@ -90,7 +90,8 @@ module HelloSign
|
|
90
90
|
def get(path, options={})
|
91
91
|
response = request(path, :get, options)
|
92
92
|
validate response
|
93
|
-
parse response
|
93
|
+
parsed_response = parse response
|
94
|
+
data = { headers: response.headers, body: parsed_response }
|
94
95
|
end
|
95
96
|
|
96
97
|
#
|
@@ -102,7 +103,8 @@ module HelloSign
|
|
102
103
|
def post(path, options={})
|
103
104
|
response = request(path, :post, options)
|
104
105
|
validate response
|
105
|
-
parse response
|
106
|
+
parsed_response = parse response
|
107
|
+
data = { headers: response.headers, body: parsed_response }
|
106
108
|
end
|
107
109
|
|
108
110
|
#
|
@@ -114,7 +116,8 @@ module HelloSign
|
|
114
116
|
def put(path, options={})
|
115
117
|
response = request(path, :put, options)
|
116
118
|
validate response
|
117
|
-
parse response
|
119
|
+
responsed_response = parse response
|
120
|
+
data = { headers: response.headers, body: parsed_response }
|
118
121
|
end
|
119
122
|
|
120
123
|
#
|
@@ -125,7 +128,8 @@ module HelloSign
|
|
125
128
|
def delete(path, options={})
|
126
129
|
response = request(path, :delete, options)
|
127
130
|
validate response
|
128
|
-
parse response
|
131
|
+
parsed_response = parse response
|
132
|
+
data = { headers: response.headers, body: parsed_response }
|
129
133
|
end
|
130
134
|
|
131
135
|
private
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# The MIT License (MIT)
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# Copyright (C) 2014 hellosign.com
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
8
8
|
# in the Software without restriction, including without limitation the rights
|
@@ -32,6 +32,8 @@ module HelloSign
|
|
32
32
|
#
|
33
33
|
class BaseResource
|
34
34
|
|
35
|
+
attr_reader :data, :raw_data, :warnings, :headers
|
36
|
+
|
35
37
|
#
|
36
38
|
# recursively convert hash data into BaseResource.
|
37
39
|
#
|
@@ -40,8 +42,12 @@ module HelloSign
|
|
40
42
|
#
|
41
43
|
# @return [HelloSign::Resource::BaseResource] a new BaseResource
|
42
44
|
def initialize(hash, key=nil)
|
43
|
-
@
|
44
|
-
@
|
45
|
+
@headers = hash[:headers]
|
46
|
+
@raw_data = key ? hash[:body][key] : hash
|
47
|
+
if hash[:body]
|
48
|
+
@warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
|
49
|
+
end
|
50
|
+
|
45
51
|
@data = @raw_data.inject({}) do |data, (key, value)|
|
46
52
|
data[key.to_s] = if value.is_a? Hash
|
47
53
|
value = BaseResource.new(value)
|
@@ -70,22 +76,6 @@ module HelloSign
|
|
70
76
|
def method_missing(method)
|
71
77
|
@data.key?(method.to_s) ? @data[method.to_s] : nil
|
72
78
|
end
|
73
|
-
|
74
|
-
#
|
75
|
-
# raw response data from the server in json
|
76
|
-
#
|
77
|
-
# @return [type] [description]
|
78
|
-
def data
|
79
|
-
@raw_data
|
80
|
-
end
|
81
|
-
|
82
|
-
#
|
83
|
-
# shows any warnings returned with the api response, if present
|
84
|
-
#
|
85
|
-
# @return [Array<Hash>, nil] Array of warning hashes in format {'warning_msg' => val, 'warning_name' => val} or nil
|
86
|
-
def warnings
|
87
|
-
@warnings
|
88
|
-
end
|
89
79
|
end
|
90
80
|
end
|
91
81
|
end
|
@@ -31,7 +31,7 @@ module HelloSign
|
|
31
31
|
# @author [hellosign]
|
32
32
|
#
|
33
33
|
class ResourceArray < Array
|
34
|
-
attr_reader :page, :num_pages, :num_results, :page_size, :warnings
|
34
|
+
attr_reader :page, :num_pages, :num_results, :page_size, :warnings, :headers, :list_info
|
35
35
|
|
36
36
|
#
|
37
37
|
# create a new ResourceArray from a hash
|
@@ -42,18 +42,18 @@ module HelloSign
|
|
42
42
|
#
|
43
43
|
# @return [type] [description]
|
44
44
|
def initialize(hash, key, resource_class)
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
49
|
-
@
|
50
|
-
|
51
|
-
|
45
|
+
@headers = hash[:headers]
|
46
|
+
@list_info = hash[:body]['list_info']
|
47
|
+
@page = @list_info['page']
|
48
|
+
@num_pages = @list_info['num_pages']
|
49
|
+
@num_results = @list_info['num_results']
|
50
|
+
@page_size = @list_info['page_size']
|
51
|
+
@warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
|
52
|
+
self << resource_class.new(hash[:body], nil)
|
52
53
|
|
53
54
|
hash[key] && hash[key].each do |resource|
|
54
55
|
self << resource_class.new(resource, nil)
|
55
56
|
end
|
56
|
-
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
data/lib/hello_sign/version.rb
CHANGED
data/spec/fixtures/account.json
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"date": "Wed, 28 Feb 2018 21:17:07 GMT",
|
3
|
+
"content-type": "application/json",
|
4
|
+
"content-length": "529",
|
5
|
+
"connection": "close",
|
6
|
+
"set-cookie": "AWSALB=DQqaS5np0cXpMMcb1IanILXEmtw8XOZBceauEE76KNzGzua1fJXaht/7XAaqSTiIQMBIzcTTeq2IJ0/jRmt8iWjVVwlY5JWmgyUV8r3vJaSBjcZ4fMbPNhS8SPmH; Expires=Wed, 07 Mar 2018 21:17:04 GMT; Path=/",
|
7
|
+
"server": "Apache",
|
8
|
+
"strict-transport-security": "max-age=15768000",
|
9
|
+
"x-ratelimit-limit": "2000",
|
10
|
+
"x-ratelimit-limit-remaining": "1998",
|
11
|
+
"x-ratelimit-reset": "1519852625",
|
12
|
+
"access-control-allow-origin": "*",
|
13
|
+
"access-control-allow-headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept",
|
14
|
+
"access-control-allow-methods": "GET, POST, OPTIONS",
|
15
|
+
"user-agent": "HelloSign API",
|
16
|
+
"vary": "Accept-Encoding",
|
17
|
+
"p3p": "CP='NOP3PPOLICY'"
|
18
|
+
}
|
@@ -34,5 +34,12 @@
|
|
34
34
|
"last_reminded_at": 1393389852
|
35
35
|
}],
|
36
36
|
"cc_email_addresses": []
|
37
|
-
}
|
38
|
-
|
37
|
+
},
|
38
|
+
|
39
|
+
"warnings": [
|
40
|
+
{
|
41
|
+
"warning_msg": "No data provided for custom field checkbox, will default to false.",
|
42
|
+
"warning_name": "parameter_missing"
|
43
|
+
}
|
44
|
+
]
|
45
|
+
}
|
@@ -11,6 +11,10 @@ describe HelloSign::Api::Account do
|
|
11
11
|
expect(a_get('/account')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should have response headers' do
|
15
|
+
expect(@account.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'should return current user account' do
|
15
19
|
expect(@account).to be_an HelloSign::Resource::Account
|
16
20
|
end
|
@@ -27,6 +31,10 @@ describe HelloSign::Api::Account do
|
|
27
31
|
expect(a_post('/account/create')).to have_been_made
|
28
32
|
end
|
29
33
|
|
34
|
+
it 'should return response headers' do
|
35
|
+
expect(@account.headers).to_not be_nil
|
36
|
+
end
|
37
|
+
|
30
38
|
it 'should return information about a created account' do
|
31
39
|
expect(@account.email_address).to eql('test@example.com')
|
32
40
|
end
|
@@ -12,6 +12,10 @@ describe HelloSign::Api::ApiApp do
|
|
12
12
|
expect(a_get('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4')).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should return response headers' do
|
16
|
+
expect(@api_app.headers).to_not be_nil
|
17
|
+
end
|
18
|
+
|
15
19
|
it 'should return current user account' do
|
16
20
|
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
17
21
|
end
|
@@ -27,6 +31,10 @@ describe HelloSign::Api::ApiApp do
|
|
27
31
|
expect(a_get('/api_app/list')).to have_been_made
|
28
32
|
end
|
29
33
|
|
34
|
+
it 'should return response headers' do
|
35
|
+
expect(@api_apps.headers).to_not be_nil
|
36
|
+
end
|
37
|
+
|
30
38
|
it 'should return a Resource Array' do
|
31
39
|
expect(@api_apps).to be_an HelloSign::Resource::ResourceArray
|
32
40
|
end
|
@@ -50,6 +58,10 @@ describe HelloSign::Api::ApiApp do
|
|
50
58
|
expect(a_post('/api_app')).to have_been_made
|
51
59
|
end
|
52
60
|
|
61
|
+
it 'should return response headers' do
|
62
|
+
expect(@api_app.headers).to_not be_nil
|
63
|
+
end
|
64
|
+
|
53
65
|
it 'should return an ApiApp' do
|
54
66
|
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
55
67
|
end
|
@@ -69,6 +81,10 @@ describe HelloSign::Api::ApiApp do
|
|
69
81
|
expect(a_post('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4')).to have_been_made
|
70
82
|
end
|
71
83
|
|
84
|
+
it 'should return response headers' do
|
85
|
+
expect(@api_app.headers).to_not be_nil
|
86
|
+
end
|
87
|
+
|
72
88
|
it 'should return an ApiApp' do
|
73
89
|
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
74
90
|
end
|
@@ -12,6 +12,10 @@ describe HelloSign::Api::Embedded do
|
|
12
12
|
expect(a_get("/embedded/sign_url/#{signature_id}")).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should return response headers' do
|
16
|
+
expect(@embedded.headers).to_not be_nil
|
17
|
+
end
|
18
|
+
|
15
19
|
it 'should return a UnclaimedDraft' do
|
16
20
|
expect(@embedded).to be_an HelloSign::Resource::Embedded
|
17
21
|
end
|
@@ -11,6 +11,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
11
11
|
expect(a_get('/signature_request/1')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should return response headers' do
|
15
|
+
expect(@signature_request.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'should return a SignatureRequest' do
|
15
19
|
expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
|
16
20
|
end
|
@@ -26,6 +30,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
26
30
|
expect(a_get('/signature_request/list')).to have_been_made
|
27
31
|
end
|
28
32
|
|
33
|
+
it 'should return response headers' do
|
34
|
+
expect(@signature_requests.headers).to_not be_nil
|
35
|
+
end
|
36
|
+
|
29
37
|
it 'should return a SignatureRequestArray' do
|
30
38
|
expect(@signature_requests).to be_an HelloSign::Resource::ResourceArray
|
31
39
|
end
|
@@ -71,6 +79,14 @@ describe HelloSign::Api::SignatureRequest do
|
|
71
79
|
expect(a_post('/signature_request/remind/1')).to have_been_made
|
72
80
|
end
|
73
81
|
|
82
|
+
it 'should return response headers' do
|
83
|
+
expect(@signature_request.headers).to_not be_nil
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should return response warnings' do
|
87
|
+
expect(@signature_request.warnings).to_not be_nil
|
88
|
+
end
|
89
|
+
|
74
90
|
it 'should return a SignatureRequest' do
|
75
91
|
expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
|
76
92
|
end
|
@@ -153,6 +169,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
153
169
|
it 'should get the correct resource' do
|
154
170
|
expect(a_post('/signature_request/send_with_template')).to have_been_made
|
155
171
|
end
|
172
|
+
|
173
|
+
it 'should return response headers' do
|
174
|
+
expect(@signature_request.headers).to_not be_nil
|
175
|
+
end
|
156
176
|
end
|
157
177
|
|
158
178
|
describe '#create_embedded_signature_request' do
|
@@ -164,6 +184,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
164
184
|
it 'should get the correct resource' do
|
165
185
|
expect(a_post('/signature_request/create_embedded')).to have_been_made
|
166
186
|
end
|
187
|
+
|
188
|
+
it 'should return response headers' do
|
189
|
+
expect(@signature_request.headers).to_not be_nil
|
190
|
+
end
|
167
191
|
end
|
168
192
|
|
169
193
|
describe '#create_embedded_signature_request_with_template' do
|
@@ -175,6 +199,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
175
199
|
it 'should get the correct resource' do
|
176
200
|
expect(a_post('/signature_request/create_embedded_with_template')).to have_been_made
|
177
201
|
end
|
202
|
+
|
203
|
+
it 'should return response headers' do
|
204
|
+
expect(@signature_request.headers).to_not be_nil
|
205
|
+
end
|
178
206
|
end
|
179
207
|
|
180
208
|
describe '#update_signature_request' do
|
@@ -191,6 +219,10 @@ describe HelloSign::Api::SignatureRequest do
|
|
191
219
|
expect(a_post('/signature_request/update/1')).to have_been_made
|
192
220
|
end
|
193
221
|
|
222
|
+
it 'should return response headers' do
|
223
|
+
expect(@signature_request.headers).to_not be_nil
|
224
|
+
end
|
225
|
+
|
194
226
|
it 'should return a Signature Request' do
|
195
227
|
expect(@signature_request).to be_a HelloSign::Resource::SignatureRequest
|
196
228
|
end
|
@@ -11,6 +11,10 @@ describe HelloSign::Api::Team do
|
|
11
11
|
expect(a_get('/team')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should return response headers' do
|
15
|
+
expect(@team.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'should return user\'s team' do
|
15
19
|
expect(@team).to be_an HelloSign::Resource::Team
|
16
20
|
end
|
@@ -26,6 +30,10 @@ describe HelloSign::Api::Team do
|
|
26
30
|
expect(a_post('/team/create')).to have_been_made
|
27
31
|
end
|
28
32
|
|
33
|
+
it 'should return response headers' do
|
34
|
+
expect(@team.headers).to_not be_nil
|
35
|
+
end
|
36
|
+
|
29
37
|
it 'should return information about a created team' do
|
30
38
|
expect(@team.name).to eql('Team HelloSign')
|
31
39
|
end
|
@@ -41,19 +49,12 @@ describe HelloSign::Api::Team do
|
|
41
49
|
expect(a_post('/team')).to have_been_made
|
42
50
|
end
|
43
51
|
|
44
|
-
it 'should return
|
45
|
-
expect(@team.
|
52
|
+
it 'should return response headers' do
|
53
|
+
expect(@team.headers).to_not be_nil
|
46
54
|
end
|
47
|
-
end
|
48
55
|
|
49
|
-
|
50
|
-
|
51
|
-
stub_post('/team/destroy', 'team')
|
52
|
-
@team = HelloSign.destroy_team
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should get the correct resource' do
|
56
|
-
expect(a_post('/team/destroy')).to have_been_made
|
56
|
+
it 'should return information about a updated team' do
|
57
|
+
expect(@team.name).to eql('Team HelloSign')
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
@@ -74,6 +75,10 @@ describe HelloSign::Api::Team do
|
|
74
75
|
@team = HelloSign.add_member_to_team :email_address => 'george@example.com'
|
75
76
|
end
|
76
77
|
|
78
|
+
it 'should return response headers' do
|
79
|
+
expect(@team.headers).to_not be_nil
|
80
|
+
end
|
81
|
+
|
77
82
|
it 'should get the correct resource' do
|
78
83
|
expect(a_post('/team/add_member')).to have_been_made
|
79
84
|
end
|
@@ -85,6 +90,10 @@ describe HelloSign::Api::Team do
|
|
85
90
|
@team = HelloSign.remove_member_from_team :email_address => 'george@example.com'
|
86
91
|
end
|
87
92
|
|
93
|
+
it 'should return response headers' do
|
94
|
+
expect(@team.headers).to_not be_nil
|
95
|
+
end
|
96
|
+
|
88
97
|
it 'should get the correct resource' do
|
89
98
|
expect(a_post('/team/remove_member')).to have_been_made
|
90
99
|
end
|
@@ -11,6 +11,10 @@ describe HelloSign::Api::Template do
|
|
11
11
|
expect(a_get('/template/1')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should return response headers' do
|
15
|
+
expect(@template.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
14
18
|
it 'should return a Template' do
|
15
19
|
expect(@template).to be_an HelloSign::Resource::Template
|
16
20
|
end
|
@@ -26,6 +30,10 @@ describe HelloSign::Api::Template do
|
|
26
30
|
expect(a_get('/template/list')).to have_been_made
|
27
31
|
end
|
28
32
|
|
33
|
+
it 'returns reponse headers' do
|
34
|
+
expect(@template.headers).to_not be_nil
|
35
|
+
end
|
36
|
+
|
29
37
|
it 'should return a ResourceArray' do
|
30
38
|
expect(@template).to be_an HelloSign::Resource::ResourceArray
|
31
39
|
end
|
@@ -53,6 +61,10 @@ describe HelloSign::Api::Template do
|
|
53
61
|
expect(a_post('/template/add_user/1')).to have_been_made
|
54
62
|
end
|
55
63
|
|
64
|
+
it 'should return response headers' do
|
65
|
+
expect(@template.headers).to_not be_nil
|
66
|
+
end
|
67
|
+
|
56
68
|
it 'should return a Template' do
|
57
69
|
expect(@template).to be_an HelloSign::Resource::Template
|
58
70
|
end
|
@@ -68,6 +80,10 @@ describe HelloSign::Api::Template do
|
|
68
80
|
expect(a_post('/template/remove_user/1')).to have_been_made
|
69
81
|
end
|
70
82
|
|
83
|
+
it 'should return response headers' do
|
84
|
+
expect(@template.headers).to_not be_nil
|
85
|
+
end
|
86
|
+
|
71
87
|
it 'should return a Template' do
|
72
88
|
expect(@template).to be_an HelloSign::Resource::Template
|
73
89
|
end
|
@@ -82,6 +98,10 @@ describe HelloSign::Api::Template do
|
|
82
98
|
it 'should get the correct resource' do
|
83
99
|
expect(a_get('/template/files/1')).to have_been_made
|
84
100
|
end
|
101
|
+
|
102
|
+
it 'should return response headers' do
|
103
|
+
expect(@files[:headers]).to_not be_nil
|
104
|
+
end
|
85
105
|
end
|
86
106
|
|
87
107
|
describe '#get_template_files with options' do
|
@@ -94,6 +114,10 @@ describe HelloSign::Api::Template do
|
|
94
114
|
it 'should get the correct resource' do
|
95
115
|
expect(a_get('/template/files/1?get_url=true')).to have_been_made
|
96
116
|
end
|
117
|
+
|
118
|
+
it 'should return response headers' do
|
119
|
+
expect(@files[:headers]).to_not be_nil
|
120
|
+
end
|
97
121
|
end
|
98
122
|
|
99
123
|
describe ':file_type' do
|
@@ -105,6 +129,10 @@ describe HelloSign::Api::Template do
|
|
105
129
|
it 'should get the correct resource' do
|
106
130
|
expect(a_get('/template/files/1?file_type=pdf')).to have_been_made
|
107
131
|
end
|
132
|
+
|
133
|
+
it 'should return response headers' do
|
134
|
+
expect(@files[:headers]).to_not be_nil
|
135
|
+
end
|
108
136
|
end
|
109
137
|
|
110
138
|
describe ':file_type and :get_url' do
|
@@ -116,6 +144,10 @@ describe HelloSign::Api::Template do
|
|
116
144
|
it 'should get the correct resource' do
|
117
145
|
expect(a_get('/template/files/1?file_type=pdf&get_url=true')).to have_been_made
|
118
146
|
end
|
147
|
+
|
148
|
+
it 'should return response headers' do
|
149
|
+
expect(@files[:headers]).to_not be_nil
|
150
|
+
end
|
119
151
|
end
|
120
152
|
end
|
121
153
|
|
@@ -132,5 +164,9 @@ describe HelloSign::Api::Template do
|
|
132
164
|
it 'should get the correct resource' do
|
133
165
|
expect(a_post('/template/update_files/1')).to have_been_made
|
134
166
|
end
|
167
|
+
|
168
|
+
it 'should return response headers' do
|
169
|
+
expect(@template.headers).to_not be_nil
|
170
|
+
end
|
135
171
|
end
|
136
172
|
end
|
@@ -12,6 +12,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
12
12
|
expect(a_post('/unclaimed_draft/create')).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should return response headers' do
|
16
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
17
|
+
end
|
18
|
+
|
15
19
|
it 'should return a UnclaimedDraft' do
|
16
20
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
17
21
|
end
|
@@ -27,6 +31,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
27
31
|
expect(a_post('/unclaimed_draft/create')).to have_been_made
|
28
32
|
end
|
29
33
|
|
34
|
+
it 'should return response headers' do
|
35
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
36
|
+
end
|
37
|
+
|
30
38
|
it 'should return a UnclaimedDraft' do
|
31
39
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
32
40
|
end
|
@@ -45,6 +53,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
45
53
|
expect(a_post('/unclaimed_draft/edit_and_resend/1')).to have_been_made
|
46
54
|
end
|
47
55
|
|
56
|
+
it 'should return response headers' do
|
57
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
58
|
+
end
|
59
|
+
|
48
60
|
it 'should return an UnclaimedDraft response' do
|
49
61
|
expect(@unclaimed_draft).to be_a HelloSign::Resource::UnclaimedDraft
|
50
62
|
end
|
@@ -62,6 +74,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
62
74
|
expect(a_post('/unclaimed_draft/create_embedded')).to have_been_made
|
63
75
|
end
|
64
76
|
|
77
|
+
it 'should return response headers' do
|
78
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
79
|
+
end
|
80
|
+
|
65
81
|
it 'should return a UnclaimedDraft' do
|
66
82
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
67
83
|
end
|
@@ -77,6 +93,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
77
93
|
expect(a_post('/unclaimed_draft/create_embedded')).to have_been_made
|
78
94
|
end
|
79
95
|
|
96
|
+
it 'should return response headers' do
|
97
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
98
|
+
end
|
99
|
+
|
80
100
|
it 'should return a UnclaimedDraft' do
|
81
101
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
82
102
|
end
|
@@ -94,6 +114,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
94
114
|
expect(a_post('/unclaimed_draft/create_embedded_with_template')).to have_been_made
|
95
115
|
end
|
96
116
|
|
117
|
+
it 'should return response headers' do
|
118
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
119
|
+
end
|
120
|
+
|
97
121
|
it 'should return a UnclaimedDraft' do
|
98
122
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
99
123
|
end
|
@@ -109,6 +133,10 @@ describe HelloSign::Api::UnclaimedDraft do
|
|
109
133
|
expect(a_post('/unclaimed_draft/create_embedded_with_template')).to have_been_made
|
110
134
|
end
|
111
135
|
|
136
|
+
it 'should return response headers' do
|
137
|
+
expect(@unclaimed_draft.headers).to_not be_nil
|
138
|
+
end
|
139
|
+
|
112
140
|
it 'should return a UnclaimedDraft' do
|
113
141
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
114
142
|
end
|
@@ -2,12 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe HelloSign::Resource::BaseResource do
|
4
4
|
let(:data){
|
5
|
-
{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
{ :body => {
|
6
|
+
:a => :a1,
|
7
|
+
:b => :b1,
|
8
|
+
:c => { :c1 => :c2 },
|
9
|
+
:d => [:d1, :d2, :d3],
|
10
|
+
:e => [{ :e1 => :e11 }, { :e2 => :e21 }, { :e3 => :e31 }]
|
11
|
+
}
|
11
12
|
}
|
12
13
|
}
|
13
14
|
|
@@ -21,7 +22,7 @@ describe HelloSign::Resource::BaseResource do
|
|
21
22
|
end
|
22
23
|
|
23
24
|
it 'make a hash value into a new HelloSign::Resource::BaseResource' do
|
24
|
-
expect(resource.c).to be_an HelloSign::Resource::BaseResource
|
25
|
+
expect(resource.data["body"].data["c"]).to be_an HelloSign::Resource::BaseResource
|
25
26
|
end
|
26
27
|
|
27
28
|
it 'do not touch array value with basic type' do
|
@@ -29,8 +30,8 @@ describe HelloSign::Resource::BaseResource do
|
|
29
30
|
end
|
30
31
|
|
31
32
|
it 'make a array value with each item is a hash into array of HelloSign::Resource::BaseResource' do
|
32
|
-
expect(resource.e).to be_an Array
|
33
|
-
expect(resource.e[0]).to be_an HelloSign::Resource::BaseResource
|
33
|
+
expect(resource.data["body"].data["e"]).to be_an Array
|
34
|
+
expect(resource.data["body"].data["e"][0]).to be_an HelloSign::Resource::BaseResource
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -38,14 +39,14 @@ describe HelloSign::Resource::BaseResource do
|
|
38
39
|
context 'without key params' do
|
39
40
|
subject(:resource) { HelloSign::Resource::BaseResource.new data }
|
40
41
|
it 'have correct data' do
|
41
|
-
expect(resource.
|
42
|
+
expect(resource.raw_data).to eql(data)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
context '
|
46
|
+
context 'with key params' do
|
46
47
|
subject(:resource) { HelloSign::Resource::BaseResource.new data, :e }
|
47
48
|
it 'have correct data' do
|
48
|
-
expect(resource.
|
49
|
+
expect(resource.raw_data).to eql(data[:body][:e])
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -62,7 +62,7 @@ end
|
|
62
62
|
|
63
63
|
def stub_get(path, fixture, status_code=200)
|
64
64
|
stub_request(:get, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
|
65
|
-
to_return(:body => load_fixture(fixture), :status => status_code)
|
65
|
+
to_return(:headers => load_fixture("headers"), :body => load_fixture(fixture), :status => status_code)
|
66
66
|
end
|
67
67
|
|
68
68
|
def a_get(path)
|
@@ -71,7 +71,7 @@ end
|
|
71
71
|
|
72
72
|
def stub_post(path, fixture, status_code=200)
|
73
73
|
stub_request(:post, "#{HelloSign.end_point}#{HelloSign.api_version}#{path}").
|
74
|
-
to_return(:body => load_fixture(fixture), :status => status_code)
|
74
|
+
to_return(:headers => load_fixture("headers"), :body => load_fixture(fixture), :status => status_code)
|
75
75
|
end
|
76
76
|
|
77
77
|
def stub_post_oauth(path, fixture, status_code=200)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellosign-ruby-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HelloSign
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- spec/fixtures/empty.pdf
|
159
159
|
- spec/fixtures/error.json
|
160
160
|
- spec/fixtures/file.json
|
161
|
+
- spec/fixtures/headers.json
|
161
162
|
- spec/fixtures/nda.pdf
|
162
163
|
- spec/fixtures/signature_request.json
|
163
164
|
- spec/fixtures/signature_requests.json
|
@@ -213,6 +214,7 @@ test_files:
|
|
213
214
|
- spec/fixtures/empty.pdf
|
214
215
|
- spec/fixtures/error.json
|
215
216
|
- spec/fixtures/file.json
|
217
|
+
- spec/fixtures/headers.json
|
216
218
|
- spec/fixtures/nda.pdf
|
217
219
|
- spec/fixtures/signature_request.json
|
218
220
|
- spec/fixtures/signature_requests.json
|