This is a Ruby wrapper for SignNow's API.
We use RubyDoc for documentation.
First, you've to install the gem
gem install signnow
and require it
require "signnow"
and set up your api_key
Signnow.configure do |config|
config[:app_id] = "_your_application_app_id_",
config[:app_secret] = "_your_application_app_secret_"
end
set the extra :use_test_env?
config option to true if you want to use the signnow test environment
Signnow.configure do |config|
config[:use_test_env?] = true
end
SignNow oauth2 API documentation
Redirecting the user to the authorize url, You need to provide a redirect url where you will get a code param.
# Redirect the user to the authorize url
redirect_to Signnow::Authentications::Oauth.authorize_url(redirect_uri: your_redirect_url)
Process the code param in order to get user oauth credentials.
oauth_credentials = Signnow::Authentications::Oauth.authenticate(code: code)
=>
{
access_token: '_user_access_token_',
refresh_token: '_user_refresh_token',
token_type: 'bearer',
scope: '*',
last_login: 2013929273,
expires_in: 2013929273
}
Store the access token credentials in order to use the Signnow API
Signnow::User.show(access_token: oauth_credentials.access_token)
SignNow users API documentation
Creating a user:
user = Singnow::User.create(
email: 'yournewuser@email.com', # required
password: 'new_password', # required
first_name: 'john', # optional
last_name: 'doe', # optional
)
Store the acess_token
token = user.access_token
Generate a client with the access token
client = Signnow::Client.new(token)
Showing a user:
client.perform! |token|
Singnow::User.show(access_token: token)
end
SignNow documents API documentation
List user documents:
client.perform! |token|
Singnow::Document.all(access_token: token)
end
Show a document:
client.perform! |token|
Singnow::Document.show(id: 'document_id', access_token: token)
end
Get a one time download link for a document:
link =
client.perform! |token|
Singnow::Document.download_link(id: 'document_id', access_token: token)
end
This gem requires at least Ruby 1.9 and faces version 1 of SignNow's API.
Please report bugs at http://github.com/andresbravog/signnow-ruby/issues.
- Fork the project from http://github.com/andresbravog/signnow-ruby.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
Copyright (c) 2012-2013 andresbravog Internet Service GmbH, Andres Bravo. See LICENSE for details.