Sha256: a2f7c80cf34923da5854e8c69af94989456aacbd67e711c6c2876e96a38786be
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module ActiveTiger class Gateway TIGER_GATEWAY_URL = "https://secure.tigergateway.net/api/transact.php" def initialize(params = {}) if defined?(RAILS_ENV) && defined?(RAILS_ROOT) config = ActiveTiger::Configuration.new @username = config.username @password = config.password else @username = params[:username] @password = params[:password] end end ["sale", "credit", "capture", "void", "refund", "update"].each do |operation| define_method(operation) do |params| params.merge! :type => operation make_request(params) end end def authorize(params) params.merge! :type => "auth" make_request(params) end private def make_request(params) params.merge! :username => @username, :password => @password response_string = tiger_gateway.post(params) ActiveTiger::Response.build_from_string(response_string) end def tiger_gateway @tiger_gateway ||= RestClient::Resource.new(TIGER_GATEWAY_URL) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inventables-activetiger-0.1.0 | lib/activetiger/gateway.rb |