Class: Harvest::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/harvest/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Requires a sub_domain, email, and password. Specifying headers is optional, but useful for setting a user agent.



6
7
8
9
10
11
12
13
14
15
# File 'lib/harvest/base.rb', line 6

def initialize(options={})
  options.assert_valid_keys(:email, :password, :sub_domain, :headers, :ssl)
  options.assert_required_keys(:email, :password, :sub_domain)
  @email        = options[:email]
  @password     = options[:password]
  @sub_domain   = options[:sub_domain]
  @headers      = options[:headers]
  @ssl          = options[:ssl]
  configure_base_resource
end

Instance Method Details

#clientsObject

Clients



21
22
23
# File 'lib/harvest/base.rb', line 21

def clients
  Harvest::Resources::Client
end

#expense_categoriesObject

Expense categories.



31
32
33
# File 'lib/harvest/base.rb', line 31

def expense_categories
  Harvest::Resources::ExpenseCategory
end

#expensesObject

Expenses.



26
27
28
# File 'lib/harvest/base.rb', line 26

def expenses
  Harvest::Resources::Expense
end

#invoicesObject

Invoices



54
55
56
# File 'lib/harvest/base.rb', line 54

def invoices
  Harvest::Resources::Invoice
end

#peopleObject

People. Also provides access to time entries.



37
38
39
# File 'lib/harvest/base.rb', line 37

def people
  Harvest::Resources::Person
end

#projectsObject

Projects. Provides access to the assigned users and tasks along with reports for entries on the project.



44
45
46
# File 'lib/harvest/base.rb', line 44

def projects
  Harvest::Resources::Project
end

#tasksObject

Tasks.



49
50
51
# File 'lib/harvest/base.rb', line 49

def tasks
  Harvest::Resources::Task
end