hellosign-ruby-sdk 3.7.5 → 3.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/lib/hello_sign.rb +7 -12
- data/lib/hello_sign/api.rb +1 -2
- data/lib/hello_sign/api/account.rb +17 -30
- data/lib/hello_sign/api/api_app.rb +27 -25
- data/lib/hello_sign/api/bulk_send_job.rb +62 -0
- data/lib/hello_sign/api/embedded.rb +17 -23
- data/lib/hello_sign/api/oauth.rb +26 -34
- data/lib/hello_sign/api/signature_request.rb +370 -261
- data/lib/hello_sign/api/team.rb +21 -26
- data/lib/hello_sign/api/template.rb +79 -70
- data/lib/hello_sign/api/unclaimed_draft.rb +193 -142
- data/lib/hello_sign/client.rb +58 -22
- data/lib/hello_sign/configuration.rb +3 -7
- data/lib/hello_sign/error.rb +2 -3
- data/lib/hello_sign/resource.rb +1 -2
- data/lib/hello_sign/resource/account.rb +3 -6
- data/lib/hello_sign/resource/api_app.rb +3 -6
- data/lib/hello_sign/resource/base_resource.rb +5 -9
- data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
- data/lib/hello_sign/resource/embedded.rb +7 -10
- data/lib/hello_sign/resource/resource_array.rb +7 -10
- data/lib/hello_sign/resource/signature_request.rb +6 -9
- data/lib/hello_sign/resource/team.rb +3 -6
- data/lib/hello_sign/resource/template.rb +5 -8
- data/lib/hello_sign/resource/template_draft.rb +4 -7
- data/lib/hello_sign/resource/unclaimed_draft.rb +5 -10
- data/lib/hello_sign/version.rb +1 -3
- data/spec/fixtures/api_app.json +10 -10
- data/spec/fixtures/bulk_send_job.json +88 -0
- data/spec/fixtures/bulk_send_jobs.json +22 -0
- data/spec/hello_sign/api/account_spec.rb +1 -1
- data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
- data/spec/hello_sign_spec.rb +2 -4
- data/spec/spec_helper.rb +0 -2
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 12855d1404739ede27d4378f949777d44c2cc425d057f91a004307e2b6ee589b
|
4
|
+
data.tar.gz: 0627a91e9970010d293cc0bcc995a59d0f518d3e770d9c7953c2bf64c918cf00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f47affb3dc733ce976a2104fd445df70c0e26f77be073ca4970b6b84d332f4aa37db8fc3f556155acaed7416f875568c91d6e64a34dcf42e2451172077b127fe
|
7
|
+
data.tar.gz: eda4fe3fd0cbf83388b7c5a905bacda787c317098c2d850f0a839cd67517cc01b27e11bb7f83be965901552a582896b64ce13d68ea70319fbd38338cda16391d
|
data/README.md
CHANGED
@@ -40,12 +40,12 @@ my_account = HelloSign.get_account
|
|
40
40
|
my_signature_requests = HelloSign.get_signature_requests
|
41
41
|
|
42
42
|
# view a specific signature request
|
43
|
-
signature_request = HelloSign.get_signature_request :
|
43
|
+
signature_request = HelloSign.get_signature_request signature_request_id: '42383e7327eda33f4b8b91217cbe95408cc1285f'
|
44
44
|
```
|
45
45
|
|
46
46
|
If you need to authenticate for multiple users and you want a separated client for them, you can run:
|
47
47
|
```ruby
|
48
|
-
client2 = HelloSign::Client.new :
|
48
|
+
client2 = HelloSign::Client.new api_key: 'your_user_api_key'
|
49
49
|
user_account = client2.get_account
|
50
50
|
```
|
51
51
|
### Specifying files
|
data/lib/hello_sign.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,7 +19,6 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
require 'hello_sign/version'
|
26
24
|
require 'hello_sign/configuration'
|
@@ -28,21 +26,18 @@ require 'hello_sign/client'
|
|
28
26
|
|
29
27
|
module HelloSign
|
30
28
|
extend Configuration
|
31
|
-
|
32
|
-
#
|
33
|
-
# @param
|
34
|
-
# @param
|
35
|
-
# @param
|
36
|
-
#
|
29
|
+
|
30
|
+
# If HelloSign module doesn't respond to method, then delegates it to HelloSign::Client
|
31
|
+
# @param method [Symbol] method name
|
32
|
+
# @param *args [Array] arguments passed into the method
|
33
|
+
# @param &block [Block] a block passed into the method
|
37
34
|
def self.method_missing(method, *args, &block)
|
38
35
|
return super unless client.respond_to?(method)
|
39
36
|
client.send(method, *args, &block)
|
40
37
|
end
|
41
38
|
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# @param method [Symbol] method name
|
45
|
-
#
|
39
|
+
# If HelloSign module doesn't respond to method, asks HelloSign::Client whether it responded or not
|
40
|
+
# @param method [Symbol] method name
|
46
41
|
def self.respond_to?(method, include_all=false)
|
47
42
|
return super || client.respond_to?(method)
|
48
43
|
end
|
data/lib/hello_sign/api.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,7 +19,6 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
require 'hello_sign/api/account'
|
26
24
|
require 'hello_sign/api/embedded'
|
@@ -30,3 +28,4 @@ require 'hello_sign/api/team'
|
|
30
28
|
require 'hello_sign/api/unclaimed_draft'
|
31
29
|
require 'hello_sign/api/oauth'
|
32
30
|
require 'hello_sign/api/api_app'
|
31
|
+
require 'hello_sign/api/bulk_send_job'
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,71 +19,59 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
module HelloSign
|
26
24
|
module Api
|
27
|
-
|
28
|
-
#
|
29
25
|
# Contains all the API calls for the Account resource.
|
30
26
|
# Take a look at our API Documentation on the Account resource (https://app.hellosign.com/api/reference#Account)
|
31
27
|
# for more information about this.
|
32
28
|
#
|
33
29
|
# @author [hellosign]
|
34
|
-
|
30
|
+
|
35
31
|
module Account
|
36
|
-
|
32
|
+
|
37
33
|
# Returns the current user's account information.
|
38
34
|
#
|
39
|
-
# @return [HelloSign::Resource::Account]
|
35
|
+
# @return [HelloSign::Resource::Account] Current user's Account
|
40
36
|
#
|
41
37
|
# @example
|
42
38
|
# account = @client.get_account
|
43
|
-
#
|
44
39
|
def get_account
|
45
40
|
HelloSign::Resource::Account.new get('/account')
|
46
41
|
end
|
47
42
|
|
48
|
-
#
|
49
|
-
# Creates a new HelloSign account. The user will still need to confirm the email address
|
43
|
+
# Creates a new HelloSign account. The user will need to confirm the email address
|
50
44
|
# to complete the creation process.
|
51
|
-
#
|
52
|
-
# Note: This request does not require authentication.
|
53
|
-
#
|
54
45
|
# @option opts [String] email_address New user's email address
|
55
46
|
#
|
56
|
-
# @return [HelloSign::Resource::Account] New user's
|
47
|
+
# @return [HelloSign::Resource::Account] New user's Account
|
57
48
|
#
|
58
49
|
# @example
|
59
|
-
# account = @client.create_account :
|
60
|
-
#
|
50
|
+
# account = @client.create_account email_address: 'newuser@example.com'
|
61
51
|
def create_account(opts)
|
62
|
-
HelloSign::Resource::Account.new post('/account/create', :
|
52
|
+
HelloSign::Resource::Account.new post('/account/create', body: opts)
|
63
53
|
end
|
64
54
|
|
55
|
+
# Updates the current user's Account Callback URL.
|
56
|
+
# @option opts [String] callback_url New callback URL
|
65
57
|
#
|
66
|
-
#
|
67
|
-
# @option opts [String] callback_url New user's callback url
|
68
|
-
#
|
69
|
-
# @return [HelloSign::Resource::Account] Updated user's account information
|
58
|
+
# @return [HelloSign::Resource::Account] Updated Account
|
70
59
|
#
|
71
60
|
# @example
|
72
|
-
# account = @client.update_account :
|
73
|
-
#
|
61
|
+
# account = @client.update_account callback_url: 'https://www.example.com/callback'
|
74
62
|
def update_account(opts)
|
75
|
-
HelloSign::Resource::Account.new post('/account', :
|
63
|
+
HelloSign::Resource::Account.new post('/account', body: opts)
|
76
64
|
end
|
77
65
|
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# @option opts [String] email_address user email
|
66
|
+
# Checks whether an Account exists
|
67
|
+
# @option opts [String] email_address User's email address
|
81
68
|
#
|
82
69
|
# @return [Bool] true if exists, else false
|
83
|
-
# @example
|
84
|
-
# account = @client.verify :email_address => 'newuser@example.com'
|
85
70
|
#
|
71
|
+
# @example
|
72
|
+
# account = @client.verify email_address: 'newuser@example.com'
|
86
73
|
def verify(opts)
|
87
|
-
post('/account/verify', :
|
74
|
+
post('/account/verify', body: opts).empty? ? false : true
|
88
75
|
end
|
89
76
|
end
|
90
77
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,42 +19,36 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
module HelloSign
|
26
24
|
module Api
|
27
|
-
#
|
28
25
|
# Contains all the API calls for the ApiApp resource.
|
29
|
-
# Take a look at our API Documentation
|
26
|
+
# Take a look at our API Documentation on ApiApps (https://app.hellosign.com/api/reference#ApiApp)
|
30
27
|
# for more information about this.
|
31
28
|
#
|
32
29
|
# @author [hellosign]
|
33
|
-
|
30
|
+
|
34
31
|
module ApiApp
|
35
32
|
|
36
|
-
#
|
37
|
-
# Retrieves information about a specific API App by a given ID
|
33
|
+
# Retrieves an ApiApp with a given ID
|
38
34
|
# @option opts [String] client_id The Client ID of the ApiApp.
|
39
35
|
#
|
40
|
-
# @return [HelloSign::Resource::ApiApp]
|
36
|
+
# @return [HelloSign::Resource::ApiApp]
|
41
37
|
#
|
42
38
|
# @example
|
43
|
-
# app = @client.get_api_app :
|
44
|
-
#
|
39
|
+
# app = @client.get_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
|
45
40
|
def get_api_app(opts)
|
46
41
|
HelloSign::Resource::ApiApp.new get("/api_app/#{opts[:client_id]}")
|
47
42
|
end
|
48
43
|
|
49
|
-
#
|
50
|
-
# Returns a list of ApiApps that you currently have access to on your account
|
44
|
+
# Returns a list of ApiApps that your Account can access.
|
51
45
|
# @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
|
52
46
|
# @option opts [Integer] page_size Determines the number of ApiApps returned per page. Defaults to 20. (optional)
|
53
47
|
#
|
54
48
|
# @return [HelloSign::Resource::ResourceArray]
|
55
49
|
#
|
56
50
|
# @example
|
57
|
-
# apps = @client.get_api_apps :
|
58
|
-
#
|
51
|
+
# apps = @client.get_api_apps page: 1
|
59
52
|
def get_api_apps(opts={})
|
60
53
|
path = '/api_app/list'
|
61
54
|
path += opts[:page] ? "?page=#{opts[:page]}" : ''
|
@@ -63,8 +56,7 @@ module HelloSign
|
|
63
56
|
HelloSign::Resource::ResourceArray.new get(path, opts), 'api_apps', HelloSign::Resource::ApiApp
|
64
57
|
end
|
65
58
|
|
66
|
-
#
|
67
|
-
# Creates a new API Application on your account
|
59
|
+
# Creates a new ApiApp on your Account
|
68
60
|
# @option opts [String] name The name assigned to the ApiApp.
|
69
61
|
# @option opts [String] domain The domain associated with the ApiApp.
|
70
62
|
# @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
|
@@ -74,16 +66,20 @@ module HelloSign
|
|
74
66
|
# @option opts [String<Hash>] white_labeling_options Object with elements and values serialized to a string to customize the signer page, if available in the API subscription. (optional)
|
75
67
|
# @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
|
76
68
|
#
|
77
|
-
# @return [HelloSign::Resource::ApiApp] newly created ApiApp
|
69
|
+
# @return [HelloSign::Resource::ApiApp] newly created ApiApp
|
78
70
|
#
|
79
71
|
# @example
|
80
|
-
# app = @client.create_api_app
|
72
|
+
# app = @client.create_api_app(
|
73
|
+
# name: 'My Production App',
|
74
|
+
# domain: 'example.com',
|
75
|
+
# 'oauth[callback_url]': 'https://example.com/oauth',
|
76
|
+
# 'oauth[scopes]': 'basic_account_info,request_signature'
|
77
|
+
# )
|
81
78
|
def create_api_app(opts)
|
82
|
-
HelloSign::Resource::ApiApp.new post('/api_app', :
|
79
|
+
HelloSign::Resource::ApiApp.new post('/api_app', body: opts)
|
83
80
|
end
|
84
81
|
|
85
|
-
#
|
86
|
-
# Updates settings for a specific ApiApp on your account
|
82
|
+
# Updates the ApiApp settings.
|
87
83
|
# @option opts [String] client_id The Client ID of the ApiApp you want to update.
|
88
84
|
# @option opts [String] name The name assigned to the ApiApp. (optional)
|
89
85
|
# @option opts [String] domain The domain associated with the ApiApp. (optional)
|
@@ -97,19 +93,25 @@ module HelloSign
|
|
97
93
|
# @return [HelloSign::Resource::ApiApp] an ApiApp object
|
98
94
|
#
|
99
95
|
# @example
|
100
|
-
# app = @client.update_api_app
|
96
|
+
# app = @client.update_api_app(
|
97
|
+
# name: 'My Newly Renamed App',
|
98
|
+
# domain: 'example2.com',
|
99
|
+
# 'oauth[callback_url]': 'https://example2.com/oauth',
|
100
|
+
# 'oauth[scopes]': 'basic_account_info, request_signature'
|
101
|
+
# )
|
101
102
|
def update_api_app(opts)
|
102
103
|
id = opts.delete(:client_id)
|
103
104
|
path = '/api_app/' + id
|
104
|
-
HelloSign::Resource::ApiApp.new post(path, :
|
105
|
+
HelloSign::Resource::ApiApp.new post(path, body: opts)
|
105
106
|
end
|
106
107
|
|
107
|
-
#
|
108
108
|
# Deletes an ApiApp. Only available for ApiApps you own.
|
109
109
|
# @option opts [String] client_id The Client ID of the ApiApp you want to delete.
|
110
110
|
#
|
111
|
+
# @return [HTTP::Status] 204 No Content
|
112
|
+
#
|
111
113
|
# @example
|
112
|
-
#
|
114
|
+
# response = @client.delete_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
|
113
115
|
def delete_api_app(opts)
|
114
116
|
path = '/api_app/' + opts[:client_id]
|
115
117
|
delete(path)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 hellosign.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
module HelloSign
|
24
|
+
module Api
|
25
|
+
# Contains all the API calls for the BulkSendJob resource.
|
26
|
+
# Take a look at our API Documentation on BulkSendJobs (https://app.hellosign.com/api/reference#BulkSendJob)
|
27
|
+
# for more information about this.
|
28
|
+
#
|
29
|
+
# @author [hellosign]
|
30
|
+
|
31
|
+
module BulkSendJob
|
32
|
+
|
33
|
+
# Retrieves a BulkSendJob with a given ID
|
34
|
+
# @option opts [String] bulk_send_job_id The BulkSendJob ID to retrieve.
|
35
|
+
#
|
36
|
+
# @return [HelloSign::Resource::BulkSendJob]
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# bulk_send_job = @client.get_bulk_send_job bulk_send_job_id: 'af299494bdcad318b4856aa34aa263dbdaaee9ab'
|
40
|
+
def get_bulk_send_job(opts)
|
41
|
+
path = "/bulk_send_job/#{opts[:bulk_send_job_id]}"
|
42
|
+
|
43
|
+
HelloSign::Resource::BulkSendJob.new get(path)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns a list of BulkSendJobs that your Account can access.
|
47
|
+
# @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
|
48
|
+
# @option opts [Integer] page_size Determines the number of BulkSendJobs returned per page. Defaults to 20. (optional)
|
49
|
+
#
|
50
|
+
# @return [HelloSign::Resource::ResourceArray]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# bulk_send_jobs = @client.get_bulk_send_jobs page: 1
|
54
|
+
def get_bulk_send_jobs(opts={})
|
55
|
+
path = '/bulk_send_job/list'
|
56
|
+
path += opts[:page] ? "?page=#{opts[:page]}" : ''
|
57
|
+
path += opts[:page_size] ? "&page_size=#{opts[:page_size]}" : ''
|
58
|
+
HelloSign::Resource::ResourceArray.new get(path, opts), 'bulk_send_jobs', HelloSign::Resource::BulkSendJob
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,54 +19,49 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
module HelloSign
|
26
24
|
module Api
|
27
|
-
#
|
28
|
-
# HelloSign allows you to embed the signing page on your site in an iFrame
|
29
|
-
# without the need for the signer/preparer to create a HelloSign account.
|
25
|
+
# Contains all the API calls for Embedded SignatureRequests.
|
30
26
|
# Take a look at our Embedded Signing Walkthrough (https://app.hellosign.com/api/embeddedSigningWalkthrough)
|
31
27
|
# for more information about this.
|
32
28
|
#
|
33
29
|
# @author [hellosign]
|
34
|
-
|
30
|
+
|
35
31
|
module Embedded
|
36
32
|
|
37
|
-
#
|
38
|
-
# Retrieves the embedded signature sign_url.
|
39
|
-
#
|
33
|
+
# Retrieves the sign_url for an Embedded SignatureRequest.
|
40
34
|
# @option opts [String] signature_id The Signature ID to retrieve the embedded sign_url for.
|
41
35
|
#
|
42
|
-
# @return [HelloSign::Resource::Embedded]
|
43
|
-
# @example
|
44
|
-
# embedded = @client.get_embedded_sign_url :signature_id => '50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b'
|
36
|
+
# @return [HelloSign::Resource::Embedded]
|
45
37
|
#
|
38
|
+
# @example
|
39
|
+
# embedded = @client.get_embedded_sign_url signature_id: '50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b'
|
46
40
|
def get_embedded_sign_url(opts)
|
47
41
|
HelloSign::Resource::Embedded.new get("/embedded/sign_url/#{opts[:signature_id]}")
|
48
42
|
end
|
49
|
-
|
50
|
-
# Retrieves the edit_url for an
|
51
|
-
# @option opts [Boolean] test_mode Indicates if this is a test
|
52
|
-
# @option opts [String] template_id The Template ID to
|
43
|
+
|
44
|
+
# Retrieves the edit_url for an Embedded Template.
|
45
|
+
# @option opts [Boolean] test_mode Indicates if this is a test SignatureRequest, it will not be legally binding if set to 1. Defaults to 0. (optional)
|
46
|
+
# @option opts [String] template_id The Template ID to retrieve the embedded edit_url for.
|
53
47
|
# @option opts [Array<Hash>] cc_roles The CC roles that must be assigned when using the Embedded Template to create a SignatureRequest. (optional)
|
54
48
|
# @option opts [String<Array><Hash>] merge_fields List of fields that can be pre-populated by your application when using the Embedded Template to send a SignatureRequest. (optional)
|
55
|
-
# *
|
56
|
-
# *
|
49
|
+
# * name (String) Merge field name
|
50
|
+
# * type (String) Field type - either "text" or "checkbox"
|
57
51
|
# @option opts [Boolean] skip_signer_roles Removes the prompt to edit signer roles, if already provided. Defaults to 0. (optional)
|
58
52
|
# @option opts [Boolean] skip_subject_message Removes the prompt to edit the subject and message, if already provided. Defaults to 0. (optional)
|
59
53
|
#
|
60
|
-
# @return [HelloSign::Resource::Embedded]
|
61
|
-
# @example
|
62
|
-
# edit_url = @client.get_embedded_template_edit_url :template_id => '39e3387f738adfa7ddd4cbd4c00d2a8ab6e4194b'
|
54
|
+
# @return [HelloSign::Resource::Embedded]
|
63
55
|
#
|
56
|
+
# @example
|
57
|
+
# edit_url = @client.get_embedded_template_edit_url template_id: '39e3387f738adfa7ddd4cbd4c00d2a8ab6e4194b'
|
64
58
|
def get_embedded_template_edit_url(opts)
|
65
|
-
defaults = { :
|
59
|
+
defaults = { skip_signer_roles: 0, skip_subject_message: 0, test_mode: 0 }
|
66
60
|
opts = defaults.merge(opts)
|
67
61
|
|
68
62
|
prepare_merge_fields opts
|
69
63
|
|
70
|
-
HelloSign::Resource::Embedded.new post("/embedded/edit_url/#{opts[:template_id]}", :
|
64
|
+
HelloSign::Resource::Embedded.new post("/embedded/edit_url/#{opts[:template_id]}", body: opts)
|
71
65
|
end
|
72
66
|
end
|
73
67
|
end
|
data/lib/hello_sign/api/oauth.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#
|
2
1
|
# The MIT License (MIT)
|
3
2
|
#
|
4
3
|
# Copyright (C) 2014 hellosign.com
|
@@ -20,83 +19,76 @@
|
|
20
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
21
|
# SOFTWARE.
|
23
|
-
#
|
24
22
|
|
25
23
|
module HelloSign
|
26
24
|
module Api
|
27
|
-
|
28
|
-
#
|
25
|
+
# Contains all the API calls for OAuth workflows.
|
29
26
|
# OAuth allows you to perform actions on behalf of other users after they grant you the authorization to do so.
|
30
|
-
#
|
31
|
-
# For more information, see our OAuth API documentation (https://app.hellosign.com/api/oauthWalkthrough).
|
32
|
-
#
|
33
|
-
# IMPORTANT: With some OAuth scopes, you (the app owner) will be charged for all signature requests sent on behalf of other users via your app.
|
27
|
+
# See our OAuth API documentation (https://app.hellosign.com/api/oauthWalkthrough) for more information.
|
34
28
|
#
|
35
29
|
# @author [hellosign]
|
36
|
-
|
30
|
+
|
37
31
|
module OAuth
|
38
32
|
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
# @param state [String] used for security and must match throughout the flow for a given user.
|
33
|
+
# Returns the OAuth URL where users can authorize your application to perform actions on their behalf.
|
34
|
+
# @param state [String] Random security value that must match throughout the user's flow.
|
43
35
|
# It can be set to the value of your choice (preferably something random). You should verify it matches the expected value when validating the OAuth callback.
|
44
|
-
# @return [type] [description]
|
45
36
|
def oauth_url(state)
|
46
37
|
"#{self.oauth_end_point}/oauth/authorize?response_type=code&client_id=#{self.client_id}&state=#{state}"
|
47
38
|
end
|
48
39
|
|
49
|
-
#
|
50
40
|
# Retrieves the OAuth token
|
51
|
-
#
|
52
|
-
# @option opts [String] state Random value that was used when you created oauth_url for a specific user.
|
41
|
+
# @option opts [String] state Random security value that was used when you created oauth_url for a specific user.
|
53
42
|
# @option opts [String] code The code passed to your callback when the user granted access.
|
54
|
-
# @option opts [String] client_id The
|
55
|
-
# @option opts [String] client_secret The secret token of your
|
43
|
+
# @option opts [String] client_id The ApiApp Client ID.
|
44
|
+
# @option opts [String] client_secret The secret token of your ApiApp.
|
56
45
|
#
|
57
46
|
# @return [Hash] OAuth data of the user
|
58
47
|
#
|
59
48
|
# @example
|
60
|
-
# client = HelloSign::Client.new
|
61
|
-
#
|
49
|
+
# client = HelloSign::Client.new(
|
50
|
+
# api_key: '%apikey%',
|
51
|
+
# client_id: 'cc91c61d00f8bb2ece1428035716b',
|
52
|
+
# client_secret: '1d14434088507ffa390e6f5528465'
|
53
|
+
# )
|
54
|
+
# client.get_oauth_token(
|
55
|
+
# state: '900e06e2',
|
56
|
+
# code:'1b0d28d90c86c141'
|
57
|
+
# )
|
62
58
|
def get_oauth_token(opts)
|
63
59
|
opts[:client_id] = self.client_id
|
64
60
|
opts[:client_secret] = self.client_secret
|
65
61
|
opts[:grant_type] = 'authorization_code'
|
66
|
-
post('/oauth/token', { :
|
62
|
+
post('/oauth/token', { body: opts, oauth_request: true })
|
67
63
|
end
|
68
64
|
|
69
|
-
#
|
70
65
|
# Refreshes the user's OAuth token.
|
71
|
-
#
|
72
|
-
# @option opts [String] refresh_token The refresh provided when the access token has expired.
|
66
|
+
# @option opts [String] refresh_token The token provided when the access token has expired.
|
73
67
|
#
|
74
68
|
# @return [Hash] Refreshed OAuth info
|
75
69
|
#
|
76
70
|
# @example
|
77
|
-
# client.refresh_oauth_token :
|
71
|
+
# client.refresh_oauth_token refresh_token: 'hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3'
|
78
72
|
def refresh_oauth_token(opts)
|
79
73
|
opts[:client_id] = self.client_id
|
80
74
|
opts[:client_secret] = self.client_secret
|
81
75
|
opts[:grant_type] = 'refresh_token'
|
82
|
-
post('/oauth/token', { :
|
76
|
+
post('/oauth/token', { body: opts, oauth_request: true })
|
83
77
|
end
|
84
78
|
|
85
|
-
#
|
86
|
-
# Create new user and get their OAuth token. The user will receive an email asking them to confirm the access being granted.
|
79
|
+
# Creates a new user and retrieves the OAuth token. The user will receive an email asking them to confirm the access being granted.
|
87
80
|
# Your app will not be able to perform actions on behalf of this user until they confirm.
|
81
|
+
# @option opts [String] email_address New user's email address.
|
88
82
|
#
|
89
|
-
# @
|
83
|
+
# @return [Hash] details about new user, including OAuth data
|
90
84
|
#
|
91
85
|
# @example
|
92
|
-
# client.oauth_create_account :
|
93
|
-
#
|
94
|
-
# @return [Hash] details about new user, including OAuth data
|
86
|
+
# client.oauth_create_account email_address: 'new_user@example.com'
|
95
87
|
def oauth_create_account(opts)
|
96
88
|
opts[:client_id] = self.client_id
|
97
89
|
opts[:client_secret] = self.client_secret
|
98
90
|
|
99
|
-
HelloSign::Resource::Account.new post('/account/create', { :
|
91
|
+
HelloSign::Resource::Account.new post('/account/create', { body: opts })
|
100
92
|
end
|
101
93
|
end
|
102
94
|
end
|