Skip to content

Commit

Permalink
update documentation for private apps and update gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
tlconnor committed Apr 5, 2010
1 parent 1bdb92f commit 71958b8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
20 changes: 19 additions & 1 deletion README.textile
Expand Up @@ -19,14 +19,32 @@ h3. Consumer Key & Secret
First off, you'll need to get a Consumer Key/Secret pair for your application from Xero.
Head to "http://api.xero.com":http://api.xero.com, log in and then click My Applications > Add Application.

(If you're unsure about the Callback URL, specify nothing - it will become clear a bit later)
If you want to create a private application (that accesses your own Xero account rather than your users), you'll need to generate an RSA keypair and an X509 certificate. This can be done with OpenSSL as below:
<pre><code> openssl genrsa –out privatekey.pem 1024
openssl req –newkey rsa:1024 –x509 –key privatekey.pem –out publickey.cer –days 365
openssl pkcs12 –export –out public_privatekey.pfx –inkey privatekey.pem –in publickey.cer
</code></pre>

On the right-hand-side of your application's page there's a box titled "OAuth Credentials". Use the Key and Secret from this box in order to set up a new Gateway instance.

(If you're unsure about the Callback URL, specify nothing - it will become clear a bit later)


<pre><code> require 'xero_gateway'
gateway = XeroGateway::Gateway.new(YOUR_OAUTH_CONSUMER_KEY, YOUR_OAUTH_CONSUMER_SECRET)
</code></pre>

or for private applications

<pre><code> require 'xero_gateway'
gateway = XeroGateway::Gateway.new(
YOUR_OAUTH_CONSUMER_KEY,
YOUR_OAUTH_CONSUMER_SECRET,
:signature_method => "RSA-SHA1",
:private_key_file => PATH_TO_YOUR_PRIVATE_KEY)
</code></pre>


h3. Request Token

You'll then need to get a Request Token from Xero.
Expand Down
1 change: 1 addition & 0 deletions lib/xero_gateway.rb
Expand Up @@ -5,6 +5,7 @@
require "builder"
require "bigdecimal"
require "oauth"
require 'oauth/signature/rsa/sha1'
require "forwardable"
require "active_support"

Expand Down
41 changes: 31 additions & 10 deletions xero_gateway.gemspec
@@ -1,62 +1,83 @@
Gem::Specification.new do |s|
s.name = "xero_gateway"
s.version = "1.0.5"
s.date = "2009-09-25"
s.version = "2.0"
s.date = "2010-04-06"
s.summary = "Enables ruby based applications to communicate with the Xero API"
s.email = "tlconnor@gmail.com"
s.email = "tim@connorsoftware.com"
s.homepage = "http://github.com/tlconnor/xero_gateway"
s.description = "Enables ruby based applications to communicate with the Xero API"
s.has_rdoc = false
s.authors = ["Tim Connor"]
s.authors = ["Tim Connor", "Nik Wakelin"]
s.add_dependency('builder', '>= 2.1.2')
s.add_dependency('oauth', '>= 0.3.6')
s.files = ["CHANGELOG.textile",
"init.rb",
"LICENSE",
"Rakefile",
"README.textile",
"README.textile",
"examples/oauth.rb",
"lib/xero_gateway.rb",
"lib/xero_gateway/account.rb",
"lib/xero_gateway/accounts_list.rb",
"lib/xero_gateway/address.rb",
"lib/xero_gateway/ca-certificates.crt",
"lib/xero_gateway/contact.rb",
"lib/xero_gateway/currency.rb",
"lib/xero_gateway/dates.rb",
"lib/xero_gateway/error.rb",
"lib/xero_gateway/exceptions.rb",
"lib/xero_gateway/gateway.rb",
"lib/xero_gateway/http.rb",
"lib/xero_gateway/http_encoding_helper.rb",
"lib/xero_gateway/invoice.rb",
"lib/xero_gateway/line_item.rb",
"lib/xero_gateway/money.rb",
"lib/xero_gateway/phone.rb",
"lib/xero_gateway/oauth.rb",
"lib/xero_gateway/organisation.rb",
"lib/xero_gateway/payment.rb",
"lib/xero_gateway/phone.rb",
"lib/xero_gateway/response.rb",
"lib/xero_gateway/tax_rate.rb",
"lib/xero_gateway/tracking_category.rb",
"test/test_helper.rb",
"test/integration/accounts_list_test.rb",
"test/integration/create_contact_test.rb",
"test/integration/create_invoice_test.rb",
"test/integration/get_accounts_test.rb",
"test/integration/get_contact_test.rb",
"test/integration/get_contacts_test.rb",
"test/integration/get_currencies_test.rb",
"test/integration/get_invoice_test.rb",
"test/integration/get_invoices_test.rb",
"test/integration/get_organisation_test.rb",
"test/integration/get_tax_rates_test.rb",
"test/integration/get_tracking_categories_test.rb",
"test/integration/update_contact_test.rb",
"test/stub_responses/accounts.xml",
"test/stub_responses/api_exception.xml",
"test/stub_responses/contact.xml",
"test/stub_responses/contacts.xml",
"test/stub_responses/create_invoice.xml",
"test/stub_responses/currencies.xml",
"test/stub_responses/invalid_api_key_error.xml",
"test/stub_responses/invalid_consumer_key",
"test/stub_responses/invalid_request_token",
"test/stub_responses/invoice.xml",
"test/stub_responses/invoice_not_found_error.xml",
"test/stub_responses/invoices.xml",
"test/stub_responses/invalid_api_key_error.xml",
"test/stub_responses/invalid_customer_key_error.xml",
"test/stub_responses/organisation.xml",
"test/stub_responses/tax_rates.xml",
"test/stub_responses/token_expired",
"test/stub_responses/tracking_categories.xml",
"test/stub_responses/invoice_not_found_error.xml",
"test/stub_responses/unknown_error.xml",
"test/test_helper.rb",
"test/unit/account_test.rb",
"test/unit/contact_test.rb",
"test/unit/currency_test.rb",
"test/unit/gateway_test.rb",
"test/unit/invoice_test.rb",
"test/unit/oauth_test.rb",
"test/unit/organisation_test.rb",
"test/unit/tax_rate_test.rb",
"test/unit/tracking_category_test.rb",
"test/xsd/README",
"test/xsd/create_contact.xsd",
Expand Down

0 comments on commit 71958b8

Please sign in to comment.