Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

NexoosBR/clicksign-api

Repository files navigation

Clicksign::Api

Gem Version Build Status Maintainability Test Coverage

Unmaintained

The Clicksign-Api gem is no longer maintained. Please use the official Clicksign Integration.

Installation

Add this line to your application's Gemfile:

gem 'clicksign-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clicksign-api

Setup:

By default, all requests use Clicksign's SANDBOX.

credentials = {
  "key.production" => ENV["CLICKSIGN_ACCESS_TOKEN_PRODUCTION"]
  "key.sandbox" => ENV["CLICKSIGN_ACCESS_TOKEN_SANDBOX"]
}

Clicksign::API.configure do |config|
  config.credentials = credentials
  config.production = false
end

To use PRODUCTION environment, you have to setup:

Clicksign::API.configure do |config|
  config.access_token = ENV['CLICKSIGN_ACCESS_TOKEN']
  config.production = true
end

Usage:

To see all available parameters, please, check the API docs.

Create documents

file = File.open('/path/to/file/local/file.pdf', 'r')
document = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: "key.sandbox")
# => {"document"=> {"key"=>"00000000-0000-0000-0000-000000000000"}

View documents

find_document = Clicksign::API::Document.find(params: { key: response_document['document']['key'] }, token: "key.sandbox")
# => {"document"=> {"key"=>"00000000-0000-0000-0000-000000000000"}

Create Signers

signer = Clicksign::API::Signer.create(params: { email: '[email protected]', auths: ['email'], delivery: 'email' }, token: "key.sandbox")
# => {"signer"=> {"key"=>"00000000-0000-0000-0000-000000000000"}

Add Signers to Document

signer_document = Clicksign::API::DocumentsSigners.create(params: { document_key: response_document['document']['key'], signer_key: response_signer['key'], sign_as: 'sign_as' }, token: "key.sandbox")
# => {"list"=>{"key"=>"00000000-0000-0000-0000-000000000000"}
Creating Documents in Batches
batch = Clicksign::API::Batch.create(
  params: {
    document_keys: [response_document['document']['key'], 'other_document_key'],
    signer_key: response_signer['key'],
    summary: true
  },
  token: "key.sandbox"
)

# => {"batch"=>{"key"=>"00000000-0000-0000-0000-000000000000"}

Notifying Signer by e-mail

notify = Clicksign::API::Notifier.notify(params: { request_signature_key: 'request_signature_key' }, token: "key.sandbox")
# => {:status=>202} 

Notifying Signer by whatsapp

notify = Clicksign::API::Notifier.notify(params: { request_signature_key: 'request_signature_key' }, token: "key.sandbox")
# => {:status=>202} 

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/clicksign-api.