Class: Beggar::Hours

Inherits:
Object
  • Object
show all
Defined in:
lib/beggar/hours.rb

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) project_id

Returns the value of attribute project_id



6
7
8
# File 'lib/beggar/hours.rb', line 6

def project_id
  @project_id
end

Class Method Details

+ (Object) difference



16
17
18
# File 'lib/beggar/hours.rb', line 16

def difference
  up_today - from_basecamp
end

+ (Object) from_basecamp



8
9
10
# File 'lib/beggar/hours.rb', line 8

def from_basecamp
  @@from_basecamp ||= Basecamp::TimeEntry.report(project_id: project_id, from: CurrentMonth.first_day, to: Date.today).map(&:hours).inject(&:+)
end

+ (Object) to_s



20
21
22
# File 'lib/beggar/hours.rb', line 20

def to_s
  %[#{from_basecamp}h ± #{difference}h]
end

+ (Object) up_today



12
13
14
# File 'lib/beggar/hours.rb', line 12

def up_today
  CurrentMonth.working_days_up_today * 8
end