lib/fitbit_api/sleep.rb in fitbit_api-0.10.2 vs lib/fitbit_api/sleep.rb in fitbit_api-0.11.0
- old
+ new
@@ -1,12 +1,12 @@
module FitbitAPI
class Client
SLEEP_RESOURCES = %w(startTime timeInBed minutesAsleep awakeningsCount
minutesAwake minutesToFallAsleep minutesAfterWakeup efficiency)
- def sleep_logs(date=Date.today, opts={})
- get("user/#{user_id}/sleep/date/#{format_date(date)}.json", opts)
+ def sleep_logs(date=Date.today)
+ get("user/#{user_id}/sleep/date/#{format_date(date)}.json")
end
def sleep_time_series(resource, opts={})
start_date = opts[:start_date]
end_date = opts[:end_date] || Date.today
@@ -23,13 +23,14 @@
if period && !PERIODS.include?(period)
raise FitbitAPI::InvalidArgumentError, "Invalid period: \"#{period}\". Please provide one of the following: #{PERIODS}."
end
if period
- result = get("user/#{user_id}/sleep/#{resource}/date/#{format_date(end_date)}/#{period}.json", opts)
+ result = get("user/#{user_id}/sleep/#{resource}/date/#{format_date(end_date)}/#{period}.json")
else
- result = get("user/#{user_id}/sleep/#{resource}/date/#{format_date(start_date)}/#{format_date(end_date)}.json", opts)
+ result = get("user/#{user_id}/sleep/#{resource}/date/#{format_date(start_date)}/#{format_date(end_date)}.json")
end
+
# remove root key from response
result.values[0]
end
end
end