Giter VIP home page Giter VIP logo

sign_well's Introduction

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: '[email protected]'}])
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: '[email protected]', placeholder_name: 'Customer', name: 'Customer'}, {id: 2, email: '[email protected]',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.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.

sign_well's People

Contributors

williamkennedy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

conorc352

sign_well's Issues

post_request and patch_request are appending params to the url instead of the body

Currently, each post and patch request does the following:


    def post_request(path, params)
      client.connection.post(path) do |req|
        req.params = params
        req.headers['Content-Type'] = 'application/json'
      end
    end

    def patch_request(path, params)
      client.connection.patch(path) do |req|
        req.params = params
        req.headers['Content-Type'] = 'application/json'
        req.headers['Accept'] = 'application/json'
      end

However, req.params should actually be req.body

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.