Class: Google::Apis::HealthV4::NutritionLog
- Inherits:
-
Object
- Object
- Google::Apis::HealthV4::NutritionLog
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/health_v4/classes.rb,
lib/google/apis/health_v4/representations.rb,
lib/google/apis/health_v4/representations.rb
Overview
Holds information about food logged by a user. There are two ways of creating
a nutrition log based on the food type: 1. Identified food: Using the food
field, which is a reference to a Food resource. In this case fields nutrients
, energy, energy_from_fat, total_carbohydrate, total_fat,
food_display_name will be populated based on the referenced food. 2.
Anonymous food: Using the food_display_name field and setting the nutrients
, energy, energy_from_fat, total_carbohydrate, total_fat fields
manually. The identified food is preferred over the anonymous food. Nutrition
logs created from anonymous food are not editable.
Instance Attribute Summary collapse
-
#energy ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
-
#energy_from_fat ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
-
#food ⇒ String
Optional.
-
#food_display_name ⇒ String
The display name of the food.
-
#interval ⇒ Google::Apis::HealthV4::SessionTimeInterval
Represents a time interval of session data point, which bundles multiple observed metrics together.
-
#meal_type ⇒ String
Optional.
-
#nutrients ⇒ Array<Google::Apis::HealthV4::NutrientQuantity>
Optional.
-
#serving ⇒ Google::Apis::HealthV4::Serving
Represents different properties and information about the serving of a specific food.
-
#total_carbohydrate ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
-
#total_fat ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
Instance Method Summary collapse
-
#initialize(**args) ⇒ NutritionLog
constructor
A new instance of NutritionLog.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ NutritionLog
Returns a new instance of NutritionLog.
3719 3720 3721 |
# File 'lib/google/apis/health_v4/classes.rb', line 3719 def initialize(**args) update!(**args) end |
Instance Attribute Details
#energy ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
Corresponds to the JSON property energy
3667 3668 3669 |
# File 'lib/google/apis/health_v4/classes.rb', line 3667 def energy @energy end |
#energy_from_fat ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
Corresponds to the JSON property energyFromFat
3672 3673 3674 |
# File 'lib/google/apis/health_v4/classes.rb', line 3672 def energy_from_fat @energy_from_fat end |
#food ⇒ String
Optional. The resource name of the Food item. Required when creating a
nutrition log from an identified food. For anonymous food logs, use the
food_display_name field instead.
Corresponds to the JSON property food
3679 3680 3681 |
# File 'lib/google/apis/health_v4/classes.rb', line 3679 def food @food end |
#food_display_name ⇒ String
The display name of the food. For identified food logs, this is populated
automatically from the referenced food.
Corresponds to the JSON property foodDisplayName
3685 3686 3687 |
# File 'lib/google/apis/health_v4/classes.rb', line 3685 def food_display_name @food_display_name end |
#interval ⇒ Google::Apis::HealthV4::SessionTimeInterval
Represents a time interval of session data point, which bundles multiple
observed metrics together.
Corresponds to the JSON property interval
3691 3692 3693 |
# File 'lib/google/apis/health_v4/classes.rb', line 3691 def interval @interval end |
#meal_type ⇒ String
Optional. The meal category. One of BREAKFAST, LUNCH, DINNER, or SNACK.
Corresponds to the JSON property mealType
3696 3697 3698 |
# File 'lib/google/apis/health_v4/classes.rb', line 3696 def meal_type @meal_type end |
#nutrients ⇒ Array<Google::Apis::HealthV4::NutrientQuantity>
Optional. An array of individual nutrient values for the nutrition log.
Corresponds to the JSON property nutrients
3701 3702 3703 |
# File 'lib/google/apis/health_v4/classes.rb', line 3701 def nutrients @nutrients end |
#serving ⇒ Google::Apis::HealthV4::Serving
Represents different properties and information about the serving of a
specific food.
Corresponds to the JSON property serving
3707 3708 3709 |
# File 'lib/google/apis/health_v4/classes.rb', line 3707 def serving @serving end |
#total_carbohydrate ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
Corresponds to the JSON property totalCarbohydrate
3712 3713 3714 |
# File 'lib/google/apis/health_v4/classes.rb', line 3712 def total_carbohydrate @total_carbohydrate end |
#total_fat ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
Corresponds to the JSON property totalFat
3717 3718 3719 |
# File 'lib/google/apis/health_v4/classes.rb', line 3717 def total_fat @total_fat end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 |
# File 'lib/google/apis/health_v4/classes.rb', line 3724 def update!(**args) @energy = args[:energy] if args.key?(:energy) @energy_from_fat = args[:energy_from_fat] if args.key?(:energy_from_fat) @food = args[:food] if args.key?(:food) @food_display_name = args[:food_display_name] if args.key?(:food_display_name) @interval = args[:interval] if args.key?(:interval) @meal_type = args[:meal_type] if args.key?(:meal_type) @nutrients = args[:nutrients] if args.key?(:nutrients) @serving = args[:serving] if args.key?(:serving) @total_carbohydrate = args[:total_carbohydrate] if args.key?(:total_carbohydrate) @total_fat = args[:total_fat] if args.key?(:total_fat) end |