Class: Google::Apis::HealthV4::NutritionLog

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ NutritionLog

Returns a new instance of NutritionLog.



3632
3633
3634
# File 'lib/google/apis/health_v4/classes.rb', line 3632

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#energyGoogle::Apis::HealthV4::EnergyQuantity

Represents the energy quantity. Corresponds to the JSON property energy



3580
3581
3582
# File 'lib/google/apis/health_v4/classes.rb', line 3580

def energy
  @energy
end

#energy_from_fatGoogle::Apis::HealthV4::EnergyQuantity

Represents the energy quantity. Corresponds to the JSON property energyFromFat



3585
3586
3587
# File 'lib/google/apis/health_v4/classes.rb', line 3585

def energy_from_fat
  @energy_from_fat
end

#foodString

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

Returns:

  • (String)


3592
3593
3594
# File 'lib/google/apis/health_v4/classes.rb', line 3592

def food
  @food
end

#food_display_nameString

The display name of the food. For identified food logs, this is populated automatically from the referenced food. Corresponds to the JSON property foodDisplayName

Returns:

  • (String)


3598
3599
3600
# File 'lib/google/apis/health_v4/classes.rb', line 3598

def food_display_name
  @food_display_name
end

#intervalGoogle::Apis::HealthV4::SessionTimeInterval

Represents a time interval of session data point, which bundles multiple observed metrics together. Corresponds to the JSON property interval



3604
3605
3606
# File 'lib/google/apis/health_v4/classes.rb', line 3604

def interval
  @interval
end

#meal_typeString

Optional. The meal category. One of BREAKFAST, LUNCH, DINNER, or SNACK. Corresponds to the JSON property mealType

Returns:

  • (String)


3609
3610
3611
# File 'lib/google/apis/health_v4/classes.rb', line 3609

def meal_type
  @meal_type
end

#nutrientsArray<Google::Apis::HealthV4::NutrientQuantity>

Optional. An array of individual nutrient values for the nutrition log. Corresponds to the JSON property nutrients



3614
3615
3616
# File 'lib/google/apis/health_v4/classes.rb', line 3614

def nutrients
  @nutrients
end

#servingGoogle::Apis::HealthV4::Serving

Represents different properties and information about the serving of a specific food. Corresponds to the JSON property serving



3620
3621
3622
# File 'lib/google/apis/health_v4/classes.rb', line 3620

def serving
  @serving
end

#total_carbohydrateGoogle::Apis::HealthV4::WeightQuantity

Represents the weight quantity. Corresponds to the JSON property totalCarbohydrate



3625
3626
3627
# File 'lib/google/apis/health_v4/classes.rb', line 3625

def total_carbohydrate
  @total_carbohydrate
end

#total_fatGoogle::Apis::HealthV4::WeightQuantity

Represents the weight quantity. Corresponds to the JSON property totalFat



3630
3631
3632
# File 'lib/google/apis/health_v4/classes.rb', line 3630

def total_fat
  @total_fat
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
# File 'lib/google/apis/health_v4/classes.rb', line 3637

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