Sha256: 219af16882fc7907ac7eccde8fec678ab6a1380f6db2ee38d15c811e33852a4d

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require 'net/https'
require 'net/http'
require 'open-uri'
require 'openssl'
namespace :przelewy24_payment do
  desc "Test if the connection with Przelewy24 is correct"
  task :test_connection => :environment do
    url = URI.parse(Przelewy24Payment.test_connection_url)
    req = Net::HTTP::Post.new(url.path,{"User-Agent" => "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10"})
    req.form_data = Przelewy24Payment.test_connection_params
    con = Net::HTTP.new(url.host, 443)
    con.use_ssl = true
    con.verify_mode = OpenSSL::SSL::VERIFY_NONE
    response = con.start {|http| http.request(req)}
    puts Przelewy24Payment.parse_response response.body
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
przelewy24_payment-0.2.0 lib/tasks/test_connection.rake