ruby/lib/openapi_client/api/menu_items_api.rb
# Search Menu Items
# Search over 115,000 menu items from over 800 fast food and chain restaurants. For example, McDonald&#39;s Big Mac or Starbucks Mocha.
# @param [Hash] opts the optional parameters
# @option opts [String] :query The (natural language) search query.
# @option opts [Float] :min_calories The minimum amount of calories the menu item must have.
# @option opts [Float] :max_calories The maximum amount of calories the menu item can have.
# @option opts [Float] :min_carbs The minimum amount of carbohydrates in grams the menu item must have.
# @option opts [Float] :max_carbs The maximum amount of carbohydrates in grams the menu item can have.
# @option opts [Float] :min_protein The minimum amount of protein in grams the menu item must have.
# @option opts [Float] :max_protein The maximum amount of protein in grams the menu item can have.
# @option opts [Float] :min_fat The minimum amount of fat in grams the menu item must have.
# @option opts [Float] :max_fat The maximum amount of fat in grams the menu item can have.
# @option opts [Boolean] :add_menu_item_information If set to true, you get more information about the menu items returned.
# @option opts [Integer] :offset The number of results to skip (between 0 and 900).
# @option opts [Integer] :number The maximum number of items to return (between 1 and 100). Defaults to 10.
# @return [Array<(InlineResponse20035, Integer, Hash)>] InlineResponse20035 data, response status code and response headers
Search Menu Items
Search over 115,000 menu items from over 800 fast food and chain restaurants. For example, McDonald's Big Mac or Starbucks Mocha.
Search Menu Items Search over 115 000 menu items from over 800 fast food and chain restaurants . For example McDonald ' s Big Mac or Starbucks Mocha .
def search_menu_items_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: MenuItemsApi.search_menu_items ...'
      end
      allowable_values = ["false", "true"]
      if @api_client.config.client_side_validation && opts[:'add_menu_item_information'] && !allowable_values.include?(opts[:'add_menu_item_information'])
        fail ArgumentError, "invalid value for \"add_menu_item_information\", must be one of #{allowable_values}"
      end
      if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 900
        fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling MenuItemsApi.search_menu_items, must be smaller than or equal to 900.'
      end
      if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
        fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling MenuItemsApi.search_menu_items, must be greater than or equal to 0.'
      end
      if @api_client.config.client_side_validation && !opts[:'number'].nil? && opts[:'number'] > 100
        fail ArgumentError, 'invalid value for "opts[:"number"]" when calling MenuItemsApi.search_menu_items, 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 MenuItemsApi.search_menu_items, must be greater than or equal to 1.'
      end
      local_var_path = '/food/menuItems/search'
      query_params = opts[:query_params] || {}
      query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
      query_params[:'minCalories'] = opts[:'min_calories'] if !opts[:'min_calories'].nil?
      query_params[:'maxCalories'] = opts[:'max_calories'] if !opts[:'max_calories'].nil?
      query_params[:'minCarbs'] = opts[:'min_carbs'] if !opts[:'min_carbs'].nil?
      query_params[:'maxCarbs'] = opts[:'max_carbs'] if !opts[:'max_carbs'].nil?
      query_params[:'minProtein'] = opts[:'min_protein'] if !opts[:'min_protein'].nil?
      query_params[:'maxProtein'] = opts[:'max_protein'] if !opts[:'max_protein'].nil?
      query_params[:'minFat'] = opts[:'min_fat'] if !opts[:'min_fat'].nil?
      query_params[:'maxFat'] = opts[:'max_fat'] if !opts[:'max_fat'].nil?
      query_params[:'addMenuItemInformation'] = opts[:'add_menu_item_information'] if !opts[:'add_menu_item_information'].nil?
      query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
      query_params[:'number'] = opts[:'number'] if !opts[:'number'].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] || 'InlineResponse20035' 
      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: MenuItemsApi#search_menu_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
def search_menu_items_with_http_info ( opts = { } ) if @api_client . config . debugging @api_client . config . logger . debug 'Calling API: MenuItemsApi.search_menu_items ...' end allowable_values = [ "false" , "true" ] if @api_client . config . client_side_validation && opts [ :' add_menu_item_information ' ] && ! allowable_values . include? ( opts [ :' add_menu_item_information ' ] ) fail ArgumentError , "invalid value for \"add_menu_item_information\", must be one of #{allowable_values}" end if @api_client . config . client_side_validation && ! opts [ :' offset ' ] . nil? && opts [ :' offset ' ] > 900 fail ArgumentError , 'invalid value for "opts[:"offset"]" when calling MenuItemsApi.search_menu_items, must be smaller than or equal to 900.' end if @api_client . config . client_side_validation && ! opts [ :' offset ' ] . nil? && opts [ :' offset ' ] < 0 fail ArgumentError , 'invalid value for "opts[:"offset"]" when calling MenuItemsApi.search_menu_items, must be greater than or equal to 0.' end if @api_client . config . client_side_validation && ! opts [ :' number ' ] . nil? && opts [ :' number ' ] > 100 fail ArgumentError , 'invalid value for "opts[:"number"]" when calling MenuItemsApi.search_menu_items, 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 MenuItemsApi.search_menu_items, must be greater than or equal to 1.' end local_var_path = '/food/menuItems/search' query_params = opts [ :query_params ] || { } query_params [ :' query ' ] = opts [ :' query ' ] if ! opts [ :' query ' ] . nil? query_params [ :' minCalories ' ] = opts [ :' min_calories ' ] if ! opts [ :' min_calories ' ] . nil? query_params [ :' maxCalories ' ] = opts [ :' max_calories ' ] if ! opts [ :' max_calories ' ] . nil? query_params [ :' minCarbs ' ] = opts [ :' min_carbs ' ] if ! opts [ :' min_carbs ' ] . nil? query_params [ :' maxCarbs ' ] = opts [ :' max_carbs ' ] if ! opts [ :' max_carbs ' ] . nil? query_params [ :' minProtein ' ] = opts [ :' min_protein ' ] if ! opts [ :' min_protein ' ] . nil? query_params [ :' maxProtein ' ] = opts [ :' max_protein ' ] if ! opts [ :' max_protein ' ] . nil? query_params [ :' minFat ' ] = opts [ :' min_fat ' ] if ! opts [ :' min_fat ' ] . nil? query_params [ :' maxFat ' ] = opts [ :' max_fat ' ] if ! opts [ :' max_fat ' ] . nil? query_params [ :' addMenuItemInformation ' ] = opts [ :' add_menu_item_information ' ] if ! opts [ :' add_menu_item_information ' ] . nil? query_params [ :' offset ' ] = opts [ :' offset ' ] if ! opts [ :' offset ' ] . nil? query_params [ :' number ' ] = opts [ :' number ' ] if ! opts [ :' number ' ] . 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 ] || 'InlineResponse20035' 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: MenuItemsApi#search_menu_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data , status_code , headers end
Search Menu Items
Search over 115,000 menu items from over 800 fast food and chain restaurants.
Search Menu Items Search over 115 000 menu items from over 800 fast food and chain restaurants .
# resource path # query parameters # header parameters # HTTP header 'Accept' (if needed) # form parameters # http body (model) # return_type # auth_names
InlineResponse20035 data, response status code and response headers
InlineResponse20035 data response status code and response headers
Array<(InlineResponse20035, Integer, Hash)>
opts
:number The maximum number of items to return (between 1 and 100). Defaults to 10.
: number The maximum number of items to return ( between 1 and 100 ) . Defaults to 10 .
opts the optional parameters
opts the optional parameters