Class: VirtualMerchant::Communication
- Inherits:
-
Object
- Object
- VirtualMerchant::Communication
- Defined in:
- lib/virtual_merchant/communication.rb
Instance Attribute Summary collapse
-
#http_referer ⇒ Object
Returns the value of attribute http_referer.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#url ⇒ Object
Returns the value of attribute url.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(data) ⇒ Communication
constructor
A new instance of Communication.
- #send ⇒ Object
Constructor Details
#initialize(data) ⇒ Communication
Returns a new instance of Communication.
8 9 10 11 12 13 |
# File 'lib/virtual_merchant/communication.rb', line 8 def initialize(data) @xml = data[:xml] @url = data[:url] @uri = URI.parse(@url) @http_referer = data[:http_referer] end |
Instance Attribute Details
#http_referer ⇒ Object
Returns the value of attribute http_referer.
6 7 8 |
# File 'lib/virtual_merchant/communication.rb', line 6 def http_referer @http_referer end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/virtual_merchant/communication.rb', line 6 def uri @uri end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/virtual_merchant/communication.rb', line 6 def url @url end |
#xml ⇒ Object
Returns the value of attribute xml.
6 7 8 |
# File 'lib/virtual_merchant/communication.rb', line 6 def xml @xml end |
Instance Method Details
#send ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/virtual_merchant/communication.rb', line 15 def send http = Net::HTTP.new(@uri.host, @uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE begin http.post(uri.request_uri, xml, header).body rescue Exception => e false end end |