beggar 0.0.3.alpha → 0.0.4.alpha

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beggar (0.0.2.alpha)
4
+ beggar (0.0.3.alpha)
5
5
  basecamp
6
6
 
7
7
  GEM
data/lib/beggar/base.rb CHANGED
@@ -9,6 +9,10 @@ module Beggar
9
9
  Salary.rate = config['project']['rate']
10
10
  end
11
11
 
12
+ def me
13
+ @@me ||= Basecamp::Person.me
14
+ end
15
+
12
16
  def summary
13
17
  [CurrentMonth, Hours, Salary].join(' || ') + "\n"
14
18
  end
data/lib/beggar/hours.rb CHANGED
@@ -6,7 +6,8 @@ module Beggar
6
6
  attr_accessor :project_id
7
7
 
8
8
  def worked
9
- @@worked ||= Basecamp::TimeEntry.report(project_id: project_id, from: CurrentMonth.first_day, to: Date.today).map(&:hours).inject(&:+)
9
+ params = { project_id: project_id, from: CurrentMonth.first_day, to: Date.today }
10
+ @@worked ||= Basecamp::TimeEntry.report(params).select { |te| te.person_id == Base.me.id }.map(&:hours).inject(&:+)
10
11
  end
11
12
 
12
13
  def max_up_today
@@ -1,3 +1,3 @@
1
1
  module Beggar
2
- VERSION = "0.0.3.alpha"
2
+ VERSION = "0.0.4.alpha"
3
3
  end
data/spec/base_spec.rb CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe Beggar::Base do
4
4
  before do
5
5
  Basecamp.stub(:establish_connection!)
6
+ Basecamp::Person.stub(me: 'x')
6
7
  Beggar::CurrentMonth.stub(to_s: 'a')
7
8
  Beggar::Hours.stub(to_s: 'b')
8
9
  Beggar::Salary.stub(to_s: 'c')
@@ -14,4 +15,5 @@ describe Beggar::Base do
14
15
  end
15
16
 
16
17
  its(:summary) { should == %(a || b || c\n) }
18
+ its(:me) { should == 'x' }
17
19
  end
data/spec/hours_spec.rb CHANGED
@@ -5,7 +5,8 @@ require 'spec_helper'
5
5
  describe 'Beggar::Hours' do
6
6
  context 'user was working in current month 2 days (8h and 6h)' do
7
7
  before do
8
- api_response = double(map: [8.0, 6.0])
8
+ time_entries = double(map: [8.0, 6.0])
9
+ api_response = double(select: time_entries)
9
10
  Basecamp::TimeEntry.stub(report: api_response)
10
11
  Beggar::CurrentMonth.stub(working_days_up_today: 2)
11
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beggar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.alpha
4
+ version: 0.0.4.alpha
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-15 00:00:00.000000000 Z
12
+ date: 2011-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70210180152260 !ruby/object:Gem::Requirement
16
+ requirement: &70123487624900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70210180152260
24
+ version_requirements: *70123487624900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: basecamp
27
- requirement: &70210180151220 !ruby/object:Gem::Requirement
27
+ requirement: &70123487624380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70210180151220
35
+ version_requirements: *70123487624380
36
36
  description: Tool for generating time reports from Basecamp. You can specify rate
37
37
  for each project and get value of your month salary.
38
38
  email: