hellosign-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +15 -0
  5. data/CONTRIBUTING.md +42 -0
  6. data/Gemfile +13 -0
  7. data/Guardfile +14 -0
  8. data/LICENSE +21 -0
  9. data/README.md +112 -0
  10. data/Rakefile +16 -0
  11. data/hellosign-api.gemspec +54 -0
  12. data/lib/hello_sign/.error.rb.swp +0 -0
  13. data/lib/hello_sign/api/account.rb +78 -0
  14. data/lib/hello_sign/api/api_app.rb +121 -0
  15. data/lib/hello_sign/api/bulk_send_job.rb +62 -0
  16. data/lib/hello_sign/api/embedded.rb +68 -0
  17. data/lib/hello_sign/api/oauth.rb +95 -0
  18. data/lib/hello_sign/api/signature_request.rb +691 -0
  19. data/lib/hello_sign/api/team.rb +107 -0
  20. data/lib/hello_sign/api/template.rb +227 -0
  21. data/lib/hello_sign/api/unclaimed_draft.rb +328 -0
  22. data/lib/hello_sign/api.rb +31 -0
  23. data/lib/hello_sign/client.rb +372 -0
  24. data/lib/hello_sign/configuration.rb +78 -0
  25. data/lib/hello_sign/error.rb +99 -0
  26. data/lib/hello_sign/resource/account.rb +43 -0
  27. data/lib/hello_sign/resource/api_app.rb +43 -0
  28. data/lib/hello_sign/resource/base_resource.rb +73 -0
  29. data/lib/hello_sign/resource/bulk_send_job.rb +43 -0
  30. data/lib/hello_sign/resource/embedded.rb +43 -0
  31. data/lib/hello_sign/resource/resource_array.rb +56 -0
  32. data/lib/hello_sign/resource/signature_request.rb +43 -0
  33. data/lib/hello_sign/resource/team.rb +43 -0
  34. data/lib/hello_sign/resource/template.rb +43 -0
  35. data/lib/hello_sign/resource/template_draft.rb +44 -0
  36. data/lib/hello_sign/resource/unclaimed_draft.rb +44 -0
  37. data/lib/hello_sign/resource.rb +33 -0
  38. data/lib/hello_sign/version.rb +25 -0
  39. data/lib/hello_sign.rb +50 -0
  40. data/lib/hellosign-ruby-sdk.rb +4 -0
  41. data/spec/fixtures/account.json +15 -0
  42. data/spec/fixtures/api_app.json +16 -0
  43. data/spec/fixtures/api_apps.json +43 -0
  44. data/spec/fixtures/bulk_send_job.json +88 -0
  45. data/spec/fixtures/bulk_send_jobs.json +22 -0
  46. data/spec/fixtures/embedded.json +6 -0
  47. data/spec/fixtures/empty.pdf +0 -0
  48. data/spec/fixtures/error.json +6 -0
  49. data/spec/fixtures/file.json +0 -0
  50. data/spec/fixtures/headers.json +18 -0
  51. data/spec/fixtures/nda.pdf +0 -0
  52. data/spec/fixtures/signature_request.json +45 -0
  53. data/spec/fixtures/signature_requests.json +44 -0
  54. data/spec/fixtures/team.json +15 -0
  55. data/spec/fixtures/template.json +53 -0
  56. data/spec/fixtures/templates.json +59 -0
  57. data/spec/fixtures/token.json +14 -0
  58. data/spec/fixtures/unclaimed_draft.json +6 -0
  59. data/spec/hello_sign/.error_spec.rb.swp +0 -0
  60. data/spec/hello_sign/api/account_spec.rb +42 -0
  61. data/spec/hello_sign/api/api_app_spec.rb +104 -0
  62. data/spec/hello_sign/api/bulk_send_job_spec.rb +53 -0
  63. data/spec/hello_sign/api/embedded_spec.rb +23 -0
  64. data/spec/hello_sign/api/oauth_spec.rb +27 -0
  65. data/spec/hello_sign/api/signature_request_spec.rb +268 -0
  66. data/spec/hello_sign/api/team_spec.rb +101 -0
  67. data/spec/hello_sign/api/template_spec.rb +172 -0
  68. data/spec/hello_sign/api/unclaimed_draft_spec.rb +145 -0
  69. data/spec/hello_sign/client_spec.rb +191 -0
  70. data/spec/hello_sign/error_spec.rb +10 -0
  71. data/spec/hello_sign/resource/base_resource_spec.rb +53 -0
  72. data/spec/hello_sign_spec.rb +57 -0
  73. data/spec/scenarios/uploads_spec.rb +19 -0
  74. data/spec/spec_helper.rb +104 -0
  75. metadata +261 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 15ab87c5fd112e345b597a6003f2614a14e1823e8e797f55b782e8ed2d1d5228
4
+ data.tar.gz: ed736391c8754d83803b8c3af891b6769febee68d24bad1877c959f942597711
5
+ SHA512:
6
+ metadata.gz: 9f280d46b5e049341a2ff061753f382c7b687850868ea5d4042ae8b03feff053f61e1c0fc173a9a563f6b78dc8cb814b97234bc5d61b49dadae8f1bf6e75746b
7
+ data.tar.gz: 63e5a92a49eadcabaa3397b8c7b6895f8ffaf0717eeebeedb2c5ae67944e92c588c11b36196ca1472e4f1d09d62a7b30f89991e6a6ed96bcb66c05f390e79d78
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ - 2.1.0
5
+ - 2.0.0
6
+ - 1.9.3
7
+ - jruby-19mode
8
+ - ruby-head
9
+ - jruby-head
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: jruby-head
14
+ - rvm: ruby-head
15
+ fast_finish: true
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,42 @@
1
+ # How to contribute
2
+
3
+ We're excited you're considering contributing to our project! Your patches are essential to keeping our SDKs bug free and up-to-date. We want to keep it as easy as possible to contribute. There are only a few guidelines you must follow that will allow us to keep up with pull requests and maintain a high quality code base.
4
+
5
+ ## Getting Started
6
+
7
+ * Make sure you have a [GitHub account](https://github.com/signup/free)
8
+ * Make sure you have a [HelloSign account](http://www.hellosign.com)
9
+ * Submit a new [issue ticket](https://github.com/HelloFax/hellosign-ruby-sdk/issues), assuming one does not already exist.
10
+ * Clearly describe the issue including steps to reproduce when it is a bug.
11
+ * Make sure to include the version you are using which has the issue (and confirm that the issue you are having has not been fixed in a later version)
12
+ * Fork the repository on GitHub
13
+
14
+ ## Making Changes
15
+
16
+ * Make commits of logical units.
17
+ * Check for unnecessary whitespace with `git diff --check` before committing.
18
+ * Make sure your commit messages are in [the proper format](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
19
+ * Make sure you have added any necessary tests for your changes.
20
+ * Run all unit tests, if available, to ensure nothing else was accidentally broken.
21
+
22
+ ### Making trivial changes
23
+
24
+ For changes of a trivial nature to comments and documentation, it is not
25
+ always necessary to create a new issue ticket.
26
+
27
+ ## Submitting Changes
28
+
29
+ * Push your changes to your fork of the repository.
30
+ * Submit a pull request to the repository in the HelloFax organization.
31
+ * Update your issue ticket to mark that you have submitted code and are ready for it to be reviewed (Status: Ready for Merge).
32
+ * Include a link to the pull request in the ticket.
33
+ * The HelloSign dev team looks at Pull Requests on a regular basis.
34
+ * After feedback has been given we expect responses within two weeks. After two
35
+ weeks we may close the pull request if it isn't showing any activity.
36
+
37
+ # Additional Resources
38
+
39
+ * [General GitHub documentation](http://help.github.com/)
40
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
41
+ * [HelloSign API documentation](https://app.hellosign.com/api/documentation)
42
+ * [HelloSign API HipChat room](https://www.hipchat.com/gq4BMFKt1)
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hello_sign.gemspec
4
+ gemspec
5
+
6
+ group :development, :spec do
7
+ gem 'pry'
8
+ gem 'growl' if `uname` =~ /Darwin/
9
+ gem 'guard'
10
+ gem 'guard-bundler'
11
+ gem 'guard-rspec'
12
+ gem 'coveralls', :require => false
13
+ end
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ notification :growl if `uname` =~ /Darwin/
5
+
6
+ guard :bundler do
7
+ watch('Gemfile')
8
+ end
9
+
10
+ guard :rspec do
11
+ watch(%r{^spec/.+_spec\.rb$})
12
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
13
+ watch('spec/spec_helper.rb') { "spec" }
14
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # HelloSign Ruby SDK
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'hellosign'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ ## Configuration
14
+
15
+ Create a config block. At a minimum you'll want to set your [API Key](https://app.hellosign.com/home/myAccount/current_tab/integrations#api) but depending on your usage you'll possibly
16
+ want to set your app's [Client ID](https://app.hellosign.com/oauth/createAppForm) and [Client Secret](https://app.hellosign.com/oauth/createAppForm). In Rails you can place it in `config/initializers/hello_sign.rb`
17
+
18
+ ```ruby
19
+ require 'hello_sign'
20
+ HelloSign.configure do |config|
21
+ config.api_key = 'api_key'
22
+ # You can use email_address and password instead of api_key. But api_key is recommended
23
+ # If api_key, email_address and password are all present, api_key will be used
24
+ # config.email_address = 'email_address'
25
+ # config.password = 'password'
26
+ end
27
+ ```
28
+
29
+ ## Usage
30
+ When you have configured your app like above, you can start using it:
31
+
32
+ ```ruby
33
+ # get your account
34
+ my_account = HelloSign.get_account
35
+
36
+ # get your signature requests
37
+ my_signature_requests = HelloSign.get_signature_requests
38
+
39
+ # view a specific signature request
40
+ signature_request = HelloSign.get_signature_request signature_request_id: '42383e7327eda33f4b8b91217cbe95408cc1285f'
41
+ ```
42
+
43
+ If you need to authenticate for multiple users and you want a separated client for them, you can run:
44
+ ```ruby
45
+ client2 = HelloSign::Client.new api_key: 'your_user_api_key'
46
+ user_account = client2.get_account
47
+ ```
48
+ ### Specifying files
49
+
50
+ When using request endpoints that send files, such as a signature request, you can specify files either as
51
+ 1. A string representing the path
52
+ 2. A Ruby File Object (File.open, then assign to a variable)
53
+ 3. A Rails ActionDispatch::Http::UploadedFile
54
+
55
+ ## Testing
56
+
57
+ Testing relies on built in hard-coded fixtures. You can run the tests without affecting your actual account data. To do so
58
+ from the root of your project run <code>rake spec</code>.
59
+
60
+ ## Additional notes
61
+
62
+ ## Warnings
63
+ Any warnings returned from the API can be accessed by using the 'warnings' accessor on a returned object or list:
64
+
65
+ ````ruby
66
+ my_signature_requests = client.get_signature_requests
67
+ puts my_signature_requests.warnings
68
+ ````
69
+
70
+ and will give output of warnings in the following format (as an array of hashes):
71
+
72
+ ````
73
+ [
74
+ [0] {
75
+ "warning_msg" => "Parameter hodor was ignored. Hodor.",
76
+ "warning_name" => "parameter_ignored"
77
+ },
78
+ [1] {
79
+ "warning_msg" => "Email address sirjorah@targarian.org is unconfirmed. Please pledge your allegiance to the queen first.",
80
+ "warning_name" => "unconfirmed"
81
+ }
82
+ ]
83
+ ````
84
+
85
+ ### Local callbacks
86
+ We do not allow app callbacks (event or OAuth) to be set to localhost. However it is still possible to test callbacks against a local server. Tunneling services such as ngrok (http://ngrok.com) can help you set this up.
87
+
88
+ ## License
89
+
90
+ ```
91
+ The MIT License (MIT)
92
+
93
+ Copyright (C) 2014 hellosign.com
94
+
95
+ Permission is hereby granted, free of charge, to any person obtaining a copy
96
+ of this software and associated documentation files (the "Software"), to deal
97
+ in the Software without restriction, including without limitation the rights
98
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
+ copies of the Software, and to permit persons to whom the Software is
100
+ furnished to do so, subject to the following conditions:
101
+
102
+ The above copyright notice and this permission notice shall be included in all
103
+ copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
106
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
107
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
108
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
109
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
110
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
111
+ SOFTWARE.
112
+ ```
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
8
+
9
+ task :console do
10
+ require 'irb'
11
+ require 'irb/completion'
12
+ require 'hello_sign' # You know what to do.
13
+ @client = HelloSign::Client.new :email_address => 'testuser@example.com', :password => '12345678', :client_id => '7f91612ee160dd56bd899cd1688bbefc', :client_secret => 'a403773af1e1aee206976257a47249cf'
14
+ ARGV.clear
15
+ IRB.start
16
+ end
@@ -0,0 +1,54 @@
1
+ # coding: utf-8
2
+
3
+ #
4
+ # The MIT License (MIT)
5
+ #
6
+ # Copyright (C) 2014 hellosign.com
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in all
16
+ # copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ # SOFTWARE.
25
+ #
26
+
27
+ lib = File.expand_path('../lib', __FILE__)
28
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
29
+ require 'hello_sign/version'
30
+
31
+ Gem::Specification.new do |spec|
32
+ spec.name = 'hellosign-api'
33
+ spec.version = HelloSign::VERSION
34
+ spec.authors = 'HelloSign, Aubrey Holland'
35
+ spec.email = 'aubrey@withgrayce.com'
36
+ spec.summary = 'A Ruby SDK for the HelloSign API.'
37
+ spec.description = ''
38
+ spec.homepage = 'http://www.hellosign.com'
39
+ spec.license = 'MIT'
40
+
41
+ spec.files = `git ls-files -z`.split("\x0")
42
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
43
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
44
+ spec.require_paths = ['lib']
45
+
46
+ spec.add_development_dependency 'bundler', '~> 1.5'
47
+ spec.add_development_dependency 'rake', '~> 13.0.0'
48
+ spec.add_development_dependency 'rspec', '~> 3.0.0'
49
+ spec.add_development_dependency 'webmock', '~> 3.0.0'
50
+ spec.add_runtime_dependency 'faraday', '~> 2.2.0'
51
+ spec.add_runtime_dependency 'faraday-multipart', '~> 1.0.0'
52
+ spec.add_runtime_dependency 'multi_json', '~> 1.0.0'
53
+ spec.add_runtime_dependency 'mime-types', '~> 3.0.0'
54
+ end
Binary file
@@ -0,0 +1,78 @@
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 Account resource.
26
+ # Take a look at our API Documentation on the Account resource (https://app.hellosign.com/api/reference#Account)
27
+ # for more information about this.
28
+ #
29
+ # @author [hellosign]
30
+
31
+ module Account
32
+
33
+ # Returns the current user's account information.
34
+ #
35
+ # @return [HelloSign::Resource::Account] Current user's Account
36
+ #
37
+ # @example
38
+ # account = @client.get_account
39
+ def get_account
40
+ HelloSign::Resource::Account.new get('/account')
41
+ end
42
+
43
+ # Creates a new HelloSign account. The user will need to confirm the email address
44
+ # to complete the creation process.
45
+ # @option opts [String] email_address New user's email address
46
+ #
47
+ # @return [HelloSign::Resource::Account] New user's Account
48
+ #
49
+ # @example
50
+ # account = @client.create_account email_address: 'newuser@example.com'
51
+ def create_account(opts)
52
+ HelloSign::Resource::Account.new post('/account/create', body: opts)
53
+ end
54
+
55
+ # Updates the current user's Account Callback URL.
56
+ # @option opts [String] callback_url New callback URL
57
+ #
58
+ # @return [HelloSign::Resource::Account] Updated Account
59
+ #
60
+ # @example
61
+ # account = @client.update_account callback_url: 'https://www.example.com/callback'
62
+ def update_account(opts)
63
+ HelloSign::Resource::Account.new post('/account', body: opts)
64
+ end
65
+
66
+ # Checks whether an Account exists
67
+ # @option opts [String] email_address User's email address
68
+ #
69
+ # @return [Bool] true if exists, else false
70
+ #
71
+ # @example
72
+ # account = @client.verify email_address: 'newuser@example.com'
73
+ def verify(opts)
74
+ post('/account/verify', body: opts).empty? ? false : true
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,121 @@
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 ApiApp resource.
26
+ # Take a look at our API Documentation on ApiApps (https://app.hellosign.com/api/reference#ApiApp)
27
+ # for more information about this.
28
+ #
29
+ # @author [hellosign]
30
+
31
+ module ApiApp
32
+
33
+ # Retrieves an ApiApp with a given ID
34
+ # @option opts [String] client_id The Client ID of the ApiApp.
35
+ #
36
+ # @return [HelloSign::Resource::ApiApp]
37
+ #
38
+ # @example
39
+ # app = @client.get_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
40
+ def get_api_app(opts)
41
+ HelloSign::Resource::ApiApp.new get("/api_app/#{opts[:client_id]}")
42
+ end
43
+
44
+ # Returns a list of ApiApps that your Account can access.
45
+ # @option opts [Integer] page Sets the page number of the list to return. Defaults to 1. (optional)
46
+ # @option opts [Integer] page_size Determines the number of ApiApps returned per page. Defaults to 20. (optional)
47
+ #
48
+ # @return [HelloSign::Resource::ResourceArray]
49
+ #
50
+ # @example
51
+ # apps = @client.get_api_apps page: 1
52
+ def get_api_apps(opts={})
53
+ path = '/api_app/list'
54
+ path += opts[:page] ? "?page=#{opts[:page]}" : ''
55
+ path += opts[:page_size] ? "&page_size=#{opts[:page_size]}" : ''
56
+ HelloSign::Resource::ResourceArray.new get(path, opts), 'api_apps', HelloSign::Resource::ApiApp
57
+ end
58
+
59
+ # Creates a new ApiApp on your Account
60
+ # @option opts [String] name The name assigned to the ApiApp.
61
+ # @option opts [String] domain The domain associated with the ApiApp.
62
+ # @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
63
+ # @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)
64
+ # @option opts [String] oauth[callback_url] The callback URL to be used for OAuth flows. (optional)
65
+ # @option opts [String] oauth[scopes] A comma-separated list of OAuth scopes to be granted to the app. (optional)
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)
67
+ # @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
68
+ #
69
+ # @return [HelloSign::Resource::ApiApp] newly created ApiApp
70
+ #
71
+ # @example
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
+ # )
78
+ def create_api_app(opts)
79
+ HelloSign::Resource::ApiApp.new post('/api_app', body: opts)
80
+ end
81
+
82
+ # Updates the ApiApp settings.
83
+ # @option opts [String] client_id The Client ID of the ApiApp you want to update.
84
+ # @option opts [String] name The name assigned to the ApiApp. (optional)
85
+ # @option opts [String] domain The domain associated with the ApiApp. (optional)
86
+ # @option opts [String] callback_url The URL that will receive callback events for the ApiApp. (optional)
87
+ # @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)
88
+ # @option opts [String] oauth[callback_url] The callback URL to be used for OAuth flows. (optional)
89
+ # @option opts [String] oauth[scopes] A comma-separated list of OAuth scopes to be granted to the app. (optional)
90
+ # @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)
91
+ # @option opts [Boolean] options[can_insert_everywhere] Determines if signers can "Insert Everywhere" when signing a document. (optional)
92
+ #
93
+ # @return [HelloSign::Resource::ApiApp] an ApiApp object
94
+ #
95
+ # @example
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
+ # )
102
+ def update_api_app(opts)
103
+ id = opts.delete(:client_id)
104
+ path = '/api_app/' + id
105
+ HelloSign::Resource::ApiApp.new post(path, body: opts)
106
+ end
107
+
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.
110
+ #
111
+ # @return [HTTP::Status] 204 No Content
112
+ #
113
+ # @example
114
+ # response = @client.delete_api_app client_id: 'fa5c8a0b0f492d768749333ad6fcc214c111e967'
115
+ def delete_api_app(opts)
116
+ path = '/api_app/' + opts[:client_id]
117
+ delete(path)
118
+ end
119
+ end
120
+ end
121
+ end
@@ -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,0 +1,68 @@
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 Embedded SignatureRequests.
26
+ # Take a look at our Embedded Signing Walkthrough (https://app.hellosign.com/api/embeddedSigningWalkthrough)
27
+ # for more information about this.
28
+ #
29
+ # @author [hellosign]
30
+
31
+ module Embedded
32
+
33
+ # Retrieves the sign_url for an Embedded SignatureRequest.
34
+ # @option opts [String] signature_id The Signature ID to retrieve the embedded sign_url for.
35
+ #
36
+ # @return [HelloSign::Resource::Embedded]
37
+ #
38
+ # @example
39
+ # embedded = @client.get_embedded_sign_url signature_id: '50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b'
40
+ def get_embedded_sign_url(opts)
41
+ HelloSign::Resource::Embedded.new get("/embedded/sign_url/#{opts[:signature_id]}")
42
+ end
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.
47
+ # @option opts [Array<Hash>] cc_roles The CC roles that must be assigned when using the Embedded Template to create a SignatureRequest. (optional)
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)
49
+ # * name (String) Merge field name
50
+ # * type (String) Field type - either "text" or "checkbox"
51
+ # @option opts [Boolean] skip_signer_roles Removes the prompt to edit signer roles, if already provided. Defaults to 0. (optional)
52
+ # @option opts [Boolean] skip_subject_message Removes the prompt to edit the subject and message, if already provided. Defaults to 0. (optional)
53
+ #
54
+ # @return [HelloSign::Resource::Embedded]
55
+ #
56
+ # @example
57
+ # edit_url = @client.get_embedded_template_edit_url template_id: '39e3387f738adfa7ddd4cbd4c00d2a8ab6e4194b'
58
+ def get_embedded_template_edit_url(opts)
59
+ defaults = { skip_signer_roles: 0, skip_subject_message: 0, test_mode: 0 }
60
+ opts = defaults.merge(opts)
61
+
62
+ prepare_merge_fields opts
63
+
64
+ HelloSign::Resource::Embedded.new post("/embedded/edit_url/#{opts[:template_id]}", body: opts)
65
+ end
66
+ end
67
+ end
68
+ end