Determine if a credit card is valid
edit Gemfile
gem 'activemerchant'
bundle install
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.3)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4.20120614141756)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.7.0)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.11)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using active_utils (1.0.5)
Using json (1.7.5)
Using money (5.0.0)
Using nokogiri (1.5.5)
Using activemerchant (1.28.0)
Using arel (3.0.2.20120221150532)
Using tzinfo (0.3.33)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using bcrypt-ruby (3.0.1)
Using bundler (1.2.0)
Using highline (1.6.15)
Using jruby-pageant (1.1.1)
Using net-ssh (2.6.0)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.13.4)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.8)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.3)
Using mysql2 (0.3.11)
Using rails (3.2.8)
Using sass (3.2.1)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Using will_paginate (3.0.3)
Updating files in vendor/cache
Could not find activesupport-3.2.8.gem for installation
edit script/creditcard.rb
credit_card = ActiveMerchant::Billing::CreditCard.new(
:number => '4111111111111111',
:month => '8',
:year => '2009',
:first_name => 'Tobias',
:last_name => 'Luetke',
:verification_value => '123'
)
puts "Is #{credit_card.number} valid? #{credit_card.valid?}"
rails runner script/creditcard.rb
Is 4111111111111111 valid? false