Class: Xeroizer::PrivateApplication

Inherits:
GenericApplication show all
Extended by:
Forwardable
Defined in:
lib/xeroizer/private_application.rb

Constant Summary

Constants included from Http

Http::ACCEPT_MIME_MAP

Instance Attribute Summary

Attributes inherited from GenericApplication

#client, #logger, #rate_limit_max_attempts, #rate_limit_sleep, #xero_url

Instance Method Summary collapse

Methods included from Record::ApplicationHelper

#record, #report

Methods included from Http

#http_get, #http_post, #http_put

Constructor Details

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

Private applications are defined in the Xero API website and can be accessed in the background without ever requiring a redirect to the Xero website for authorisation.

Parameters:

  • consumer_key (String)

    consumer key/token from application developer (found at api.xero.com for your application).

  • consumer_secret (String)

    consumer secret from application developer (found at api.xero.com for your application).

  • path_to_private_key (String)

    aapplication’s private key for message signing (uploaded to api.xero.com)

  • options (Hash) (defaults to: {})

    other options to pass to the GenericApplication constructor



17
18
19
20
21
22
23
24
# File 'lib/xeroizer/private_application.rb', line 17

def initialize(consumer_key, consumer_secret, path_to_private_key, options = {})
  options.merge!(
    :signature_method => 'RSA-SHA1',
    :private_key_file => path_to_private_key
  )
  super(consumer_key, consumer_secret, options)      
  @client.authorize_from_access(consumer_key, consumer_secret)
end