Skip to content

Ruby client for communicating with the Egree API

License

Notifications You must be signed in to change notification settings

jawa/egree-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Code Climate Test Coverage Gem Version

Egree

Ruby client for the Egree API.

Currently the only supported api calls is createcasecommand and getviewcaseurlquery.

Usage

Creating a case

egree = Egree.client username, password

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

result = egree.create_case(signature_case, {
  # Egree sends a POST with the signed case as the JSON body when the signing process is finished.
  postback_url: "https://example.com/my-endpoint",
  continue: {
    # user ends up here after finishing the signing process
    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",
  # Procedure can be ”default” or ”form”, this changes some copy in the Egree interface.
  # defaults to ”default”
  procedure: "form"
})

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

Getting the signature url for a case

egree = Egree.client username, password
result = egree.get_case_url "98d08cf5-d35d-403b-ac31-fa1ac85037a1"

if result.success?
  puts "The url is: #{result.response}"
else
  puts "Could not get signature url"
  result.errors.each do |error|
    puts error
  end
end

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.

Local development

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

EGREE_USERNAME=your-username
EGREE_PASSWORD=your-password

About

Ruby client for communicating with the Egree API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%