Sha256: 03d7554b975259399d4c4a485cb85d01e55dc43ae9b1f93a311a239d21dab58d

Contents?: true

Size: 1.24 KB

Versions: 85

Compression:

Stored size: 1.24 KB

Contents

require 'rubygems'
require 'active_support'
require 'lib/active_merchant'


class GatewaySupport #:nodoc:
  ACTIONS = [:purchase, :authorize, :capture, :void, :credit, :recurring]
  
  include ActiveMerchant::Billing

  attr_reader :gateways
  
  def initialize
    @gateways = Gateway.implementations.sort_by(&:name)
    @gateways.delete(ActiveMerchant::Billing::BogusGateway)
  end
  
  def each_gateway
    @gateways.each{|g| yield g }
  end
  
  def features
    width = 15
    
    print "Name".center(width + 20)
    ACTIONS.each{|f| print "#{f.to_s.capitalize.center(width)}" }
    puts
    
    each_gateway do |g|
      print "#{g.display_name.ljust(width + 20)}"
      ACTIONS.each do |f|
        print "#{(g.instance_methods.include?(f.to_s) ? "Y" : "N").center(width)}"
      end
      puts
    end
  end
  
  def to_rdoc
    each_gateway do |g|
      puts "* {#{g.display_name}}[#{g.homepage_url}] - #{g.supported_countries.join(', ')}"
    end
  end
  
  def to_textile
    each_gateway do |g|
      puts %/ * "#{g.display_name}":#{g.homepage_url} [#{g.supported_countries.join(', ')}]/
    end
  end
  
  def to_s
    each_gateway do |g|
      puts "#{g.display_name} - #{g.homepage_url} [#{g.supported_countries.join(', ')}]"
    end
  end
end


    

Version data entries

85 entries across 85 versions & 24 rubygems

Version Path
johnideal-activemerchant-1.4.10 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.11 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.4 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.5 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.6 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.7 lib/support/gateway_support.rb
johnideal-activemerchant-1.4.8 lib/support/gateway_support.rb
martinstannard-activemerchant-0.1.0 lib/support/gateway_support.rb
mattbauer-activemerchant-1.4.2 lib/support/gateway_support.rb
seamusabshere-active_merchant-1.4.2.1 lib/support/gateway_support.rb
seamusabshere-active_merchant-1.4.2.3 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.3 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.4 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.5 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.6 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.7 lib/support/gateway_support.rb
tomriley-active_merchant-1.4.2.8 lib/support/gateway_support.rb
tomriley-tomriley-active_merchant-1.4.2.4 lib/support/gateway_support.rb
goldstar-activemerchant-1.4.2.7 lib/support/gateway_support.rb
activemerchant-abn-ideal-1.7.0c lib/support/gateway_support.rb