Sha256: 8cfde7f64da499d3e959c0b2565b6a56be0aa88aed3aac9291ebe901f3663e72
Contents?: true
Size: 798 Bytes
Versions: 1
Compression:
Stored size: 798 Bytes
Contents
require 'net/http' require 'uri' require 'active_support/all' # require 'ostruct' require 'payture/hash' class Payture::API def initialize(host) raise ArgumentError, "host is required" if not host @host = host end def host @host end def request(path, merchant, params) data = { VWID: merchant, DATA: params.url_encode } # puts "request.data: #{data}" uri = URI::HTTPS.build({ host: @host, path: path }) # puts "URI: #{uri}" http = Net::HTTP.new(uri.host, uri.port) # http.use_ssl = true req = Net::HTTP::Post.new(uri.request_uri) req.body = data.to_query # puts "request: #{req}" res = http.request(req) # OpenStruct.new(Hash.from_xml(res.body).downcase_key) Hash.from_xml(res.body) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
payture_api-0.1.6 | lib/payture/api.rb |