hellosign-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +13 -0
- data/Guardfile +14 -0
- data/LICENSE +21 -0
- data/README.md +112 -0
- data/Rakefile +16 -0
- data/hellosign-api.gemspec +54 -0
- data/lib/hello_sign/.error.rb.swp +0 -0
- data/lib/hello_sign/api/account.rb +78 -0
- data/lib/hello_sign/api/api_app.rb +121 -0
- data/lib/hello_sign/api/bulk_send_job.rb +62 -0
- data/lib/hello_sign/api/embedded.rb +68 -0
- data/lib/hello_sign/api/oauth.rb +95 -0
- data/lib/hello_sign/api/signature_request.rb +691 -0
- data/lib/hello_sign/api/team.rb +107 -0
- data/lib/hello_sign/api/template.rb +227 -0
- data/lib/hello_sign/api/unclaimed_draft.rb +328 -0
- data/lib/hello_sign/api.rb +31 -0
- data/lib/hello_sign/client.rb +372 -0
- data/lib/hello_sign/configuration.rb +78 -0
- data/lib/hello_sign/error.rb +99 -0
- data/lib/hello_sign/resource/account.rb +43 -0
- data/lib/hello_sign/resource/api_app.rb +43 -0
- data/lib/hello_sign/resource/base_resource.rb +73 -0
- data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
- data/lib/hello_sign/resource/embedded.rb +43 -0
- data/lib/hello_sign/resource/resource_array.rb +56 -0
- data/lib/hello_sign/resource/signature_request.rb +43 -0
- data/lib/hello_sign/resource/team.rb +43 -0
- data/lib/hello_sign/resource/template.rb +43 -0
- data/lib/hello_sign/resource/template_draft.rb +44 -0
- data/lib/hello_sign/resource/unclaimed_draft.rb +44 -0
- data/lib/hello_sign/resource.rb +33 -0
- data/lib/hello_sign/version.rb +25 -0
- data/lib/hello_sign.rb +50 -0
- data/lib/hellosign-ruby-sdk.rb +4 -0
- data/spec/fixtures/account.json +15 -0
- data/spec/fixtures/api_app.json +16 -0
- data/spec/fixtures/api_apps.json +43 -0
- data/spec/fixtures/bulk_send_job.json +88 -0
- data/spec/fixtures/bulk_send_jobs.json +22 -0
- data/spec/fixtures/embedded.json +6 -0
- data/spec/fixtures/empty.pdf +0 -0
- data/spec/fixtures/error.json +6 -0
- data/spec/fixtures/file.json +0 -0
- data/spec/fixtures/headers.json +18 -0
- data/spec/fixtures/nda.pdf +0 -0
- data/spec/fixtures/signature_request.json +45 -0
- data/spec/fixtures/signature_requests.json +44 -0
- data/spec/fixtures/team.json +15 -0
- data/spec/fixtures/template.json +53 -0
- data/spec/fixtures/templates.json +59 -0
- data/spec/fixtures/token.json +14 -0
- data/spec/fixtures/unclaimed_draft.json +6 -0
- data/spec/hello_sign/.error_spec.rb.swp +0 -0
- data/spec/hello_sign/api/account_spec.rb +42 -0
- data/spec/hello_sign/api/api_app_spec.rb +104 -0
- data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
- data/spec/hello_sign/api/embedded_spec.rb +23 -0
- data/spec/hello_sign/api/oauth_spec.rb +27 -0
- data/spec/hello_sign/api/signature_request_spec.rb +268 -0
- data/spec/hello_sign/api/team_spec.rb +101 -0
- data/spec/hello_sign/api/template_spec.rb +172 -0
- data/spec/hello_sign/api/unclaimed_draft_spec.rb +145 -0
- data/spec/hello_sign/client_spec.rb +191 -0
- data/spec/hello_sign/error_spec.rb +10 -0
- data/spec/hello_sign/resource/base_resource_spec.rb +53 -0
- data/spec/hello_sign_spec.rb +57 -0
- data/spec/scenarios/uploads_spec.rb +19 -0
- data/spec/spec_helper.rb +104 -0
- metadata +261 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
{
|
2
|
+
"bulk_send_job": {
|
3
|
+
"bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab",
|
4
|
+
"total": 3,
|
5
|
+
"is_creator": true,
|
6
|
+
"created_at": 1536784104
|
7
|
+
},
|
8
|
+
"list_info": {
|
9
|
+
"page": 1,
|
10
|
+
"num_pages": 1,
|
11
|
+
"num_results": 2,
|
12
|
+
"page_size": 20
|
13
|
+
},
|
14
|
+
"signature_requests": [
|
15
|
+
{
|
16
|
+
"signature_request_id": "76cdec91655d6b26e403e8c10c1def40c26510ok",
|
17
|
+
"test_mode": true,
|
18
|
+
"title": "Please sign",
|
19
|
+
"original_title": "Please sign",
|
20
|
+
"subject": "This requires your signature",
|
21
|
+
"message": null,
|
22
|
+
"metadata": {},
|
23
|
+
"is_complete": false,
|
24
|
+
"is_declined": false,
|
25
|
+
"has_error": false,
|
26
|
+
"custom_fields": [],
|
27
|
+
"response_data": [],
|
28
|
+
"signing_url": "https://app.hellosign.com/sign/76cdec91655d6b26e403e8c10c1def40c26510ok",
|
29
|
+
"signing_redirect_url": null,
|
30
|
+
"final_copy_uri": "/v3/signature_request/final_copy/76cdec91655d6b26e403e8c10c1def40c26510ok",
|
31
|
+
"files_url": "https://api.hellosign.com/v3/signature_request/files/76cdec91655d6b26e403e8c10c1def40c26510ok",
|
32
|
+
"details_url": "https://app.hellosign.com/home/manage?guid=76cdec91655d6b26e403e8c10c1def40c26510ok",
|
33
|
+
"requester_email_address": "requester@example.com",
|
34
|
+
"signatures": [
|
35
|
+
{
|
36
|
+
"signature_id": "1ccd835c064c4d7936012840924c0528",
|
37
|
+
"has_pin": false,
|
38
|
+
"signer_email_address": "bulksend1@example.com",
|
39
|
+
"signer_name": "George Signer",
|
40
|
+
"order": null,
|
41
|
+
"status_code": "signed",
|
42
|
+
"signed_at": 1542665401,
|
43
|
+
"last_viewed_at": 1542665391,
|
44
|
+
"last_reminded_at": null,
|
45
|
+
"error": null
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"cc_email_addresses": [],
|
49
|
+
"bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"signature_request_id": "b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
|
53
|
+
"test_mode": true,
|
54
|
+
"title": "Please sign",
|
55
|
+
"original_title": "Please sign",
|
56
|
+
"subject": "This requires your signature",
|
57
|
+
"message": null,
|
58
|
+
"metadata": {},
|
59
|
+
"is_complete": false,
|
60
|
+
"is_declined": false,
|
61
|
+
"has_error": false,
|
62
|
+
"custom_fields": [],
|
63
|
+
"response_data": [],
|
64
|
+
"signing_url": "https://app.hellosign.com/sign/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
|
65
|
+
"signing_redirect_url": null,
|
66
|
+
"final_copy_uri": "/v3/signature_request/final_copy/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
|
67
|
+
"files_url": "https://api.hellosign.com/v3/signature_request/files/b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
|
68
|
+
"details_url": "https://app.hellosign.com/home/manage?guid=b2c5c3dfc5ac596e02b7c615b59314b7948abc88",
|
69
|
+
"requester_email_address": "requester@example.com",
|
70
|
+
"signatures": [
|
71
|
+
{
|
72
|
+
"signature_id": "2ad95d666374efcfb2bf299855591738",
|
73
|
+
"has_pin": false,
|
74
|
+
"signer_email_address": "bulksend2@example.com",
|
75
|
+
"signer_name": "Mary Signer",
|
76
|
+
"order": null,
|
77
|
+
"status_code": "awaiting_signature",
|
78
|
+
"signed_at": null,
|
79
|
+
"last_viewed_at": null,
|
80
|
+
"last_reminded_at": null,
|
81
|
+
"error": null
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"cc_email_addresses": [],
|
85
|
+
"bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"list_info": {
|
3
|
+
"page": 1,
|
4
|
+
"num_pages": 1,
|
5
|
+
"num_results": 2,
|
6
|
+
"page_size": 20
|
7
|
+
},
|
8
|
+
"bulk_send_jobs": [
|
9
|
+
{
|
10
|
+
"bulk_send_job_id": "af299494bdcad318b4856aa34aa263dbdaaee9ab",
|
11
|
+
"total": 2,
|
12
|
+
"is_creator": true,
|
13
|
+
"created_at": 1542664362
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"bulk_send_job_id": "d74f731b24b00fe6a61083bcff11d0aepl5bf927",
|
17
|
+
"total": 3,
|
18
|
+
"is_creator": true,
|
19
|
+
"created_at": 1542655564
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
Binary file
|
File without changes
|
@@ -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
|
+
}
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"signature_request": {
|
3
|
+
"signature_request_id": "1",
|
4
|
+
"title": "title",
|
5
|
+
"original_title": "original_title",
|
6
|
+
"subject": "subject",
|
7
|
+
"message": "message",
|
8
|
+
"test_mode": false,
|
9
|
+
"is_complete": true,
|
10
|
+
"has_error": false,
|
11
|
+
"custom_fields": [],
|
12
|
+
"response_data": [{
|
13
|
+
"name": "name",
|
14
|
+
"value": "value",
|
15
|
+
"type": "signature",
|
16
|
+
"api_id": "api_id",
|
17
|
+
"signature_id": "signature_id"
|
18
|
+
}],
|
19
|
+
"signing_url": "https://example.com/signing_url",
|
20
|
+
"signing_redirect_url": "https://example.com/signing_redirect_url",
|
21
|
+
"final_copy_uri": "/v3/final_copy_url",
|
22
|
+
"files_url": "https://example.com/file_url",
|
23
|
+
"details_url": "https://example.com/details_url",
|
24
|
+
"requester_email_address": "requester_email_address@example.com",
|
25
|
+
"signatures": [{
|
26
|
+
"signature_id": "signature_id",
|
27
|
+
"has_pin": false,
|
28
|
+
"signer_email_address": "signer_email_address@example.com",
|
29
|
+
"signer_name": "signer_name",
|
30
|
+
"order": 1,
|
31
|
+
"status_code": "signed",
|
32
|
+
"signed_at": 1393389891,
|
33
|
+
"last_viewed_at": 1393389853,
|
34
|
+
"last_reminded_at": 1393389852
|
35
|
+
}],
|
36
|
+
"cc_email_addresses": []
|
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
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"list_info": {
|
3
|
+
"page": 1,
|
4
|
+
"num_pages": 1,
|
5
|
+
"num_results": 1,
|
6
|
+
"page_size": 20
|
7
|
+
},
|
8
|
+
"signature_requests": [{
|
9
|
+
"signature_request_id": "1",
|
10
|
+
"title": "title",
|
11
|
+
"original_title": "original_title",
|
12
|
+
"subject": "subject",
|
13
|
+
"message": "message",
|
14
|
+
"test_mode": false,
|
15
|
+
"is_complete": true,
|
16
|
+
"has_error": false,
|
17
|
+
"custom_fields": [],
|
18
|
+
"response_data": [{
|
19
|
+
"name": "name",
|
20
|
+
"value": "value",
|
21
|
+
"type": "signature",
|
22
|
+
"api_id": "api_id",
|
23
|
+
"signature_id": "signature_id"
|
24
|
+
}],
|
25
|
+
"signing_url": "https://example.com/signing_url",
|
26
|
+
"signing_redirect_url": "https://example.com/signing_redirect_url",
|
27
|
+
"final_copy_uri": "/v3/final_copy_url",
|
28
|
+
"files_url": "https://example.com/file_url",
|
29
|
+
"details_url": "https://example.com/details_url",
|
30
|
+
"requester_email_address": "requester_email_address@example.com",
|
31
|
+
"signatures": [{
|
32
|
+
"signature_id": "signature_id",
|
33
|
+
"has_pin": false,
|
34
|
+
"signer_email_address": "signer_email_address@example.com",
|
35
|
+
"signer_name": "signer_name",
|
36
|
+
"order": 1,
|
37
|
+
"status_code": "signed",
|
38
|
+
"signed_at": 1393389891,
|
39
|
+
"last_viewed_at": 1393389853,
|
40
|
+
"last_reminded_at": 1393389852
|
41
|
+
}],
|
42
|
+
"cc_email_addresses": []
|
43
|
+
}]
|
44
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"team": {
|
3
|
+
"name": "Team HelloSign",
|
4
|
+
"accounts": [{
|
5
|
+
"account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
|
6
|
+
"email_address": "me@example.com",
|
7
|
+
"role_code": "a"
|
8
|
+
}, {
|
9
|
+
"account_id": "d3d3d7b98d80b67d07740df7cdfd1f49fa8e2b82",
|
10
|
+
"email_address": "teammate@example.com",
|
11
|
+
"role_code": "m"
|
12
|
+
}],
|
13
|
+
"invited_accounts": []
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"template": {
|
3
|
+
"template_id": "a364138e0d8ae6393aa425a8ec64715580f3748b",
|
4
|
+
"title": "bitcoin",
|
5
|
+
"message": "Hello, bitcoin pdf here",
|
6
|
+
"is_creator": true,
|
7
|
+
"can_edit": true,
|
8
|
+
"signer_roles": [{
|
9
|
+
"name": "Client",
|
10
|
+
"order": null
|
11
|
+
}],
|
12
|
+
"cc_roles": [],
|
13
|
+
"documents": [{
|
14
|
+
"index": "0",
|
15
|
+
"name": "bitcoin.pdf",
|
16
|
+
"custom_fields": [],
|
17
|
+
"form_fields": [{
|
18
|
+
"name": "",
|
19
|
+
"type": "signature",
|
20
|
+
"signer": "1",
|
21
|
+
"x": 501,
|
22
|
+
"y": 7498,
|
23
|
+
"width": 120,
|
24
|
+
"height": 30,
|
25
|
+
"required": true,
|
26
|
+
"api_id": "a1ca72_9"
|
27
|
+
}]
|
28
|
+
}],
|
29
|
+
"custom_fields": [],
|
30
|
+
"named_form_fields": [{
|
31
|
+
"name": "",
|
32
|
+
"type": "signature",
|
33
|
+
"signer": "1",
|
34
|
+
"x": 501,
|
35
|
+
"y": 7498,
|
36
|
+
"width": 120,
|
37
|
+
"height": 30,
|
38
|
+
"required": true,
|
39
|
+
"api_id": "a1ca72_9"
|
40
|
+
}],
|
41
|
+
"accounts": [{
|
42
|
+
"account_id": "a82bbf8a2fb928f239e2bd59df50e23b82b3eedd",
|
43
|
+
"email_address": "testuser@example.com",
|
44
|
+
"is_paid_hs": false,
|
45
|
+
"is_paid_hf": false,
|
46
|
+
"quotas": {
|
47
|
+
"templates_left": 0,
|
48
|
+
"documents_left": 3,
|
49
|
+
"api_signature_requests_left": 0
|
50
|
+
}
|
51
|
+
}]
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
{
|
2
|
+
"list_info": {
|
3
|
+
"page": 1,
|
4
|
+
"num_pages": 1,
|
5
|
+
"num_results": 1,
|
6
|
+
"page_size": 20
|
7
|
+
},
|
8
|
+
"templates": [{
|
9
|
+
"template_id": "a364138e0d8ae6393aa425a8ec64715580f3748b",
|
10
|
+
"title": "bitcoin",
|
11
|
+
"message": "Hello, bitcoin pdf here",
|
12
|
+
"is_creator": true,
|
13
|
+
"can_edit": true,
|
14
|
+
"signer_roles": [{
|
15
|
+
"name": "Client",
|
16
|
+
"order": null
|
17
|
+
}],
|
18
|
+
"cc_roles": [],
|
19
|
+
"documents": [{
|
20
|
+
"index": "0",
|
21
|
+
"name": "bitcoin.pdf",
|
22
|
+
"custom_fields": [],
|
23
|
+
"form_fields": [{
|
24
|
+
"name": "",
|
25
|
+
"type": "signature",
|
26
|
+
"signer": "1",
|
27
|
+
"x": 501,
|
28
|
+
"y": 7498,
|
29
|
+
"width": 120,
|
30
|
+
"height": 30,
|
31
|
+
"required": true,
|
32
|
+
"api_id": "a1ca72_9"
|
33
|
+
}]
|
34
|
+
}],
|
35
|
+
"custom_fields": [],
|
36
|
+
"named_form_fields": [{
|
37
|
+
"name": "",
|
38
|
+
"type": "signature",
|
39
|
+
"signer": "1",
|
40
|
+
"x": 501,
|
41
|
+
"y": 7498,
|
42
|
+
"width": 120,
|
43
|
+
"height": 30,
|
44
|
+
"required": true,
|
45
|
+
"api_id": "a1ca72_9"
|
46
|
+
}],
|
47
|
+
"accounts": [{
|
48
|
+
"account_id": "a82bbf8a2fb928f239e2bd59df50e23b82b3eedd",
|
49
|
+
"email_address": "testuser@example.com",
|
50
|
+
"is_paid_hs": false,
|
51
|
+
"is_paid_hf": false,
|
52
|
+
"quotas": {
|
53
|
+
"templates_left": 0,
|
54
|
+
"documents_left": 3,
|
55
|
+
"api_signature_requests_left": 0
|
56
|
+
}
|
57
|
+
}]
|
58
|
+
}]
|
59
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"account": {
|
3
|
+
"account_id": "b4680b45053c7601ca1eee3b126eca6b2b0a0219",
|
4
|
+
"email_address": "jill@example.com",
|
5
|
+
"callback_url": null,
|
6
|
+
"role_code": null
|
7
|
+
},
|
8
|
+
"oauth_data": {
|
9
|
+
"access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
|
10
|
+
"token_type": "Bearer",
|
11
|
+
"refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
|
12
|
+
"expires_in": 86400
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"unclaimed_draft": {
|
3
|
+
"claim_url": "https:\/\/www.hellosign.com\/send\/resendDocs?root_snapshot_guids[]=7f967b7d06e154394eab693febedf61e8ebe49eb&snapshot_access_guids[]=fb848631&root_snapshot_guids[]=7aedaf31e12edf9f2672a0b2ddf028aca670e101&snapshot_access_guids[]=f398ef87",
|
4
|
+
"signing_redirect_url": null
|
5
|
+
}
|
6
|
+
}
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HelloSign::Api::Account do
|
4
|
+
describe '#get_account' do
|
5
|
+
before do
|
6
|
+
stub_get('/account', 'account')
|
7
|
+
@account = HelloSign.get_account
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should get the correct resource' do
|
11
|
+
expect(a_get('/account')).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have response headers' do
|
15
|
+
expect(@account.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return current user account' do
|
19
|
+
expect(@account).to be_an HelloSign::Resource::Account
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#create_account' do
|
24
|
+
before do
|
25
|
+
stub_post('/account/create', 'account')
|
26
|
+
@body = { email_address: 'test@example.com' }
|
27
|
+
@account = HelloSign.create_account @body
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should get the correct resource' do
|
31
|
+
expect(a_post('/account/create')).to have_been_made
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should return response headers' do
|
35
|
+
expect(@account.headers).to_not be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return information about a created account' do
|
39
|
+
expect(@account.email_address).to eql('test@example.com')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HelloSign::Api::ApiApp do
|
4
|
+
|
5
|
+
describe '#get_api_app' do
|
6
|
+
before do
|
7
|
+
stub_get('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4', 'api_app')
|
8
|
+
@api_app = HelloSign.get_api_app :client_id => '5e365c014bea2e9a05a9d0834f3e7ca4'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should get the correct resource' do
|
12
|
+
expect(a_get('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4')).to have_been_made
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return response headers' do
|
16
|
+
expect(@api_app.headers).to_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return current user account' do
|
20
|
+
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#list_api_apps' do
|
25
|
+
before do
|
26
|
+
stub_get('/api_app/list', 'api_apps')
|
27
|
+
@api_apps = HelloSign.get_api_apps({})
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should get the correct resource' do
|
31
|
+
expect(a_get('/api_app/list')).to have_been_made
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should return response headers' do
|
35
|
+
expect(@api_apps.headers).to_not be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return a Resource Array' do
|
39
|
+
expect(@api_apps).to be_an HelloSign::Resource::ResourceArray
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'each of Array is an ApiApp' do
|
43
|
+
expect(@api_apps[0]).to be_an HelloSign::Resource::ApiApp
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#create_api_app' do
|
48
|
+
before do
|
49
|
+
stub_post('/api_app', 'api_app')
|
50
|
+
@api_app = HelloSign.create_api_app(
|
51
|
+
:name => 'Herbert App',
|
52
|
+
:domain => 'herbert.com',
|
53
|
+
:white_labeling_options => {"primary_button_color":"#00b3e6","primary_button_text_color":"#ffffff"}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should get the correct resource' do
|
58
|
+
expect(a_post('/api_app')).to have_been_made
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should return response headers' do
|
62
|
+
expect(@api_app.headers).to_not be_nil
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should return an ApiApp' do
|
66
|
+
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#update_api_app' do
|
71
|
+
before do
|
72
|
+
stub_post('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4', 'api_app')
|
73
|
+
@api_app = HelloSign.update_api_app(
|
74
|
+
:client_id => '5e365c014bea2e9a05a9d0834f3e7ca4',
|
75
|
+
:name => 'Herbert App',
|
76
|
+
:domain => 'herbert.com'
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should get the correct resource' do
|
81
|
+
expect(a_post('/api_app/5e365c014bea2e9a05a9d0834f3e7ca4')).to have_been_made
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should return response headers' do
|
85
|
+
expect(@api_app.headers).to_not be_nil
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should return an ApiApp' do
|
89
|
+
expect(@api_app).to be_an HelloSign::Resource::ApiApp
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#delete_api_app' do
|
94
|
+
before do
|
95
|
+
stub_delete('/api_app/1', 'api_app')
|
96
|
+
@api_app = HelloSign.delete_api_app(:client_id => '1')
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should get the correct resource' do
|
100
|
+
expect(a_delete('/api_app/1')).to have_been_made
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HelloSign::Api::BulkSendJob do
|
4
|
+
describe '#get_bulk_send_job' do
|
5
|
+
before do
|
6
|
+
stub_get('/bulk_send_job/1', 'bulk_send_job')
|
7
|
+
@bulk_send = HelloSign.get_bulk_send_job :bulk_send_job_id => 1
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should get the correct resource' do
|
11
|
+
expect(a_get('/bulk_send_job/1')).to have_been_made
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return response headers' do
|
15
|
+
expect(@bulk_send.headers).to_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return a Bulk Send Job' do
|
19
|
+
expect(@bulk_send).to be_an HelloSign::Resource::BulkSendJob
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#get_bulk_send_jobs' do
|
24
|
+
before do
|
25
|
+
stub_get('/bulk_send_job/list', 'bulk_send_jobs')
|
26
|
+
@bulk_send_jobs = HelloSign.get_bulk_send_jobs({})
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should get the correct resource' do
|
30
|
+
expect(a_get('/bulk_send_job/list')).to have_been_made
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns reponse headers' do
|
34
|
+
expect(@bulk_send_jobs.headers).to_not be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should return a ResourceArray' do
|
38
|
+
expect(@bulk_send_jobs).to be_an HelloSign::Resource::ResourceArray
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'each of Array is a BulkSendJob' do
|
42
|
+
expect(@bulk_send_jobs[0]).to be_an HelloSign::Resource::BulkSendJob
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should return list_info as a BaseResource in results' do
|
46
|
+
expect(@bulk_send_jobs[0].list_info).to be_an HelloSign::Resource::BaseResource
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return page numbers as an integer' do
|
50
|
+
expect(@bulk_send_jobs[0].list_info.page).to be_an Integer
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HelloSign::Api::Embedded do
|
4
|
+
describe '#get_embedded_sign_url' do
|
5
|
+
let(:signature_id) { '50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b' }
|
6
|
+
before do
|
7
|
+
stub_get("/embedded/sign_url/#{signature_id}", 'embedded')
|
8
|
+
@embedded = HelloSign.get_embedded_sign_url :signature_id => signature_id
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should get the correct resource' do
|
12
|
+
expect(a_get("/embedded/sign_url/#{signature_id}")).to have_been_made
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return response headers' do
|
16
|
+
expect(@embedded.headers).to_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return a UnclaimedDraft' do
|
20
|
+
expect(@embedded).to be_an HelloSign::Resource::Embedded
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HelloSign::Api::Account do
|
4
|
+
describe '#get_oauth_token' do
|
5
|
+
context 'when successful request' do
|
6
|
+
before do
|
7
|
+
stub_post_oauth('/oauth/token', 'token')
|
8
|
+
@oauth_info = HelloSign.get_oauth_token :state => 'state', :code => 'code'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should get the correct resource' do
|
12
|
+
expect(a_post_oauth('/oauth/token')).to have_been_made
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#refresh_oauth_token' do
|
18
|
+
before do
|
19
|
+
stub_post_oauth('/oauth/token', 'token')
|
20
|
+
@oauth_info = HelloSign.refresh_oauth_token refresh_token: 'oauth_token'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should get the correct resource' do
|
24
|
+
expect(a_post_oauth('/oauth/token')).to have_been_made
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|