signatory

formerly profounder/signatory

<img src=“https://secure.travis-ci.org/rgarver/signatory.png” />

DESCRIPTION:

A library to simplify interactions with the RightSignature API. One of the primary goals of this library is to make the workflow clear to developers for using some of the more interesting features of the RightSignature system, eg: templates, document merges, and embedded signature frames.

Now requires the 1.1 or 1.2 api versions. Handles the double URL escaping on documents and templates.

FEATURES/PROBLEMS:

  • FIX (list of features or problems)

SYNOPSIS:

cred = Signatory::Credentials.load(File.open('rs.yml'))
if cred.oauth_ready? # true if access token is provided by the credential file otherwise false
  # if you don't need to handle the credentials separately you can pass
  # something that Signatory:Credentials can load (hash or file) instead
  Signatory.credentials = cred

  Signatory::Document.all # => List all documents
  doc = Signatory::Document.find('XXXXXXXXXXX') # => Get document by id

  ...

  Signatory::Template.all # => List all templates
  template = Signatory::Template.find('XXXXXXXXX') # => Get a template by id

  merge_fields = [
    Signatory::MergeField.new(:name => "Company Name", :value => "ABC Corp."),
    Signatory::MergeField.new(:name => "Percentage", :value => "5.8%"),
    Signatory::MergeField.new(:name => "Term", :value => "48 months"),
    Signatory::MergeField.new(:name => "Monthly Payback", :value => "$30.00")
  ]

  # If you aren't embedding then you should include email addresses. You can
  # also use instances of Signatory::Signer
  roles = [
    Signatory::Role.new(:role_name => 'Issuer', :name => 'Ryan Garver'),
    Signatory::Role.new(:role_name => 'Investor', :name => 'Cary Dunn')
  ]

  doc = template.build_document(merge_fields, roles)

  signer = doc.recipients.first # Order matters.  Returns a Signatory::Recipient

  # Can be embedded with:
  #
  # <iframe src ="<%= signer.embed_url(redirect_url, :height => 500, :width => 700) %>"
  #   width="700px" height="500px" frameborder="0" scrolling="no">
  #  <p>Your browser does not support iframes.</p>
  # </iframe>
  #
  # or use signer.embed_code(redirect_url, :height => 500, :width => 700) to generate the
  # above code.  This will throw an exception if signer is not associated
  # with a real document yet.
else
  ... begin oauth workflow ...
end

If you need some debugging output (I have) try this:

Signatory::Document.connection.send(:http).consumer.http.set_debug_output($stderr)

REQUIREMENTS:

Depends on the gems ‘oauth` and `activeresource`

INSTALL:

From the command line:

gem install signatory

From ‘bundler`:

gem 'signatory'

THANKS:

Special thanks to Cary Dunn at RightSignature for putting together a sample Rails app that formulated how the API should be used and introduced the embedded signing frame.

LICENSE:

(The MIT License)

Copyright © 2012 Ryan Garver

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.