Class: TimeLogRobot::Toggl::Report
- Inherits:
-
Object
- Object
- TimeLogRobot::Toggl::Report
- Includes:
- HTTParty
- Defined in:
- lib/time_log_robot/toggl/report.rb
Defined Under Namespace
Classes: FetchError
Class Method Summary collapse
Class Method Details
.fetch(since: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/time_log_robot/toggl/report.rb', line 12 def fetch(since: nil) since ||= Date.today.beginning_of_week(:saturday).to_time response = get('/details', basic_auth: auth, query: query(since)) if response.success? pages = number_of_pages(response['total_count']) aggregate_entries(response['data'], pages, since) else raise FetchError, response['error'] end end |