Created
December 24, 2009 15:14
-
-
Save bkeepers/263218 to your computer and use it in GitHub Desktop.
script to post hours from harvest in campfire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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