Autentique Ruby Gem
A Ruby client for the Autentique digital signature API. This gem provides a clean, idiomatic interface to Autentique's GraphQL API for document signing and management.
Features
- 🔐 Simple Authentication — Easy API key configuration
- 📄 Document Management — Create, retrieve, list, and delete documents
- ✍️ Flexible Signing — Multiple signers with various authentication methods
- 📁 Folder Management — Organize documents in folders
- 🪝 Webhook Processing — Verify and process incoming Autentique webhook events
- 🏖️ Sandbox Mode — Test without consuming document credits
- 🛡️ Type Safety — Model classes for structured data
Installation
Add to your Gemfile:
gem 'autentique'Then run bundle install, or install directly with gem install autentique.
Quick Start
client = Autentique::Client.new(api_key: ENV['AUTENTIQUE_API_KEY'])
# Create a document
document = client.documents.create(
file: '/path/to/contract.pdf',
document: { name: 'Employment Contract' },
signers: [{ email: 'employee@example.com', action: 'SIGN' }]
)
puts document.id
puts document.signatures.first.short_link
# Retrieve a document
doc = client.documents.find('document-uuid')
puts doc.signed? ? 'Signed' : 'Pending'
# Process an incoming webhook
processor = Autentique::WebhookProcessor.new(
request.body.read,
secret: ENV['AUTENTIQUE_WEBHOOK_SECRET'],
signature: request.headers['X-Autentique-Signature']
)
processor.process do |event_type, data|
puts "#{event_type}: #{data['id']}"
endConfiguration
Environment variable
client = Autentique::Client.new(api_key: ENV['AUTENTIQUE_API_KEY'])Global configuration (recommended for Rails)
Autentique.configure do |config|
config.api_key = Rails.application.credentials.dig(:autentique, :api_key)
config.sandbox = Rails.env.development? || Rails.env.test?
end
client = Autentique.clientRails initializer
Create config/initializers/autentique.rb:
Autentique.configure do |config|
config.api_key = Rails.application.credentials.dig(:autentique, :api_key)
config.sandbox = Rails.env.development? || Rails.env.test?
endError Handling
begin
document = client.documents.create(...)
rescue Autentique::AuthenticationError => e
# Invalid or missing API key
rescue Autentique::RateLimitError => e
# 60 requests/minute limit exceeded
rescue Autentique::ValidationError => e
# Invalid input
rescue Autentique::QueryError => e
# GraphQL query failed — e.errors contains details
rescue Autentique::UploadError => e
# File upload failed
rescue Autentique::InvalidSignatureError => e
# Webhook signature verification failed
rescue Autentique::WebhookError => e
# Unknown webhook event type or processing error
rescue Autentique::Error => e
# Base class for all gem errors
endDocumentation
- Documents — creating, retrieving, listing, deleting, and rejecting documents
- Folders — folder management
- Webhooks — processing incoming webhook events
- Configuration Reference — all document and signer options
Testing
bundle exec rspec
COVERAGE=true bundle exec rspecDevelopment
git clone https://github.com/keithyoder/autentique-ruby.git
cd autentique-ruby
bundle install
bundle exec rspec
gem build autentique.gemspecContributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
Resources
License
Available as open source under the MIT License.
Acknowledgments
This gem is not officially maintained by Autentique. It is a community-driven project to simplify Ruby integration with the Autentique API.
Support
Changelog
See CHANGELOG.md.