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 a user logged food. 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 be editable.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ NutritionLog

Returns a new instance of NutritionLog.



3544
3545
3546
# File 'lib/google/apis/health_v4/classes.rb', line 3544

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

Instance Attribute Details

#energyGoogle::Apis::HealthV4::EnergyQuantity

Represents the energy quantity. Corresponds to the JSON property energy



3493
3494
3495
# File 'lib/google/apis/health_v4/classes.rb', line 3493

def energy
  @energy
end

#energy_from_fatGoogle::Apis::HealthV4::EnergyQuantity

Represents the energy quantity. Corresponds to the JSON property energyFromFat



3498
3499
3500
# File 'lib/google/apis/health_v4/classes.rb', line 3498

def energy_from_fat
  @energy_from_fat
end

#foodString

Required. Represents the food ID. Corresponds to the JSON property food

Returns:

  • (String)


3503
3504
3505
# File 'lib/google/apis/health_v4/classes.rb', line 3503

def food
  @food
end

#food_display_nameString

Value representing the display name of the food. For nutrition logs created from an identified food, this field will be populated based on the referenced food. For anonymous food, this field will be populated manually. Corresponds to the JSON property foodDisplayName

Returns:

  • (String)


3510
3511
3512
# File 'lib/google/apis/health_v4/classes.rb', line 3510

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



3516
3517
3518
# File 'lib/google/apis/health_v4/classes.rb', line 3516

def interval
  @interval
end

#meal_typeString

Optional. Value representing the meal type of the nutrition log. Corresponds to the JSON property mealType

Returns:

  • (String)


3521
3522
3523
# File 'lib/google/apis/health_v4/classes.rb', line 3521

def meal_type
  @meal_type
end

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

Optional. Value representing the nutrients of the nutrition log. Corresponds to the JSON property nutrients



3526
3527
3528
# File 'lib/google/apis/health_v4/classes.rb', line 3526

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



3532
3533
3534
# File 'lib/google/apis/health_v4/classes.rb', line 3532

def serving
  @serving
end

#total_carbohydrateGoogle::Apis::HealthV4::WeightQuantity

Represents the weight quantity. Corresponds to the JSON property totalCarbohydrate



3537
3538
3539
# File 'lib/google/apis/health_v4/classes.rb', line 3537

def total_carbohydrate
  @total_carbohydrate
end

#total_fatGoogle::Apis::HealthV4::WeightQuantity

Represents the weight quantity. Corresponds to the JSON property totalFat



3542
3543
3544
# File 'lib/google/apis/health_v4/classes.rb', line 3542

def total_fat
  @total_fat
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
# File 'lib/google/apis/health_v4/classes.rb', line 3549

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