Sha256: 112c987ce2dd152529c4aaa8d84b367055dc6196c4a7a93529bcc4a2f231ab85

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'rubygems'
require 'dm-core'
require 'dm-migrations'
require 'cheap_imports'

DataMapper.setup(:default, 'sqlite3:dm-example.sqlite3')

class Payment
  include DataMapper::Resource
  include CheapImports

  property :id, Serial
  property :name, String
  property :paid_on, DateTime
  property :price, Decimal

  imports :tarp_transactions => {
    :paid_on => 'Date',
    :paid_on_format => '%Y-%m-%d',
    :name => 'Name',
    :price => 'Price Paid'
  }
end

DataMapper.finalize
DataMapper.auto_migrate!

# Data downloaded from http://subsidyscope.com/bailout/tarp/
Import.import_from_file([Payment], "tarp_transactions.csv")

Payment.all.each do |p|
  puts p.inspect
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cheap_imports-0.0.4 examples/tarp/dm-example.rb