aiaio / harvest

A ruby library wrapping (most of) the Harvest Api.

This URL has Read+Write access

aiaio (author)
Mon Jun 08 10:11:54 -0700 2009
commit  485940b1205549c8bea1e0a9c5175c2a51ad7282
tree    51f135a3067b9efeec795ac490f0e8f086e9b7fd
parent  ab5fe9ce3b3fbb92f797f39752fd88b59ac342d1
harvest / lib / harvest.rb
100644 37 lines (30 sloc) 0.925 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Harvest
  VERSION = "0.8"
  ApiDomain = "harvestapp.com"
  
  # Class method to load all ruby files from a given path.
  def self.load_all_ruby_files_from_path(path)
    Dir.foreach(path) do |file|
      require File.join(path, file) if file =~ /\.rb$/
    end
  end
  
end
 
# Gems
require "rubygems"
require "activeresource"
require "active_resource_throttle"
 
# Plugins
PluginPath = File.join(File.dirname(__FILE__), "harvest", "plugins")
Harvest.load_all_ruby_files_from_path(PluginPath)
 
# Base
require File.join(File.dirname(__FILE__), "harvest", "base")
require File.join(File.dirname(__FILE__), "harvest", "harvest_resource")
 
# Shortcut for Harvest::Base.new
#
# Example:
# Harvest(:email => "jack@exampe.com",
# :password => "secret",
# :sub_domain => "frenchie",
# :headers => {"User-Agent => "Harvest Rubygem"})
def Harvest(options={})
  Harvest::Base.new(options)
end