Ruby SDK
The official Taxu Ruby gem provides idiomatic Ruby access to the Taxu API with elegant syntax and comprehensive error handling.
What is the Taxu Ruby SDK?
The Taxu Ruby gem brings the power of automated tax compliance and filing to Ruby and Rails applications. Built with Ruby conventions and idioms in mind, it provides a beautiful, expressive API for handling tax operations in your Ruby projects.
Whether you're building a Rails SaaS application, managing contractor payments, or integrating tax calculations into your Ruby stack, the gem handles IRS compliance, form generation, and e-filing with elegant Ruby syntax that Ruby developers love.
Perfect For:
- • Ruby on Rails SaaS platforms
- • E-commerce and marketplace apps
- • Financial services platforms
- • Contractor payment systems
Ruby Advantages:
- • Idiomatic Ruby conventions
- • Rails integration out of the box
- • Elegant error handling
- • Active Record style syntax
v2.5.0
Ruby 2.7+
Installation
Add to your Gemfile:
Gemfile
gem 'taxu'Then run:
terminal
bundle installAuthentication
Configure your API key:
require 'taxu' Taxu.api_key = 'your_api_key_here'
Basic Usage
File a Form 1099-NEC:
filing = Taxu::Tax.file_1099_nec(
tax_year: 2024,
payer: {
name: 'Acme Corp',
ein: '12-3456789',
address: '123 Business St'
},
recipient: {
name: 'John Contractor',
ssn: '123-45-6789',
address: '456 Worker Ave'
},
non_employee_compensation: 15000
)
puts filing.id # fil_1234567890More Examples
Calculate Federal Tax
result = Taxu::Tax.calculate(
income: 85000,
deductions: 12000,
filing_status: 'single',
state: 'CA'
)
puts "Federal tax: $#{result.federal_tax}"
puts "State tax: $#{result.state_tax}"
puts "Effective rate: #{result.effective_rate}%"Upload Tax Document
document = Taxu::Documents.upload(
file: File.open('w2.pdf'),
type: 'w2',
tax_year: 2024
)
puts "Document ID: #{document.id}"
puts "Status: #{document.status}"Error Handling
begin
filing = Taxu::Tax.file_1099_nec(...)
rescue Taxu::AuthenticationError
puts "Invalid API key"
rescue Taxu::ValidationError => e
puts "Validation error: #{e.message}"
rescue Taxu::RateLimitError
puts "Rate limit exceeded"
rescue Taxu::TaxuError => e
puts "API error: #{e}"
end