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

Commit 0500f0d

Browse files
authored
Merge pull request #92 from HelloFax/Audit
Audit
2 parents e928221 + 8a1e212 commit 0500f0d

22 files changed

+521
-379
lines changed

lib/hello_sign.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#
22
# The MIT License (MIT)
3-
#
3+
#
44
# Copyright (C) 2014 hellosign.com
5-
#
5+
#
66
# Permission is hereby granted, free of charge, to any person obtaining a copy
77
# of this software and associated documentation files (the "Software"), to deal
88
# in the Software without restriction, including without limitation the rights
@@ -28,9 +28,8 @@
2828

2929
module HelloSign
3030
extend Configuration
31-
3231
#
33-
# # If HelloSign module don't respond_to? method, then delegate it to HelloSign::Client
32+
# # If HelloSign module doesn't respond to method, then delegates it to HelloSign::Client
3433
# @param method [Symbol] method name
3534
# @param *args [Array] arguments passed into the method
3635
# @param &block [Block] a block passed into the method
@@ -41,7 +40,7 @@ def self.method_missing(method, *args, &block)
4140
end
4241

4342
#
44-
# If HelloSign module don't respond_to? method, ask HelloSign::Client whether it respond or not
43+
# If HelloSign module don't respond to method, asks HelloSign::Client whether it responded or not
4544
# @param method [Symbol] method name
4645
#
4746
def self.respond_to?(method, include_all=false)

lib/hello_sign/api/account.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ module HelloSign
2626
module Api
2727

2828
#
29-
# Contains all the api calls for the Account resource.
30-
# Take a look at our {https://app.hellosign.com/api/reference#Account account api document}
29+
# Contains all the API calls for the Account resource.
30+
# Take a look at our API Documentation on the Account resource (https://app.hellosign.com/api/reference#Account)
3131
# for more information about this.
3232
#
3333
# @author [hellosign]
3434
#
3535
module Account
36-
3736
#
3837
# Returns the current user's account information.
3938
#
@@ -47,7 +46,7 @@ def get_account
4746
end
4847

4948
#
50-
# Creates a new HelloSign account. The user will still need to confirm their email address
49+
# Creates a new HelloSign account. The user will still need to confirm the email address
5150
# to complete the creation process.
5251
#
5352
# Note: This request does not require authentication.

lib/hello_sign/api/api_app.rb

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424

2525
module HelloSign
2626
module Api
27-
2827
#
29-
# Contains all the api calls for the ApiApp resource.
30-
# Take a look at our {https://app.hellosign.com/api/reference#Team team api document}
28+
# 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)
3130
# for more information about this.
3231
#
3332
# @author [hellosign]
@@ -36,8 +35,9 @@ module ApiApp
3635

3736
#
3837
# Retrieves information about a specific API App by a given ID
38+
# @option opts [String] client_id The Client ID of the ApiApp.
3939
#
40-
# @return [HelloSign::Resource::ApiApp] the API App
40+
# @return [HelloSign::Resource::ApiApp] the ApiApp
4141
#
4242
# @example
4343
# app = @client.get_api_app :client_id => 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
@@ -48,8 +48,8 @@ def get_api_app(opts)
4848

4949
#
5050
# Returns a list of ApiApps that you currently have access to on your account
51-
# @option opts [Integer] page (1) Which page number of the list to return.
52-
# @option opts [Integer] page_size (5) Number of results for each page
51+
# @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
52+
# @option opts [Integer] page_size Determines the number of ApiApps returned per page. Defaults to 20. (optional)
5353
#
5454
# @return [HelloSign::Resource::ResourceArray]
5555
#
@@ -65,12 +65,14 @@ def get_api_apps(opts={})
6565

6666
#
6767
# Creates a new API Application on your account
68-
# @option opts [String] name The name you want to assign to the ApiApp.
69-
# @option opts [String] domain The domain name the ApiApp will be associated with.
70-
# @option opts [String] callback_url (optional) The URL at which the ApiApp should receive event callbacks.
71-
# @option opts [String] custom_logo_file (optional) An image file to use as a custom logo in embedded contexts. (Only applies to some API plans)
72-
# @option opts [String] oauth[callback_url] (optional) The callback URL to be used for OAuth flows. (Required if oauth[scopes] is provided)
73-
# @option opts [String] oauth[scopes] (optional) A comma-separated list of OAuth scopes to be granted to the app. (Required if oauth[callback_url] is provided)
68+
# @option opts [String] name The name assigned to the ApiApp.
69+
# @option opts [String] domain The domain associated with the ApiApp.
70+
# @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
71+
# @option opts [String] custom_logo_file An image file to use as a custom logo in embedded workflows, if available in the API subscription. (optional)
72+
# @option opts [String] oauth[callback_url] The callback URL to be used for OAuth flows. (optional)
73+
# @option opts [String] oauth[scopes] A comma-separated list of OAuth scopes to be granted to the app. (optional)
74+
# @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+
# @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
7476
#
7577
# @return [HelloSign::Resource::ApiApp] newly created ApiApp object
7678
#
@@ -81,14 +83,16 @@ def create_api_app(opts)
8183
end
8284

8385
#
84-
# Updates parameters for a specific API Application on your account, referenced by ID
85-
# @oprion opts [String] client_id (REQUIRED) The ID of the app you want to update
86-
# @option opts [String] name (optional) The name you want to assign to the ApiApp.
87-
# @option opts [String] domain (optional) The domain name the ApiApp will be associated with.
88-
# @option opts [String] callback_url (optional) The URL at which the ApiApp should receive event callbacks.
89-
# @option opts [String] custom_logo_file (optional) An image file to use as a custom logo in embedded contexts. (Only applies to some API plans)
90-
# @option opts [String] oauth[callback_url] (optional) The callback URL to be used for OAuth flows. (Required if oauth[scopes] is provided)
91-
# @option opts [String] oauth[scopes] (optional) A comma-separated list of OAuth scopes to be granted to the app. (Required if oauth[callback_url] is provided)
86+
# Updates settings for a specific ApiApp on your account
87+
# @option opts [String] client_id The Client ID of the ApiApp you want to update.
88+
# @option opts [String] name The name assigned to the ApiApp. (optional)
89+
# @option opts [String] domain The domain associated with the ApiApp. (optional)
90+
# @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
91+
# @option opts [String] custom_logo_file An image file to use as a custom logo in embedded workflows, if available in the API subscription. (optional)
92+
# @option opts [String] oauth[callback_url] The callback URL to be used for OAuth flows. (optional)
93+
# @option opts [String] oauth[scopes] A comma-separated list of OAuth scopes to be granted to the app. (optional)
94+
# @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)
95+
# @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
9296
#
9397
# @return [HelloSign::Resource::ApiApp] an ApiApp object
9498
#
@@ -101,10 +105,11 @@ def update_api_app(opts)
101105
end
102106

103107
#
104-
# Deletes an API App. Can only be invoked for apps you own.
108+
# Deletes an ApiApp. Only available for ApiApps you own.
109+
# @option opts [String] client_id The Client ID of the ApiApp you want to delete.
105110
#
106111
# @example
107-
# result = @client.delete_api_app :client_id => 'hdialuhfilaudshfa'
112+
# result = @client.delete_api_app :client_id => 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
108113
def delete_api_app(opts)
109114
path = '/api_app/' + opts[:client_id]
110115
delete(path)

lib/hello_sign/api/embedded.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424

2525
module HelloSign
2626
module Api
27-
2827
#
2928
# HelloSign allows you to embed the signing page on your site in an iFrame
30-
# without the need for the end-user to create a HelloSign account.
31-
# Take a look at our {https://app.hellosign.com/api/embeddedSigningWalkthrough embedded signing walkthrough}
29+
# without the need for the signer/preparer to create a HelloSign account.
30+
# Take a look at our Embedded Signing Walkthrough (https://app.hellosign.com/api/embeddedSigningWalkthrough)
3231
# for more information about this.
3332
#
3433
# @author [hellosign]
3534
#
3635
module Embedded
3736

3837
#
39-
# Retrieves the embedded signature request url.
40-
# @option opts [String] signature_id The id of the signature to get a signature url for
38+
# Retrieves the embedded signature sign_url.
39+
#
40+
# @option opts [String] signature_id The Signature ID to retrieve the embedded sign_url for.
4141
#
4242
# @return [HelloSign::Resource::Embedded] Returns an Embedded object
4343
# @example
@@ -47,11 +47,15 @@ def get_embedded_sign_url(opts)
4747
HelloSign::Resource::Embedded.new get("/embedded/sign_url/#{opts[:signature_id]}")
4848
end
4949
#
50-
# Retrieves the edit url for an embedded template.
51-
# @option opts [String] template_id The id of the template to get a edit url for
52-
# @option opts [Integer] skip_signer_roles Whether editing signer roles should be skipped
53-
# @option opts [Integer] skip_subject_message Whether editing subject/message should be skipped
54-
# @option opts [Array<Hash>] merge_fields Merge fields that can be placed in the template
50+
# Retrieves the edit_url for an embedded template.
51+
# @option opts [Boolean] test_mode Indicates if this is a test Embedded Template. A boolean value is also accepted. Defaults to 0. (optional)
52+
# @option opts [String] template_id The Template ID to retreive the embedded edit_url for.
53+
# @option opts [Array<Hash>] cc_roles The CC roles that must be assigned when using the Embedded Template to create a SignatureRequest. (optional)
54+
# @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+
# * :name (String) Merge field name
56+
# * :type (String) Field type - either "text" or "checkbox"
57+
# @option opts [Boolean] skip_signer_roles Removes the prompt to edit signer roles, if already provided. Defaults to 0. (optional)
58+
# @option opts [Boolean] skip_subject_message Removes the prompt to edit the subject and message, if already provided. Defaults to 0. (optional)
5559
#
5660
# @return [HelloSign::Resource::Embedded] Returns an Embedded object
5761
# @example

lib/hello_sign/api/oauth.rb

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,34 @@ module Api
2727

2828
#
2929
# OAuth allows you to perform actions on behalf of other users after they grant you the authorization to do so.
30-
# For example, you could send signature requests on behalf of your users. This page lays out the basic steps to do that.
31-
# IMPORTANT
30+
# For example, you could send signature requests on behalf of your users.
31+
# For more information, see our OAuth API documentation (https://app.hellosign.com/api/oauthWalkthrough).
3232
#
33-
# With OAuth, you (the app owner) will be charged for all signature requests sent on behalf of other users via your app.
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.
3434
#
3535
# @author [hellosign]
3636
#
3737
module OAuth
3838

3939
#
40-
# Return the oath url where users can give permission for your application to perform actions on their behalf.
41-
# @param state [String] used for security and must match throughout the flow for a given user.
40+
# Returns the OAuth URL where users can give permission for your application to perform actions on their behalf.
41+
#
42+
# @param state [String] used for security and must match throughout the flow for a given user.
4243
# 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.
4344
# @return [type] [description]
4445
def oauth_url(state)
4546
"#{self.oauth_end_point}/oauth/authorize?response_type=code&client_id=#{self.client_id}&state=#{state}"
4647
end
4748

4849
#
49-
# Retrieving the OAuth token
50+
# Retrieves the OAuth token
5051
#
51-
# @option opts [String] state variable that was used when you created oauth_url for a specific user
52-
# @option opts [String] code The authorization code passed to your callback when the user granted access
52+
# @option opts [String] state Random value that was used when you created oauth_url for a specific user.
53+
# @option opts [String] code The code passed to your callback when the user granted access.
54+
# @option opts [String] client_id The API App Client ID.
55+
# @option opts [String] client_secret The secret token of your API App.
5356
#
54-
# @return [Hash] oauth data of the user
57+
# @return [Hash] OAuth data of the user
5558
#
5659
# @example
5760
# client = HelloSign::Client.new :api_key => '%apikey%', :client_id => 'cc91c61d00f8bb2ece1428035716b', :client_secret => '1d14434088507ffa390e6f5528465'
@@ -64,11 +67,11 @@ def get_oauth_token(opts)
6467
end
6568

6669
#
67-
# refresh user oauth token.
70+
# Refreshes the user's OAuth token.
6871
#
69-
# @return [Hash] refreshed oauth info
70-
# @example
71-
# client = HelloSign::Client.new :api_key => '%apikey%', :client_id => 'cc91c61d00f8bb2ece1428035716b', :client_secret => '1d14434088507ffa390e6f5528465'
72+
# @option opts [String] refresh_token The refresh provided when the access token has expired.
73+
#
74+
# @return [Hash] Refreshed OAuth info
7275
#
7376
# @example
7477
# client.refresh_oauth_token :refresh_token => 'hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3'
@@ -79,12 +82,16 @@ def refresh_oauth_token(opts)
7982
post('/oauth/token', { :body => opts, :oauth_request => true })
8083
end
8184

82-
8385
#
84-
# Create new user and get their OAuth token. The user will receive an email asking them to confirm the access being granted. Your app will not be able to perform actions on behalf of this user until they confirm.
85-
# @option opts [String] email_address new user email address
86+
# Create new user and get their OAuth token. The user will receive an email asking them to confirm the access being granted.
87+
# Your app will not be able to perform actions on behalf of this user until they confirm.
88+
#
89+
# @option opts [String] email_address New user email address.
90+
#
91+
# @example
92+
# client.oauth_create_account :email_address => 'new_user@example.com'
8693
#
87-
# @return [Hash] details about new user, including oath data
94+
# @return [Hash] details about new user, including OAuth data
8895
def oauth_create_account(opts)
8996
opts[:client_id] = self.client_id
9097
opts[:client_secret] = self.client_secret

0 commit comments

Comments
 (0)