Class: Harvest::API::Reports
- Inherits:
-
Base
- Object
- Base
- Harvest::API::Reports
show all
- Defined in:
- lib/harvest/api/reports.rb
Instance Attribute Summary
Attributes inherited from Base
#credentials
Instance Method Summary
collapse
Methods inherited from Base
api_model, #initialize
Instance Method Details
#expenses_by_user(user, start_date, end_date) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/harvest/api/reports.rb', line 21
def expenses_by_user(user, start_date, end_date)
query = {:from => start_date.strftime("%Y%m%d"), :to => end_date.strftime("%Y%m%d")}
response = request(:get, credentials, "/people/#{user.to_i}/expenses", :query => query)
Harvest::Expense.parse(response.body)
end
|
#time_by_project(project, start_date, end_date, user = nil) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/harvest/api/reports.rb', line 5
def time_by_project(project, start_date, end_date, user = nil)
query = {:from => start_date.strftime("%Y%m%d"), :to => end_date.strftime("%Y%m%d")}
query[:user_id] = user.to_i if user
response = request(:get, credentials, "/projects/#{project.to_i}/entries", :query => query)
Harvest::TimeEntry.parse(massage_xml(response.body))
end
|
#time_by_user(user, start_date, end_date, project = nil) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/harvest/api/reports.rb', line 13
def time_by_user(user, start_date, end_date, project = nil)
query = {:from => start_date.strftime("%Y%m%d"), :to => end_date.strftime("%Y%m%d")}
query[:project_id] = project.to_i if project
response = request(:get, credentials, "/people/#{user.to_i}/entries", :query => query)
Harvest::TimeEntry.parse(massage_xml(response.body))
end
|