Module: YellowApi::Client::GetTypeAhead

Included in:
YellowApi::Client
Defined in:
lib/yellow_api/client/get_type_ahead.rb

Instance Method Summary collapse

Instance Method Details

#get_type_ahead(text, field, lang = "en") ⇒ Hash

The type ahead call returns search suggestions based on the characters a user has entered. The user can select the suggested term, saving them from having to enter all the characters for their search term.

Examples:

YellowApi.get_type_ahead("au", :what)
YellowApi.get_type_ahead("monc", :where, "fr")

Parameters:

  • text (String)

    Characters typed by user

  • field (Symbol)

    Which field to suggest, :what or :where

  • lang (String) (defaults to: "en")

    Suggestion languages (en - English [default], fr - French)

Returns:

  • (Hash)

See Also:



19
20
21
22
23
24
25
26
# File 'lib/yellow_api/client/get_type_ahead.rb', line 19

def get_type_ahead(text, field, lang="en")
  options = {
    :text => text,
    :lang => lang,
    :field => field.to_s.upcase
  }
  get('/GetTypeAhead/', options)
end