def activity_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)

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

      unless start_date
        raise FitgemOauth2::InvalidArgumentError, 'Start date must be specified.'
      end

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

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

      first = format_date(start_date)
      second = period || format_date(end_date)
      url = ['user', user_id, 'activities', resource, 'date', first, second].join('/')
      get_call(url + '.json')
    end
def activity_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)

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

      unless start_date
        raise FitgemOauth2::InvalidArgumentError, 'Start date must be specified.'
      end

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

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

      first = format_date(start_date)
      second = period || format_date(end_date)
      url = ['user', user_id, 'activities', resource, 'date', first, second].join('/')
      get_call(url + '.json')
    end
==================================
   Activity Time Series
 ==================================
 retrieves activity time series, based on the arguments provided
 @param resource the resource for which the series needs to be retrieved. one of ALLOWED_RESOURCES
 @param start_date the start date for the series
 @param end_date the end date for the series. If specifying end_date, do not specify period
 @param period the period starting from start_date for which the series needs to be retrieved. If specifying period,
             do not use end_date