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.



3627
3628
3629
# File 'lib/google/apis/health_v4/classes.rb', line 3627

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

Instance Attribute Details

#energyGoogle::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_fatGoogle::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

#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)


3587
3588
3589
# File 'lib/google/apis/health_v4/classes.rb', line 3587

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)


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

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



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

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)


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

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



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

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



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

def serving
  @serving
end

#total_carbohydrateGoogle::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_fatGoogle::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