Sha256: d9b802fe3e5c444ffd75272d9ba9c63b59313a3b296f14447e07477adee3603f
Contents?: true
Size: 1.53 KB
Versions: 4
Compression:
Stored size: 1.53 KB
Contents
module Paydunya module Utilities def http_json_request(baseurl,payload={}) conn = Faraday.new(:url => baseurl, :ssl => {:verify => false}) do |faraday| faraday.request :json faraday.adapter Faraday.default_adapter end result = conn.post do |req| req.headers["User-Agent"] = "Paydunya Checkout API Ruby client v1 aka Neptune" req.headers['PAYDUNYA-PUBLIC-KEY'] = Paydunya::Setup.public_key req.headers['PAYDUNYA-PRIVATE-KEY'] = Paydunya::Setup.private_key req.headers['PAYDUNYA-MASTER-KEY'] = Paydunya::Setup.master_key req.headers['PAYDUNYA-TOKEN'] = Paydunya::Setup.token req.headers['PAYDUNYA-MODE'] = Paydunya::Setup.mode req.body = hash_to_json payload end json_to_hash(result.body) end def http_get_request(baseurl) conn = Faraday.new(:url => baseurl, :ssl => {:verify => false}) result = conn.get do |req| req.headers["User-Agent"] = "Paydunya Checkout API Ruby client v1 aka Neptune" req.headers['PAYDUNYA-PUBLIC-KEY'] = Paydunya::Setup.public_key req.headers['PAYDUNYA-PRIVATE-KEY'] = Paydunya::Setup.private_key req.headers['PAYDUNYA-MASTER-KEY'] = Paydunya::Setup.master_key req.headers['PAYDUNYA-TOKEN'] = Paydunya::Setup.token req.headers['PAYDUNYA-MODE'] = Paydunya::Setup.mode end json_to_hash(result.body) end def hash_to_json(params={}) MultiJson.dump params end def json_to_hash(params={}) MultiJson.load params end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
paydunya-1.0.5 | lib/paydunya/utilities.rb |
paydunya-1.0.4 | lib/paydunya/utilities.rb |
paydunya-1.0.3 | lib/paydunya/utilities.rb |
paydunya-1.0.2 | lib/paydunya/utilities.rb |