stripe/stripe-ruby — pull request #177 by bih (2014-11-18 17:31:43+00:00)
Title: Added support for USB card readers

Having bought a USB magnetic card reader [(Find an example here)](http://www.ebay.co.uk/itm/NEW-3-Track-USB-Magnetic-Credit-Card-Stripe-Swipe-Reader-Scanner-UK-USB-PC-/271221092193), I thought it would be a good addition to add basic magnetic card reader support for Stripe.

With the updates I've added, it is this simple through the console:
```
card = Stripe::Reader.read
card[:cvc] = "" # The reader doesn't provide CVC, but does everything else.
Stripe::Customer.retrieve("customer_id").cards.create(:card => card)
```

Alternatively, if you grab the magnetic card scheme from the reader by other means, you can just pass it through the `.parse` function:
```
card = Stripe::Reader.parse("%B1234123412341234^CardUser/John^030510100000019301000000877000000?")
card[:cvc] = "321"
Stripe::Customer.retrieve("cus_3GyLY41JUpi1V1").create(:card => card)
```

The magnetic card scheme conforms to [this standard by epanorama.net](http://www.epanorama.net/documents/smartcard/magcard.html) and I think it's pretty useful in anyone who is building applications which involve USB magnetic stripe readers and wish to include billing such as Stripe.

Tests have also been added, but thoughts would be appreciated.