costagent 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/costagent.rb +13 -0
- metadata +3 -3
data/lib/costagent.rb
CHANGED
@@ -8,6 +8,7 @@ require "open-uri"
|
|
8
8
|
class CostAgent
|
9
9
|
Project = Struct.new(:id, :name, :currency, :hourly_billing_rate)
|
10
10
|
Timeslip = Struct.new(:id, :project, :hours, :date, :cost)
|
11
|
+
Task = Struct.new(:id, :name, :project)
|
11
12
|
|
12
13
|
attr_accessor :subdomain, :username, :password
|
13
14
|
|
@@ -45,6 +46,18 @@ class CostAgent
|
|
45
46
|
project.hourly_billing_rate * hours)
|
46
47
|
end
|
47
48
|
end
|
49
|
+
|
50
|
+
# This returns all tasks for the specified project_id
|
51
|
+
def tasks(project_id)
|
52
|
+
(self.api("projects/#{project_id}/tasks")/"task").collect do |task|
|
53
|
+
# Find the project for this task
|
54
|
+
project = self.project((task/"project-id").text.to_i)
|
55
|
+
# Build the task out using the task data and the project it's tied to
|
56
|
+
Task.new((task/"id").text.to_i,
|
57
|
+
(task/"name").text,
|
58
|
+
project)
|
59
|
+
end
|
60
|
+
end
|
48
61
|
|
49
62
|
# This returns the amount of GBP earnt in the specified timeframe
|
50
63
|
def earnt(start_date = DateTime.now, end_date = start_date)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Elliott Draper
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-12 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|