Skip to content

darbyfrey/legalizer

Repository files navigation

legalizer

DESCRIPTION:

Legalizer is a simple API wrapper around the RightSignature document signature service. It’s still early in development, but you can:

  • Find and get details on Contracts

  • Search for available Templates

  • Prepare and send a contract for signature

EXAMPLES:

Establish a connection:

legalizer = Legalizer({
  :oauth_key => 'YOUR OAUTH KEY', 
  :oauth_secret => 'YOUR OAUTH SECRET', 
  :access_token => 'YOUR ACCESS TOKEN', 
  :access_secret => 'YOUR ACCESS SECRET'
})

List all available templates:

legalizer.find.all_templates

List recently created contracts:

legalizer.find.all_contracts

You can also find a contract by RightSignature’s document id:

legalizer.find.contract(id)

Or template id

legalizer.find.template(id)

Sending is simplified right now, but will be enhanced later. For now you can just send a template by providing a valid xml document as described in the RightSignature API documentation (rightsignature.com/apidocs/api_calls?api_method=prefillTemplate):

template = legalizer.find.template(id)

package_id = template.package

xml_request = "<template>
  <guid>#{package_id}</guid>
  <subject>Test Subject</subject>
  <description>Test Description</description>
  <action>prefill</action>
  <expires_in>5 days</expires_in>
  <roles>
      <role role_name='Employee Address'>
          <name>John Employee</name>
          <email>john@employee.com</email>
          <locked>true</locked>
      </role>
      <role role_id='a_2313_lf79870f3dv_2'>
          <name>Jane Employee</name>
          <email>jane@employee.com</email>
          <locked>true</locked>
      </role>
  </roles>
  <merge_fields>
      <merge_field merge_field_id='a_233_f309f82jklnm_232'>
          <value>$100 per hour</value>
          <locked>true</locked>
      </merge_field>
      <merge_field merge_field_name='Employee Name'>
          <value>J. Employee</value>
      </merge_field>
  </merge_fields>
  <tags>
      <tag>
          <value>company1</value>
      </tag>
  </tags>
  <callback_location>http://localhost/doc_callback</callback_location>
</template>"

template.send(xml_request)

REQUIREMENTS:

  • oauth

  • json

INSTALL:

  • gem install leaglizer

OAUTH

Getting this gem to work with OAuth is a little tricky right now, so I added a quick work around for the time being. When you get your API access from RightSignature, they will supply you with an OAuth Key and an OAuth Secret. You will need to generate your own Access Token and Access Secret. To do that, follow these steps:

In the console:

Legalizer({
  :configure_oauth => true, 
  :oauth_key => 'YOUR OAUTH KEY', 
  :oauth_secret => 'YOUR OAUTH SECRET'
})

You will get this response:

Now visit: https://rightsignature.com/oauth/authorize?oauth_token=SOME_TOKEN

Visit that URL and grant your application access, you will be redirected to localhost, it doesn’t matter if the page loads, just grab the oauth_verifier value from the URL string

Paste your oauth_verifier after the prompt and hit enter

What's the value of `oauth_verifier`?

Then you’ll get this response, and you’re ready to go:

Your access token is: YOUR ACCESS TOKEN
Your access secret is: YOUR ACCESS SECRET
Now you're ready to use these 2 values in your Legalizer configuration

LICENSE:

Copyright © 2010 Darby Frey

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.

About

A simple ruby wrapper around the RightSignature API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages