ruby/lib/openapi_client/api/ingredients_api.rb
# Compute Ingredient Amount
# Compute the amount you need of a certain ingredient for a certain nutritional goal. For example, how much pineapple do you have to eat to get 10 grams of protein?
# @param id [Float] The id of the ingredient you want the amount for.
# @param nutrient [String] The target nutrient. See a list of supported nutrients.
# @param target [Float] The target number of the given nutrient.
# @param [Hash] opts the optional parameters
# @option opts [String] :unit The target unit.
# @return [Array<(RecipesParseIngredientsNutritionWeightPerServing, Integer, Hash)>] RecipesParseIngredientsNutritionWeightPerServing data, response status code and response headers
Compute Ingredient Amount
Compute the amount you need of a certain ingredient for a certain nutritional goal.
Compute Ingredient Amount Compute the amount you need of a certain ingredient for a certain nutritional goal .
def compute_ingredient_amount_with_http_info(id, nutrient, target, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: IngredientsApi.compute_ingredient_amount ...'
      end
      if @api_client.config.client_side_validation && id.nil?
        fail ArgumentError, "Missing the required parameter 'id' when calling IngredientsApi.compute_ingredient_amount"
      end
      if @api_client.config.client_side_validation && nutrient.nil?
        fail ArgumentError, "Missing the required parameter 'nutrient' when calling IngredientsApi.compute_ingredient_amount"
      end
      if @api_client.config.client_side_validation && target.nil?
        fail ArgumentError, "Missing the required parameter 'target' when calling IngredientsApi.compute_ingredient_amount"
      end
      local_var_path = '/food/ingredients/{id}/amount'.sub('{' + 'id' + '}', id.to_s)
      query_params = opts[:query_params] || {}
      query_params[:'nutrient'] = nutrient
      query_params[:'target'] = target
      query_params[:'unit'] = opts[:'unit'] if !opts[:'unit'].nil?
      header_params = opts[:header_params] || {}
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])
      form_params = opts[:form_params] || {}
      post_body = opts[:body] 
      return_type = opts[:return_type] || 'RecipesParseIngredientsNutritionWeightPerServing' 
      auth_names = opts[:auth_names] || ['apiKeyScheme']
      new_options = opts.merge(
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )
      data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: IngredientsApi#compute_ingredient_amount\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
def compute_ingredient_amount_with_http_info ( id , nutrient , target , opts = { } ) if @api_client . config . debugging @api_client . config . logger . debug 'Calling API: IngredientsApi.compute_ingredient_amount ...' end if @api_client . config . client_side_validation && id . nil? fail ArgumentError , "Missing the required parameter 'id' when calling IngredientsApi.compute_ingredient_amount" end if @api_client . config . client_side_validation && nutrient . nil? fail ArgumentError , "Missing the required parameter 'nutrient' when calling IngredientsApi.compute_ingredient_amount" end if @api_client . config . client_side_validation && target . nil? fail ArgumentError , "Missing the required parameter 'target' when calling IngredientsApi.compute_ingredient_amount" end local_var_path = '/food/ingredients/{id}/amount' . sub ( '{' + 'id' + '}' , id . to_s ) query_params = opts [ :query_params ] || { } query_params [ :' nutrient ' ] = nutrient query_params [ :' target ' ] = target query_params [ :' unit ' ] = opts [ :' unit ' ] if ! opts [ :' unit ' ] . nil? header_params = opts [ :header_params ] || { } header_params [ 'Accept' ] = @api_client . select_header_accept ( [ 'application/json' ] ) form_params = opts [ :form_params ] || { } post_body = opts [ :body ] return_type = opts [ :return_type ] || 'RecipesParseIngredientsNutritionWeightPerServing' auth_names = opts [ :auth_names ] || [ 'apiKeyScheme' ] new_options = opts . merge ( :header_params => header_params , :query_params => query_params , :form_params => form_params , :body => post_body , :auth_names => auth_names , :return_type => return_type ) data , status_code , headers = @api_client . call_api ( :GET , local_var_path , new_options ) if @api_client . config . debugging @api_client . config . logger . debug "API called: IngredientsApi#compute_ingredient_amount\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data , status_code , headers end
Compute Ingredient Amount
Compute the amount you need of a certain ingredient for a certain nutritional goal.
Compute Ingredient Amount Compute the amount you need of a certain ingredient for a certain nutritional goal .
# verify the required parameter 'id' is set # verify the required parameter 'nutrient' is set # verify the required parameter 'target' is set # resource path # query parameters # header parameters # HTTP header 'Accept' (if needed) # form parameters # http body (model) # return_type # auth_names
RecipesParseIngredientsNutritionWeightPerServing data, response status code and response headers
RecipesParseIngredientsNutritionWeightPerServing data response status code and response headers
Array<(RecipesParseIngredientsNutritionWeightPerServing, Integer, Hash)>
id
The id of the ingredient you want the amount for.
The id of the ingredient you want the amount for .
nutrient
The target nutrient. See a list of supported nutrients.
The target nutrient . See a list of supported nutrients .
target
The target number of the given nutrient.
The target number of the given nutrient .
opts
:unit The target unit.
: unit The target unit .
opts the optional parameters
opts the optional parameters