Official Ruby SDK for Auditledge.
gem install auditledgeOr in your Gemfile:
gem 'auditledge'require 'auditledge'
client = Auditledge::Client.new('your_api_key')
client.log({
actor: { id: 'user_123', name: 'Alice' },
action: 'invoice.deleted',
resource: { type: 'invoice', id: 'inv_456' },
organization_id: 'org_789'
})
events = client.query(organization_id: 'org_789', limit: 50)# config/initializers/auditledge.rb
AUDIT = Auditledge::Client.new(ENV['AUDITLEDGE_API_KEY'])
# In your controller
def destroy
@invoice.destroy
AUDIT.log({
actor: { id: current_user.id.to_s, name: current_user.name },
action: 'invoice.deleted',
resource: { type: 'invoice', id: @invoice.id.to_s },
organization_id: current_user.organization_id.to_s
})
endMIT