Giter Site home page Giter Site logo

assently-ruby's Introduction

Build Status Code Climate Test Coverage Gem Version

Assently API Client

Ruby client for the Assently API v2. Check out the official API documentation here.

Supported API calls

API call Supported
createcase ✔️
sendcase ✔️
getcase ✔️
createcasefromtemplate
updatecase
remindcase
deletecase
recallcase
findcases ✔️
createcasefromtemplate
findtemplates
getdocumentdata ✔️
createagent
createssoticket

Missing something? Contributions are very welcome! 😘

Installation

Include the gem in your Gemfile:

gem "assently"

Usage

Environment

When creating a client instance you can choose to use either Assently's production (default when not specified) or test environment. The host app.assently.com is used for production and test.assently.com is used for test when constructing the API commands. Test environment is specified like this:

Assently.client ENV["ASSENTLY_API_KEY"], ENV["ASSENTLY_API_SECRET"], :test

Creating a case

assently = Assently.client assently_api_key, assently_api_secret

case_id = SecureRandom.uuid

signature_case = Assently::Case.new "Agreement", ["electronicid"], id: case_id
signature_case.add_party Assently::Party.new_with_attributes({
  name: "First Last",
  email: "[email protected]",
  social_security_number: "1234567890"
})
signature_case.add_document Assently::Document.new "/some/path/file.pdf"

event_subscription = Assently::CaseEventSubscription.new ["finished", "expired"], "https://example.com/my-endpoint"

result = assently.create_case(signature_case, {
  # Callback for document events
  event_callback: event_subscription,
  # User ends up here after finishing the signing process
  continue: {
    url: "http://example.com/user-endpoint",
    auto: true
  },
  # User ends up here when cancelling, at the moment there is no cancel callback
  cancel_url: "http://example.com/user-canceled"
})

if result.success?
  puts "#{signature_case.id} was created."
else 
  puts "There was some issues with the case"
  result.errors.each do |error|
    puts error
  end
end

Making a case available for signing

assently = Assently.client API_KEY, API_SECRET
result = assently.get_case case_id

if result.success?
  assently.send_case case_id
  
  signing_case = assently.get_case case_id
  
  puts "Sign it here: #{signing_case.response["Parties"].first["PartyUrl"]}"
else
  puts "Could not get signature url"
  result.errors.each do |error|
    puts error
  end
end

Local development

Create a .env file in the root directory to run the integration tests against your Assently test environment.

ASSENTLY_API_KEY=your-api-key
ASSENTLY_API_KEY=your-api-secret

Contributing

Contributions is more than welcome!

Just create a fork and submit a pull request.

Please adhere to the coding standards used in the project and add tests.

assently-ruby's People

Contributors

arvida avatar ivannovosad avatar jawa avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

assently-ruby's Issues

Remove Faraday dependency

We should really not need any external dependencies. If we do want some niceness around http interactions we should probably switch to the http gem.

Handle api v2 responses

Another thing is to decide how we want to handle responses from Egree. Since we do not get a simple url back from a specific call I think we should either just use raw hashes (as it is now with the get_case response) or support read only representations (ie. RemoteCase?) as ruby objects.

Initially I wanted to hide the internals of the egree structure as much as possible since I found it to a bit awkward (creating cases payload includes both properties on the actual case and options surrounding how the process should be handled) and I do not generally like to deal with hashes as data objects, especially when we do not control the structure of them.

Relates to #2

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.