Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A library to check the balance of gift cards.
Ruby
branch: master

This branch is 1 commit ahead, 1 commit behind scjudd:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
giftcards.rb

README

#!/usr/bin/env ruby
require 'giftcards'

cards = CardsArray.new([
  VanillaVisa.new('4315-1234-5678-9012', '01/13', 123),
  VanillaMasterCard.new('5154-1234-5678-9012', '01/13', 123),
  GiftCardMallVisa.new('4416-6912-3456-7890', '9999', 491),
])
cards.sort_by_balance!

cards.each do |c|
  puts "#{c.masked_number}: #{c.balance_as_s}"
end
puts "Total: #{cards.total_as_s}"
Something went wrong with that request. Please try again.