Does some trivial parsing of the email invoice format used by Diamond Comic Distributors.
Adapted from some really old PHP code I wrote really early in my career for Comic Town in Columbus, OH. If you're ever in Columbus and need comics, give them a visit.
gem install diamond_invoice
First, create a new DiamondInvoice and give it your emailed invoice, as a string.
@invoice = DiamondInvoice.new(File.read('path_to_invoice.txt'))
Fetch a list of incoming items as an all-lowercase array.
@invoice.new_titles # => ["amazing spider-man #62", "animal man #2", ... ]
Got some books you don't want to see in the list? Ignore them like so:
# Ignore any title that contains "adult supplement." # Case insensitive, matches if the keyword apepars anywhere in the title. @invoice.excluded_titles << "adult supplement"
At the moment, it won't do anything magical: no expanding abbreviations or cleaning up shoddy titles, nor will it pull anything else out of the invoice line.
Have a suggestion for a feature? Add it to the list
Requires rspec ~> 2.7
- Fork it
- Create a branch (
git checkout -b my_feature_or_bugfix)
- Commit your changes (
git commit -am "Description of my change.")
- Push to your branch (
git push origin my_feature_or_bugfix)
- Send a pull request