SignWell
Support
If you would like to support this project and haven't signed up to Signwell yet, please consider using this referral link.
This gem has been battle tested at Low, the best place in Ireland to go for life insurance. We use Signwell to process large 25 page templates. This gem helps creates 1000's of documents a month.
Installation
Add this line to your application's Gemfile:
bundle add sign_well
And then execute:
$ bundle install
Or install it yourself as:
$ gem install sign_well
Usage
Every request returns a SignWell::Response
object. You can call body
or to_object
on this to get either the json body or a Ruby object.
Setup
You will Ruby 2.7
or greater.
You will need an x_api_key
from SignWell to start. After that, you simply initialize the client.
client = SignWell::Client.new(x_api_key: ENV['X_API_KEY'])
response = client.document('docment_id')
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.create_document(test_mode: true, files: [{name: 'test', file_url: 'exmpaledoc.com'}], recipients: [{id: 1, email: 'william@test.com'}])
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.create_document_from_template(test_mode: true, template_id: 'template_id', recipients: [{id: 1, email: 'test@test.com', placeholder_name: 'Customer', name: 'Customer'}, {id: 2, email: 'sender@sent.com',name: 'William', placeholder_name: 'Document Sender'}], template_fields: [{api_id: 'TextField_1', value: 'hello'}, {api_id: 'CheckBox_1', value: true}
])
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.update_and_send_document(document_id, test_mode: true, embedded_signing: true)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.remind_document(document_id, test_mode: true, embedded_signing: true)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.delete_document(document_id)
response = client.completed_pdf(document_id, test_mode: true, url_only: true)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.template(tempate_id)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
body = {test_mode: true, "files"=>[{"name"=>"string.pdf", "file_url"=>"https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf"}],
"placeholders"=>[{"id"=>"string", "name"=>"string"}],
"draft"=>false,
"reminders"=>true,
"apply_signing_order"=>false,
"text_tags"=>false,
"allow_decline"=>true,
"fields"=>[[{"required"=>true, "fixed_width"=>false, "lock_sign_date"=>false, "date_format"=>"MM/DD/YYYY", "x"=>0, "y"=>0, "page"=>0, "placeholder_id"=>"string", "type"=>"date", "api_id"=>"string"}]],
"attachment_requests"=>[{"required"=>true, "name"=>"string", "placeholder_id"=>"string"}],
"name"=>"string",
"subject"=>"string",
"message"=>"string",
"expires_in"=>0}
response = client.create_template(body)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
client.delete_template(id)
response = client.api_application(id)
response.body => Hash of the JSON.body
response.to_object => OpenStruct
client.delete_api_application(id)
response = client.list_web_hooks
response.body => Hash of the JSON.body
response.to_object => OpenStruct
response = client.create_web_hook(test_mode: true, callback_url: 'https://test.com')
response.body => Hash of the JSON.body
response.to_object => OpenStruct
client.delete_web_hook(id)
client.me
Other requests
If you can't find the method you're looking, you can call HTTP methods on the client.connection
which is a Faraday object
client.connection.get(path)
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
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 the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/williamkennedy/sign_well. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the SignWell project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.