Class: XeroGateway::PartnerApp

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

Defined Under Namespace

Classes: CertificateRequired

Constant Summary collapse

NO_PRIVATE_KEY_ERROR_MESSAGE =
"You need to provide your private key (corresponds to the public key you uploaded at api.xero.com) as :private_key_file (should be .crt or .pem files)"

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, #create_payment, #get_accounts, #get_accounts_list, #get_bank_transaction, #get_bank_transactions, #get_contact_by_id, #get_contact_by_number, #get_contact_group_by_id, #get_contact_groups, #get_contacts, #get_credit_note, #get_credit_notes, #get_currencies, #get_invoice, #get_invoices, #get_items, #get_manual_journal, #get_manual_journals, #get_organisation, #get_payment, #get_payments, #get_report, #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, options = {}) ⇒ PartnerApp

Returns a new instance of PartnerApp.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/xero_gateway/partner_app.rb', line 10

def initialize(consumer_key, consumer_secret, options = {})
  raise CertificateRequired.new(NO_PRIVATE_KEY_ERROR_MESSAGE) unless options[:private_key_file]

  defaults = {
    :site             => "https://api.xero.com",
    :authorize_url    => 'https://api.xero.com/oauth/Authorize',
    :signature_method => 'RSA-SHA1',
  }

  options = defaults.merge(options)

  super(consumer_key, consumer_secret, defaults.merge(options))
end

Instance Method Details

#set_session_handle(handle) ⇒ Object



24
25
26
# File 'lib/xero_gateway/partner_app.rb', line 24

def set_session_handle(handle)
  client.session_handle = handle
end