~vesto/harvest-touchbar

7f2c336f1794e6a7dedcc3e1fe7983a20b358847 — Steve Gattuso 5 years ago cd712bf
shows --:-- instead of error when offline
1 files changed, 8 insertions(+), 4 deletions(-)

M harvest.rb
M harvest.rb => harvest.rb +8 -4
@@ 20,10 20,14 @@ def icon_path(active:)
end

def get_latest_timer
  resp = generate_request
    .get('https://api.harvestapp.com/v2/time_entries', params: {
      from: Date.today.to_s
    })
  begin
    resp = generate_request
      .get('https://api.harvestapp.com/v2/time_entries', params: {
        from: Date.today.to_s
      })
  rescue HTTP::ConnectionError
    return nil
  end

  json = JSON.parse(resp.body)