Class: XeroGateway::PartnerApp
- Defined in:
- lib/xero_gateway/partner_app.rb
Defined Under Namespace
Classes: CertificateRequired
Constant Summary collapse
- NO_SSL_CLIENT_CERT_MESSAGE =
"You need to provide a client ssl certificate and key pair (these are the ones you got from Entrust and should not be password protected) as :ssl_client_cert and :ssl_client_key (should be .crt or .pem files)"
- 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
Instance Method Summary collapse
-
#initialize(consumer_key, consumer_secret, options = {}) ⇒ PartnerApp
constructor
A new instance of PartnerApp.
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
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.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/xero_gateway/partner_app.rb', line 11 def initialize(consumer_key, consumer_secret, = {}) raise CertificateRequired.new(NO_SSL_CLIENT_CERT_MESSAGE) unless [:ssl_client_cert] raise CertificateRequired.new(NO_SSL_CLIENT_CERT_MESSAGE) unless [:ssl_client_key] raise CertificateRequired.new(NO_PRIVATE_KEY_ERROR_MESSAGE) unless [:private_key_file] .merge!( :site => "https://api-partner.network.xero.com", :authorize_url => 'https://api.xero.com/oauth/Authorize', :signature_method => 'RSA-SHA1', :ssl_client_cert => OpenSSL::X509::Certificate.new(File.read([:ssl_client_cert])), :ssl_client_key => OpenSSL::PKey::RSA.new(File.read([:ssl_client_key])), :private_key_file => [:private_key_file] ) @xero_url = [:xero_url] || "https://api-partner.xero.com/api.xro/2.0" @client = OAuth.new(consumer_key, consumer_secret, ) end |