Skip to content

Instantly share code, notes, and snippets.

@bkeepers
Created December 24, 2009 15:14
Show Gist options
  • Save bkeepers/263218 to your computer and use it in GitHub Desktop.
Save bkeepers/263218 to your computer and use it in GitHub Desktop.
script to post hours from harvest in campfire
require 'rubygems'
require 'harvest'
require 'tinder'
@harvest = Harvest(
:email => "email",
:password => "password",
:sub_domain => "subdomain"
)
range = 1.day.ago.beginning_of_day..1.day.ago.end_of_day
format = " %-18s: %.2f\n"
output = "Billable hours for #{range.first.strftime('%A, %B %e')}:\n"
@harvest.people.find(:all).each do |person|
if person.is_active?
entries = person.entries(:from => range.first, :to => range.last)
hours = entries.sum(&:hours)
output += format % [person.first_name + ' ' + person.last_name, hours]
end
end
@campfire = Tinder::Campfire.new('subdomain')
@campfire.login('email', 'password')
@room = @campfire.find_room_by_name('Water Cooler')
@room.paste output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment