Sha256: 9b3ed5c3b8f21b912fdb8dea6dd39b2b134f805db110ab195711bbdf548da5d6

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'paypal/report'

partner = vendor = user = password = nil
time    = (Time.now - 60*60*24).strftime("%Y-%m-%d")

opts = ARGV.clone.options do |opts|
   opts.on("-p",  "--password=PASSWORD", "Password - required!")           { |p| password = p}
   opts.on("-d",  "--date=DATE",         "Date     - default: #{time}")    { |t| time     = t} 
   opts.on("-u",  "--user=USER",         "User     - default: #{user}")    { |u| user     = u}
   opts.on("-v",  "--vendor=VENDOR",     "Vendor   - default: #{vendor}")  { |v| vendor   = v}
   opts.on("-a",  "--partner=PARTNER",   "Partner  - default: #{partner}") { |a| partner  = a}

   opts.on_tail("-h", "--help", "Show this help message.") { $stderr.puts opts; exit }
end
opts.parse!

abort "No password given: \n #{opts}" unless password

api = Paypal::Report.new(user, password, vendor, partner)

amount = 0
report = api.daily(time, 5000)
report.each do |row|
  amount += row[6].to_i
end

puts "Report for #{time}: #{report.size} Entries - #{amount / 100.0} EUR"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paypal-report-0.1.0 bin/paypal-report-daily