4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/dnb/direct/plus/search.rb', line 4
def self.typeahead(params = {})
started_at = Time.now
country_code = params[:country] || 'US'
response = DnB::Direct::Plus.connection.get do |req|
url = "/v1/search/typeahead?searchTerm=#{params[:term]}&countryISOAlpha2Code=#{country_code}"
req.url url
req.[:authorization] = "Bearer #{DnB::Direct::Plus.api_token}"
end
puts "== [TYPEAHEAD] Completed in #{((Time.now - started_at)*1000).round}ms".cyan.bold
JSON.parse(response.body)
end
|