Class: Xeroizer::PartnerApplication
- Inherits:
-
GenericApplication
- Object
- GenericApplication
- Xeroizer::PartnerApplication
- Extended by:
- Forwardable
- Defined in:
- lib/xeroizer/partner_application.rb
Constant Summary
Constants included from Http
Instance Attribute Summary
Attributes inherited from GenericApplication
#client, #logger, #rate_limit_max_attempts, #rate_limit_sleep, #xero_url
Instance Method Summary collapse
-
#initialize(consumer_key, consumer_secret, path_to_private_key, path_to_ssl_client_cert, path_to_ssl_client_key, options = {}) ⇒ PartnerApplication
constructor
Partner applications allow for public AccessToken’s received via the stanard OAuth authentication process to be renewed up until the session’s expiry.
Methods included from Record::ApplicationHelper
Methods included from Http
#http_get, #http_post, #http_put
Constructor Details
#initialize(consumer_key, consumer_secret, path_to_private_key, path_to_ssl_client_cert, path_to_ssl_client_key, options = {}) ⇒ PartnerApplication
Partner applications allow for public AccessToken’s received via the stanard OAuth authentication process to be renewed up until the session’s expiry. The default session expiry for Xero is 365 days and the default AccessToken expiry is 30 minutes.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/xeroizer/partner_application.rb', line 20 def initialize(consumer_key, consumer_secret, path_to_private_key, path_to_ssl_client_cert, path_to_ssl_client_key, = {}) = { :xero_url => 'https://api-partner.network.xero.com/api.xro/2.0', :site => 'https://api-partner.network.xero.com', :authorize_url => 'https://api.xero.com/oauth/Authorize', :signature_method => 'RSA-SHA1' } = .merge().merge( :private_key_file => path_to_private_key, :ssl_client_cert => OpenSSL::X509::Certificate.new(File.read(path_to_ssl_client_cert)), :ssl_client_key => OpenSSL::PKey::RSA.new(File.read(path_to_ssl_client_key)) ) super(consumer_key, consumer_secret, ) # Load up an existing token if passed the token/key. if [:access_token] && [:access_key] ([:access_token], [:access_key]) end # Save the session_handle if passed in so we can renew the token. if [:session_handle] client.session_handle = [:session_handle] end end |