Class: TogglBillable::Formatter::Summary

Inherits:
Base
  • Object
show all
Defined in:
lib/toggl_billable/formatter/summary.rb

Constant Summary

Constants inherited from Base

Base::NO_CLIENT_KEY

Instance Attribute Summary

Attributes inherited from Base

#billable, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from TogglBillable::Formatter::Base

Instance Method Details

#billable_itemsObject

TODO: make this working also for different grouping than default TODO: rounding parameter TODO: implement custom formatting TODO: projects without names



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/toggl_billable/formatter/summary.rb', line 9

def billable_items
  data.group_by { |d| d['title']['client'] }.each do |group_name, group_data|
    key = group_name || @no_client_key
    billable[key] = [] unless billable[key]
    group_data.group_by { |d| d['title']['project'] }.each do |subgroup_name, subgroup_data|
      process_project(subgroup_data.first)
    end
  end

  billable
end