Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 97456dc

Browse files
authored
Merge pull request #101 from HelloFax/New-Features
New features
2 parents 2e0c14f + efdee9a commit 97456dc

35 files changed

+1154
-762
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ my_account = HelloSign.get_account
4040
my_signature_requests = HelloSign.get_signature_requests
4141

4242
# view a specific signature request
43-
signature_request = HelloSign.get_signature_request :signature_request_id => '42383e7327eda33f4b8b91217cbe95408cc1285f'
43+
signature_request = HelloSign.get_signature_request signature_request_id: '42383e7327eda33f4b8b91217cbe95408cc1285f'
4444
```
4545

4646
If you need to authenticate for multiple users and you want a separated client for them, you can run:
4747
```ruby
48-
client2 = HelloSign::Client.new :api_key => 'your_user_api_key'
48+
client2 = HelloSign::Client.new api_key: 'your_user_api_key'
4949
user_account = client2.get_account
5050
```
5151
### Specifying files

lib/hello_sign.rb

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
# The MIT License (MIT)
32
#
43
# Copyright (C) 2014 hellosign.com
@@ -20,29 +19,25 @@
2019
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2120
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2221
# SOFTWARE.
23-
#
2422

2523
require 'hello_sign/version'
2624
require 'hello_sign/configuration'
2725
require 'hello_sign/client'
2826

2927
module HelloSign
3028
extend Configuration
31-
#
32-
# # If HelloSign module doesn't respond to method, then delegates it to HelloSign::Client
33-
# @param method [Symbol] method name
34-
# @param *args [Array] arguments passed into the method
35-
# @param &block [Block] a block passed into the method
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
3734
def self.method_missing(method, *args, &block)
3835
return super unless client.respond_to?(method)
3936
client.send(method, *args, &block)
4037
end
4138

42-
#
43-
# If HelloSign module don't respond to method, asks HelloSign::Client whether it responded or not
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
4641
def self.respond_to?(method, include_all=false)
4742
return super || client.respond_to?(method)
4843
end

lib/hello_sign/api.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
# The MIT License (MIT)
32
#
43
# Copyright (C) 2014 hellosign.com
@@ -20,7 +19,6 @@
2019
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2120
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2221
# SOFTWARE.
23-
#
2422

2523
require 'hello_sign/api/account'
2624
require 'hello_sign/api/embedded'
@@ -30,3 +28,4 @@
3028
require 'hello_sign/api/unclaimed_draft'
3129
require 'hello_sign/api/oauth'
3230
require 'hello_sign/api/api_app'
31+
require 'hello_sign/api/bulk_send_job'

lib/hello_sign/api/account.rb

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
# The MIT License (MIT)
32
#
43
# Copyright (C) 2014 hellosign.com
@@ -20,71 +19,59 @@
2019
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2120
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2221
# SOFTWARE.
23-
#
2422

2523
module HelloSign
2624
module Api
27-
28-
#
2925
# Contains all the API calls for the Account resource.
3026
# Take a look at our API Documentation on the Account resource (https://app.hellosign.com/api/reference#Account)
3127
# for more information about this.
3228
#
3329
# @author [hellosign]
34-
#
30+
3531
module Account
36-
#
32+
3733
# Returns the current user's account information.
3834
#
39-
# @return [HelloSign::Resource::Account] current user's account
35+
# @return [HelloSign::Resource::Account] Current user's Account
4036
#
4137
# @example
4238
# account = @client.get_account
43-
#
4439
def get_account
4540
HelloSign::Resource::Account.new get('/account')
4641
end
4742

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
5044
# to complete the creation process.
51-
#
52-
# Note: This request does not require authentication.
53-
#
5445
# @option opts [String] email_address New user's email address
5546
#
56-
# @return [HelloSign::Resource::Account] New user's account information
47+
# @return [HelloSign::Resource::Account] New user's Account
5748
#
5849
# @example
59-
# account = @client.create_account :email_address => 'newuser@example.com'
60-
#
50+
# account = @client.create_account email_address: 'newuser@example.com'
6151
def create_account(opts)
62-
HelloSign::Resource::Account.new post('/account/create', :body => opts)
52+
HelloSign::Resource::Account.new post('/account/create', body: opts)
6353
end
6454

55+
# Updates the current user's Account Callback URL.
56+
# @option opts [String] callback_url New callback URL
6557
#
66-
# Updates the current user's callback URL
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
7059
#
7160
# @example
72-
# account = @client.update_account :callback_url => 'https://www.example.com/callback'
73-
#
61+
# account = @client.update_account callback_url: 'https://www.example.com/callback'
7462
def update_account(opts)
75-
HelloSign::Resource::Account.new post('/account', :body => opts)
63+
HelloSign::Resource::Account.new post('/account', body: opts)
7664
end
7765

78-
#
79-
# Check whether an account exists
80-
# @option opts [String] email_address user email
66+
# Checks whether an Account exists
67+
# @option opts [String] email_address User's email address
8168
#
8269
# @return [Bool] true if exists, else false
83-
# @example
84-
# account = @client.verify :email_address => 'newuser@example.com'
8570
#
71+
# @example
72+
# account = @client.verify email_address: 'newuser@example.com'
8673
def verify(opts)
87-
post('/account/verify', :body => opts).empty? ? false : true
74+
post('/account/verify', body: opts).empty? ? false : true
8875
end
8976
end
9077
end

lib/hello_sign/api/api_app.rb

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
# The MIT License (MIT)
32
#
43
# Copyright (C) 2014 hellosign.com
@@ -20,51 +19,44 @@
2019
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2120
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2221
# SOFTWARE.
23-
#
2422

2523
module HelloSign
2624
module Api
27-
#
2825
# Contains all the API calls for the ApiApp resource.
29-
# Take a look at our API Documentation for ApiApps (https://app.hellosign.com/api/reference#ApiApp)
26+
# Take a look at our API Documentation on ApiApps (https://app.hellosign.com/api/reference#ApiApp)
3027
# for more information about this.
3128
#
3229
# @author [hellosign]
33-
#
30+
3431
module ApiApp
3532

36-
#
37-
# Retrieves information about a specific API App by a given ID
33+
# Retrieves an ApiApp with a given ID
3834
# @option opts [String] client_id The Client ID of the ApiApp.
3935
#
40-
# @return [HelloSign::Resource::ApiApp] the ApiApp
36+
# @return [HelloSign::Resource::ApiApp]
4137
#
4238
# @example
43-
# app = @client.get_api_app :client_id => 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
44-
#
39+
# app = @client.get_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
4540
def get_api_app(opts)
4641
HelloSign::Resource::ApiApp.new get("/api_app/#{opts[:client_id]}")
4742
end
4843

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.
5145
# @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
5246
# @option opts [Integer] page_size Determines the number of ApiApps returned per page. Defaults to 20. (optional)
5347
#
5448
# @return [HelloSign::Resource::ResourceArray]
5549
#
5650
# @example
57-
# apps = @client.get_api_apps :page => 1
58-
#
51+
# apps = @client.get_api_apps page: 1
5952
def get_api_apps(opts={})
6053
path = '/api_app/list'
6154
path += opts[:page] ? "?page=#{opts[:page]}" : ''
6255
path += opts[:page_size] ? "&page_size=#{opts[:page_size]}" : ''
6356
HelloSign::Resource::ResourceArray.new get(path, opts), 'api_apps', HelloSign::Resource::ApiApp
6457
end
6558

66-
#
67-
# Creates a new API Application on your account
59+
# Creates a new ApiApp on your Account
6860
# @option opts [String] name The name assigned to the ApiApp.
6961
# @option opts [String] domain The domain associated with the ApiApp.
7062
# @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
@@ -74,16 +66,20 @@ def get_api_apps(opts={})
7466
# @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)
7567
# @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
7668
#
77-
# @return [HelloSign::Resource::ApiApp] newly created ApiApp object
69+
# @return [HelloSign::Resource::ApiApp] newly created ApiApp
7870
#
7971
# @example
80-
# app = @client.create_api_app :name => 'My Production App', :domain => 'example.com', :'oauth[callback_url]' => 'https://example.com/oauth', 'oauth[scopes]' => 'basic_account_info,request_signature'
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+
# )
8178
def create_api_app(opts)
82-
HelloSign::Resource::ApiApp.new post('/api_app', :body => opts)
79+
HelloSign::Resource::ApiApp.new post('/api_app', body: opts)
8380
end
8481

85-
#
86-
# Updates settings for a specific ApiApp on your account
82+
# Updates the ApiApp settings.
8783
# @option opts [String] client_id The Client ID of the ApiApp you want to update.
8884
# @option opts [String] name The name assigned to the ApiApp. (optional)
8985
# @option opts [String] domain The domain associated with the ApiApp. (optional)
@@ -97,19 +93,25 @@ def create_api_app(opts)
9793
# @return [HelloSign::Resource::ApiApp] an ApiApp object
9894
#
9995
# @example
100-
# app = @client.update_api_app :name => 'My Newly Renamed App', :domain => 'example2.com', :'oauth[callback_url]' => 'https://example2.com/oauth', 'oauth[scopes]' => 'basic_account_info,request_signature'
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+
# )
101102
def update_api_app(opts)
102103
id = opts.delete(:client_id)
103104
path = '/api_app/' + id
104-
HelloSign::Resource::ApiApp.new post(path, :body => opts)
105+
HelloSign::Resource::ApiApp.new post(path, body: opts)
105106
end
106107

107-
#
108108
# Deletes an ApiApp. Only available for ApiApps you own.
109109
# @option opts [String] client_id The Client ID of the ApiApp you want to delete.
110110
#
111+
# @return [HTTP::Status] 204 No Content
112+
#
111113
# @example
112-
# result = @client.delete_api_app :client_id => 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
114+
# response = @client.delete_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
113115
def delete_api_app(opts)
114116
path = '/api_app/' + opts[:client_id]
115117
delete(path)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)