# trac4r-1.2.3 Documentation

trac4r: Ruby wrapper for the Trac XML-RPC API

Author | Niklas Cathor
Author | David Copeland
License | See LICENSE in source distribution

For more information on the Trac XML-RPC see the plugin’s page on trac-hacks.com

Thanks to the original author, Niklas Cathor, who has done most of the work.

Note that I (David Copeland) will probably not be making more changes to this, as my main reason for picking this up was that I am using Trac where I work. We are moving away from Trac, so I have less need to do anything with this library. If someone is interested in claiming ownership, specifically owning the gem on Gemcutter, just let me know and I'll hand it over.

## Install

    # Only if you haven't set up gemcutter yet
    sudo gem install gemcutter
    sudo gem tumble

    # Once Gemcutter is setup
    sudo gem install trac4r

## Overview

This wraps the Trac XML-RPC plugin.

    require 'rubygems'
    require 'trac4r'

    # Note that you need to point to the XMLRPC root and not the root of the trac web interface
    trac = Trac.new("http://www.example.com/trac/project/xmlrpc","username","password")
    trac.tickets.list # get all tickets
    trac.tickets.get 2334 # Get ticket #2334

### Tickets

Trac’s backbone is tickets. The Tickets class contains many useful methods, but can also run arbitrary queries against Trac using a more Rubyesque syntax:

    # Gets all tickets in the "Web" component with a status of either "assigned"
    # "accepted", or "new"
    available_web_tickets = trac.tickets.query(:component => 'Web', :status => [:assigned,:accepted,:new])

    # Ticktes that are not closed
    unclosed_tickets = trac.tickets.query(:status => "!closed")

    # This is a bit wierd, the "!" in the first element means "none of these values"
    not_closed_nor_testing = trac.tickets.query(:status => ["!closed","test"])

## More Info

- RDoc

- Source

## Files

- README.rdoc

## Classes/Modules

- Trac
- Trac::Base
- Trac::Query
- Trac::Ticket
- Trac::Tickets
- Trac::TracException
- Trac::Wiki

## Methods

- ::load — Trac::Ticket
- ::new — Trac::Query
- ::new — Trac::Wiki
- ::new — Trac::Base
- ::new — Trac::TracException
- ::new — Trac::Ticket
- ::new — Trac::Tickets
- ::new — Trac
- #actions — Trac::Tickets
- #api_version — Trac::Base
- #attachments — Trac::Tickets
- #attachments — Trac::Wiki
- #changelog — Trac::Tickets
- #changes — Trac::Tickets
- #check — Trac::Ticket
- #create — Trac::Tickets
- #delete — Trac::Wiki
- #delete — Trac::Tickets
- #delete_attachment — Trac::Tickets
- #delete_attachment — Trac::Wiki
- #get — Trac::Tickets
- #get_all — Trac::Tickets
- #get_attachment — Trac::Tickets
- #get_attachment — Trac::Wiki
- #get_html — Trac::Wiki
- #get_info — Trac::Wiki
- #get_raw — Trac::Wiki
- #get_settings — Trac::Tickets
- #list — Trac::Wiki
- #list — Trac::Tickets
- #list_closed — Trac::Tickets
- #message — Trac::TracException
- #method_missing — Trac::Ticket
- #put — Trac::Wiki
- #put_attachment — Trac::Tickets
- #put_attachment — Trac::Wiki
- #query — Trac::Tickets
- #query — Trac::Base
- #query — Trac::Query
- #raw_to_html — Trac::Wiki
- #settings — Trac::Tickets
- #update — Trac::Tickets
- #url — Trac::TracException

[Validate]

Generated with the Darkfish Rdoc Generator 2.