class Trebbiatrice::Harvest
Public Class Methods
new(login_data)
click to toggle source
# File lib/trebbiatrice/harvest.rb, line 13 def initialize(login_data) @harvest = ::Harvest.hardy_client(login_data) end
Public Instance Methods
new_entry!(entry_data, find = true)
click to toggle source
# File lib/trebbiatrice/harvest.rb, line 21 def new_entry!(entry_data, find = true) if find project_id = entry_data[:project_id].to_s entry = @harvest.time.all.select { |entry| entry[:project_id].to_s == project_id }.last if entry toggle!(entry[:id]) entry else new_entry!(entry_data, false) end else @harvest.time.create(entry_data) end end
projects()
click to toggle source
# File lib/trebbiatrice/harvest.rb, line 17 def projects @harvest.time.trackable_projects end
toggle!(entry_id)
click to toggle source
# File lib/trebbiatrice/harvest.rb, line 37 def toggle!(entry_id) @harvest.time.toggle(entry_id) end