ruby/lib/openapi_client/api/recipes_api.rb
# Search Recipes by Ingredients
#  Ever wondered what recipes you can cook with the ingredients you have in your fridge or pantry? This endpoint lets you find recipes that either maximize the usage of ingredients you have at hand (pre shopping) or minimize the ingredients that you don&#39;t currently have (post shopping).         
# @param [Hash] opts the optional parameters
# @option opts [String] :ingredients A comma-separated list of ingredients that the recipes should contain.
# @option opts [Integer] :number The maximum number of items to return (between 1 and 100). Defaults to 10.
# @option opts [Boolean] :limit_license Whether the recipes should have an open license that allows display with proper attribution.
# @option opts [Float] :ranking Whether to maximize used ingredients (1) or minimize missing ingredients (2) first.
# @option opts [Boolean] :ignore_pantry Whether to ignore typical pantry items, such as water, salt, flour, etc.
# @return [Array<(Array<InlineResponse2001>, Integer, Hash)>] Array<InlineResponse2001> data, response status code and response headers
Search Recipes by Ingredients
Ever wondered what recipes you can cook with the ingredients you have in your fridge or pantry. This endpoint lets you find recipes that either maximize the usage of ingredients you have at hand (pre shopping) or minimize the ingredients that you don't currently have (post shopping).
Search Recipes by Ingredients Ever wondered what recipes you can cook with the ingredients you have in your fridge or pantry . This endpoint lets you find recipes that either maximize the usage of ingredients you have at hand ( pre shopping ) or minimize the ingredients that you don ' t currently have ( post shopping ) .
def search_recipes_by_ingredients_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: RecipesApi.search_recipes_by_ingredients ...'
      end
      if @api_client.config.client_side_validation && !opts[:'number'].nil? && opts[:'number'] > 100
        fail ArgumentError, 'invalid value for "opts[:"number"]" when calling RecipesApi.search_recipes_by_ingredients, must be smaller than or equal to 100.'
      end
      if @api_client.config.client_side_validation && !opts[:'number'].nil? && opts[:'number'] < 1
        fail ArgumentError, 'invalid value for "opts[:"number"]" when calling RecipesApi.search_recipes_by_ingredients, must be greater than or equal to 1.'
      end
      local_var_path = '/recipes/findByIngredients'
      query_params = opts[:query_params] || {}
      query_params[:'ingredients'] = opts[:'ingredients'] if !opts[:'ingredients'].nil?
      query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
      query_params[:'limitLicense'] = opts[:'limit_license'] if !opts[:'limit_license'].nil?
      query_params[:'ranking'] = opts[:'ranking'] if !opts[:'ranking'].nil?
      query_params[:'ignorePantry'] = opts[:'ignore_pantry'] if !opts[:'ignore_pantry'].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] || 'Array<InlineResponse2001>' 
      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: RecipesApi#search_recipes_by_ingredients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
def search_recipes_by_ingredients_with_http_info ( opts = { } ) if @api_client . config . debugging @api_client . config . logger . debug 'Calling API: RecipesApi.search_recipes_by_ingredients ...' end if @api_client . config . client_side_validation && ! opts [ :' number ' ] . nil? && opts [ :' number ' ] > 100 fail ArgumentError , 'invalid value for "opts[:"number"]" when calling RecipesApi.search_recipes_by_ingredients, must be smaller than or equal to 100.' end if @api_client . config . client_side_validation && ! opts [ :' number ' ] . nil? && opts [ :' number ' ] < 1 fail ArgumentError , 'invalid value for "opts[:"number"]" when calling RecipesApi.search_recipes_by_ingredients, must be greater than or equal to 1.' end local_var_path = '/recipes/findByIngredients' query_params = opts [ :query_params ] || { } query_params [ :' ingredients ' ] = opts [ :' ingredients ' ] if ! opts [ :' ingredients ' ] . nil? query_params [ :' number ' ] = opts [ :' number ' ] if ! opts [ :' number ' ] . nil? query_params [ :' limitLicense ' ] = opts [ :' limit_license ' ] if ! opts [ :' limit_license ' ] . nil? query_params [ :' ranking ' ] = opts [ :' ranking ' ] if ! opts [ :' ranking ' ] . nil? query_params [ :' ignorePantry ' ] = opts [ :' ignore_pantry ' ] if ! opts [ :' ignore_pantry ' ] . 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 ] || 'Array<InlineResponse2001>' 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: RecipesApi#search_recipes_by_ingredients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data , status_code , headers end
Search Recipes by Ingredients
Ever wondered what recipes you can cook with the ingredients you have in your fridge or pantry?
Search Recipes by Ingredients Ever wondered what recipes you can cook with the ingredients you have in your fridge or pantry?
# resource path # query parameters # header parameters # HTTP header 'Accept' (if needed) # form parameters # http body (model) # return_type # auth_names
Array data, response status code and response headers
Array data response status code and response headers
Array<(Array<InlineResponse2001>, Integer, Hash)>
opts
:ignore_pantry Whether to ignore typical pantry items, such as water, salt, flour, etc.
: ignore_pantry Whether to ignore typical pantry items such as water salt flour etc .
opts the optional parameters
opts the optional parameters