Class: XeroGateway::PrivateApp

Inherits:
Gateway
  • Object
show all
Defined in:
lib/xero_gateway/private_app.rb

Constant Summary

Constants included from Http

Http::OPEN_TIMEOUT, Http::READ_TIMEOUT, Http::ROOT_CA_FILE

Instance Attribute Summary

Attributes inherited from Gateway

#client, #logger, #xero_url

Instance Method Summary collapse

Methods inherited from Gateway

#build_contact, #build_credit_note, #build_invoice, #create_bank_transaction, #create_contact, #create_credit_note, #create_credit_notes, #create_invoice, #create_invoices, #create_manual_journal, #get_accounts, #get_accounts_list, #get_bank_transaction, #get_bank_transactions, #get_contact_by_id, #get_contact_by_number, #get_contacts, #get_credit_note, #get_credit_notes, #get_currencies, #get_invoice, #get_invoices, #get_manual_journal, #get_manual_journals, #get_organisation, #get_tax_rates, #get_tracking_categories, #update_bank_transaction, #update_contact, #update_contacts, #update_invoice, #update_manual_journal

Methods included from Dates

included

Methods included from Http

#http_get, #http_post, #http_put

Constructor Details

#initialize(consumer_key, consumer_secret, path_to_private_key, options = {}) ⇒ PrivateApp

The consumer key and secret here correspond to those provided to you by Xero inside the API Previewer.



6
7
8
9
10
11
12
13
14
15
# File 'lib/xero_gateway/private_app.rb', line 6

def initialize(consumer_key, consumer_secret, path_to_private_key, options = {})
  options.merge!(
    :signature_method => 'RSA-SHA1',
    :private_key_file => path_to_private_key
  )
  
  @xero_url = options[:xero_url] || "https://api.xero.com/api.xro/2.0"
  @client   = OAuth.new(consumer_key, consumer_secret, options)
  @client.authorize_from_access(consumer_key, consumer_secret)
end