costagent 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +4 -0
  2. data/lib/costagent.rb +7 -0
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -44,6 +44,10 @@ To return your FA user ID:
44
44
 
45
45
  costagent.user_id
46
46
 
47
+ To return a total of the amount of hours worked for a specific timeframe:
48
+
49
+ hours = costagent.worked(start_date, end_date)
50
+
47
51
  And to return a GBP figure of the money earnt during a specific timeframe based on billable hours:
48
52
 
49
53
  total = costagent.earnt(start_date, end_date)
data/lib/costagent.rb CHANGED
@@ -68,6 +68,13 @@ class CostAgent
68
68
  def user_id
69
69
  self.client("verify").get.headers[:user_id]
70
70
  end
71
+
72
+ # This returns the amount of hours worked
73
+ def worked(start_date = DateTime.now, end_date = start_date)
74
+ self.timeslips(start_date, end_date).collect do |timeslip|
75
+ timeslip.hours
76
+ end.inject(0) { |sum, i| sum += i }
77
+ end
71
78
 
72
79
  # This returns the amount of GBP earnt in the specified timeframe
73
80
  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
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
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-06-02 00:00:00 +01:00
17
+ date: 2010-06-05 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency