module PayPal::SDK::Core::Authentication
Contains methods to format credentials for HTTP protocol.
Example¶ ↑
include Authentication credential(url) base_credential third_party_credential(url) add_certificate(http)
Public Instance Methods
add_certificate(http)
click to toggle source
Configure ssl certificate to HTTP object
Argument¶ ↑
-
http
– Net::HTTP object
# File lib/paypal-sdk/core/authentication.rb, line 56 def add_certificate(http) if base_credential.is_a? Credential::Certificate http.cert = base_credential.cert http.key = base_credential.key else http.cert = nil http.key = nil end end
base_credential()
click to toggle source
Get base credential
# File lib/paypal-sdk/core/authentication.rb, line 24 def base_credential @base_credential ||= if config.cert_path Credential::Certificate.new(config) else Credential::Signature.new(config) end end
base_credential_type()
click to toggle source
Get base credential type
# File lib/paypal-sdk/core/authentication.rb, line 34 def base_credential_type config.cert_path ? :certificate : :three_token end
credential(url)
click to toggle source
set_config(*args)
click to toggle source
Clear cached variables on changing the configuration.
Calls superclass method
PayPal::SDK::Core::Configuration#set_config
# File lib/paypal-sdk/core/authentication.rb, line 48 def set_config(*args) @base_credential = nil super end
third_party_credential(url)
click to toggle source
Get third party credential
# File lib/paypal-sdk/core/authentication.rb, line 39 def third_party_credential(url) if config.token and config.token_secret Credential::ThirdParty::Token.new(base_credential, config, url) elsif config.subject Credential::ThirdParty::Subject.new(base_credential, config) end end