Sha256: df791095e50615bf229c5d8c3d847f4e93000bd1cf00e9d6918f455302d41801

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

module FitbitAPI
  class Client
    # GET Goals
    # =========

    # Retrieves a user's current weight goal.

    def weight_goal
      get("user/-/body/log/weight/goal.json")
    end

    # Retrieves a user's current body fat percentage goal.

    def body_fat_goal
      get("user/-/body/log/fat/goal.json")
    end

    # Retrieves a user's current daily activity goals.

    def daily_goals
      get("user/#{user_id}/activities/goals/daily.json")
    end

    # Retrieves a user's current weekly activity goals.

    def weekly_goals
      get("user/#{user_id}/activities/goals/weekly.json")
    end

    # POST Goals
    # ==========

    # Creates or updates a user's daily activity goals and returns a response using units
    # in the unit system which corresponds to the Accept-Language header provided.
    #
    #   create_or_update_daily_goals(calories_out: 2000, active_minutes: 90, floors: 5)
    #
    # @param calories_out [Integer] Calories output goal value
    # @param active_minutes [Integer] Active minutes goal value
    # @param floors [Integer] Floor goal value
    # @param distance [Integer, Float] Distance goal value
    # @param steps [Integer] Steps goal value

    def create_or_update_daily_goals(body={})
      post("user/#{user_id}/activities/goals/daily.json", body)
    end

    # Creates or updates a user's weekly activity goals and returns a response using units
    # in the unit system which corresponds to the Accept-Language header provided.
    #
    #   create_or_update_weekly_goals(active_minutes: 300, floors: 20)
    #
    # @param calories_out [Integer] Calories output goal value
    # @param active_minutes [Integer] Active minutes goal value
    # @param floors [Integer] Floor goal value
    # @param distance [Integer, Float] Distance goal value
    # @param steps [Integer] Steps goal value

    def create_or_update_weekly_goals(body={})
      post("user/#{user_id}/activities/goals/weekly.json", body)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fitbit_api-0.11.0 lib/fitbit_api/goals.rb