Class: SecureTrading::Connection
- Inherits:
-
Object
- Object
- SecureTrading::Connection
- Defined in:
- lib/secure_trading/connection.rb
Defined Under Namespace
Classes: CertificateFileNotFound
Instance Attribute Summary collapse
-
#certificate_path ⇒ Object
readonly
Returns the value of attribute certificate_path.
-
#site_reference ⇒ Object
readonly
Returns the value of attribute site_reference.
-
#xpay_client ⇒ Object
readonly
Returns the value of attribute xpay_client.
Instance Method Summary collapse
- #certificate ⇒ Object
-
#initialize(xpay_client, site_reference, certificate_path, options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #options ⇒ Object
Constructor Details
#initialize(xpay_client, site_reference, certificate_path, options = {}) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 12 13 14 |
# File 'lib/secure_trading/connection.rb', line 8 def initialize(xpay_client, site_reference, certificate_path, = {}) @xpay_client = xpay_client @site_reference = site_reference @certificate_path = certificate_path @options = @options[:request_cache_path] ||= File.join('', 'tmp', 'securetrading', 'requests') end |
Instance Attribute Details
#certificate_path ⇒ Object (readonly)
Returns the value of attribute certificate_path.
6 7 8 |
# File 'lib/secure_trading/connection.rb', line 6 def certificate_path @certificate_path end |
#site_reference ⇒ Object (readonly)
Returns the value of attribute site_reference.
6 7 8 |
# File 'lib/secure_trading/connection.rb', line 6 def site_reference @site_reference end |
#xpay_client ⇒ Object (readonly)
Returns the value of attribute xpay_client.
6 7 8 |
# File 'lib/secure_trading/connection.rb', line 6 def xpay_client @xpay_client end |
Instance Method Details
#certificate ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/secure_trading/connection.rb', line 16 def certificate if File.exist?(self.certificate_path) File.read(self.certificate_path) else raise CertificateFileNotFound, "Certificate file was not located at #{self.certificate_path}" end end |
#options ⇒ Object
24 25 26 |
# File 'lib/secure_trading/connection.rb', line 24 def @options end |