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.
3627 3628 3629 |
# File 'lib/google/apis/health_v4/classes.rb', line 3627 def initialize(**args) update!(**args) end |
Instance Attribute Details
#energy ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
Corresponds to the JSON property energy
3575 3576 3577 |
# File 'lib/google/apis/health_v4/classes.rb', line 3575 def energy @energy end |
#energy_from_fat ⇒ Google::Apis::HealthV4::EnergyQuantity
Represents the energy quantity.
Corresponds to the JSON property energyFromFat
3580 3581 3582 |
# File 'lib/google/apis/health_v4/classes.rb', line 3580 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
3587 3588 3589 |
# File 'lib/google/apis/health_v4/classes.rb', line 3587 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
3593 3594 3595 |
# File 'lib/google/apis/health_v4/classes.rb', line 3593 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
3599 3600 3601 |
# File 'lib/google/apis/health_v4/classes.rb', line 3599 def interval @interval end |
#meal_type ⇒ String
Optional. The meal category. One of BREAKFAST, LUNCH, DINNER, or SNACK.
Corresponds to the JSON property mealType
3604 3605 3606 |
# File 'lib/google/apis/health_v4/classes.rb', line 3604 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
3609 3610 3611 |
# File 'lib/google/apis/health_v4/classes.rb', line 3609 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
3615 3616 3617 |
# File 'lib/google/apis/health_v4/classes.rb', line 3615 def serving @serving end |
#total_carbohydrate ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
Corresponds to the JSON property totalCarbohydrate
3620 3621 3622 |
# File 'lib/google/apis/health_v4/classes.rb', line 3620 def total_carbohydrate @total_carbohydrate end |
#total_fat ⇒ Google::Apis::HealthV4::WeightQuantity
Represents the weight quantity.
Corresponds to the JSON property totalFat
3625 3626 3627 |
# File 'lib/google/apis/health_v4/classes.rb', line 3625 def total_fat @total_fat end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 |
# File 'lib/google/apis/health_v4/classes.rb', line 3632 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 |