README.textile in tlconnor-xero_gateway-1.0.3 vs README.textile in tlconnor-xero_gateway-1.0.4
- old
+ new
@@ -1,10 +1,10 @@
h1. Xero API wrapper
h2. Introduction
-This library is designed to help ruby based applications communicate with the publicly available API for Xero. If you are unfamiliar with the API, you should first read the documentation, located here "http://blog.xero.com/developer/":http://blog.xero.com/developer/
+This library is designed to help ruby / rails based applications communicate with the publicly available API for Xero. If you are unfamiliar with the API, you should first read the documentation, located here "http://blog.xero.com/developer/":http://blog.xero.com/developer/
h2. Prerequisites
To use the Xero API you must have a Xero API Key. If you don't know what this is, and don't know how to get one, this library is probably not for you.
@@ -108,31 +108,29 @@
h3. PUT /api.xro/1.0/invoice
-Inserts an invoice for a specific organization in Xero. (Currently only adding new invoices is allowed).
+Inserts an invoice for a specific organization in Xero (Currently only adding new invoices is allowed).
+
+Invoice and line item totals are calculated automatically.
<pre><code>
invoice = XeroGateway::Invoice.new({
:invoice_type => "ACCREC",
:due_date => 1.month.from_now,
:invoice_number => "YOUR INVOICE NUMBER",
:reference => "YOUR REFERENCE (NOT NECESSARILY UNIQUE!)",
:tax_inclusive => true,
- :includes_tax => false,
- :sub_total => 1000,
- :total_tax => 125,
- :total => 1250
+ :includes_tax => false
})
invoice.contact = XeroGateway::Contact.new(:name => "THE NAME OF THE CONTACT")
invoice.contact.phone.number = "12345"
invoice.contact.address.line_1 = "LINE 1 OF THE ADDRESS"
invoice.line_items << XeroGateway::LineItem.new(
:description => "THE DESCRIPTION OF THE LINE ITEM",
:unit_amount => 1000,
:tax_amount => 125,
- :line_amount => 1000,
:tracking_category => "THE TRACKING CATEGORY FOR THE LINE ITEM",
:tracking_option => "THE TRACKING OPTION FOR THE LINE ITEM"
)
gateway.create_invoice(invoice)
@@ -144,12 +142,27 @@
Gets all accounts for a specific organization in Xero.
<pre><code>
gateway.get_accounts
</code></pre>
+For more advanced (and cached) access to the accounts list, use the following.
+<pre><code>
+ accounts_list = gateway.get_accounts_list
+
+ # Finds account with code of '200'
+ sales_account = accounts_list.find_by_code(200)
+
+ # Finds all EXPENSE accounts
+ all_expense_accounts = accounts_list.find_all_by_type('EXPENSE')
+
+ # Finds all accounts with tax_type == 'OUTPUT'
+ # For a list of valid tax types see XeroGateway::Account::TAX_TYPE
+ all_output_tax_accounts = accounts_list.find_all_by_tax_type('OUTPUT')
+</code></pre>
+
h3. GET /api.xro/1.0/tracking
Gets all tracking categories and their options for a specific organization in Xero.
<pre><code>
gateway.get_tracking_categories
-</code></pre>
\ No newline at end of file
+</code></pre>