def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
      unless start_date
        raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.'
      end

      unless resource && SLEEP_RESOURCES.include?(resource)
        raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}."
      end

      if period && end_date
        raise FitgemOauth2::InvalidArgumentError, 'Both end_date and period specified. Specify only one.'
      end

      if period && !SLEEP_PERIODS.include?(period)
        raise FitgemOauth2::InvalidArgumentError, "Invalid period: #{period}. Valid periods are #{SLEEP_PERIODS}."
      end

      second = period || format_date(end_date)

      url = ['user', user_id, 'sleep', resource, 'date', format_date(start_date), second].join('/')

      get_call(url + '.json')
    end
def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)
      unless start_date
        raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.'
      end

      unless resource && SLEEP_RESOURCES.include?(resource)
        raise FitgemOauth2::InvalidArgumentError, "Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}."
      end

      if period && end_date
        raise FitgemOauth2::InvalidArgumentError, 'Both end_date and period specified. Specify only one.'
      end

      if period && !SLEEP_PERIODS.include?(period)
        raise FitgemOauth2::InvalidArgumentError, "Invalid period: #{period}. Valid periods are #{SLEEP_PERIODS}."
      end

      second = period || format_date(end_date)

      url = ['user', user_id, 'sleep', resource, 'date', format_date(start_date), second].join('/')

      get_call(url + '.json')
    end
retrieve time series data for sleep
 @param resource sleep resource to be requested
 @param start_date starting date for sleep time series
 @param end_date ending date for sleep time series
 @param period period for sleep time series