Module: BingSearch
- Defined in:
- lib/bing-search.rb,
lib/bing-search/util.rb,
lib/bing-search/enums.rb,
lib/bing-search/client.rb,
lib/bing-search/errors.rb,
lib/bing-search/models.rb,
lib/bing-search/version.rb
Defined Under Namespace
Modules: Adult, FileType, ImageFilter, NewsCategory, NewsSort, Source, VideoFilter, VideoSort Classes: Client, CompositeSearchResult, Image, ImageResult, Model, NewsResult, RelatedSearchResult, Result, ServiceError, SpellingSuggestionsResult, VideoResult, WebResult
Constant Summary collapse
- HIGHLIGHT_DELIMITER =
"\u{e001}"
- VERSION =
'2.0.0'
Class Attribute Summary collapse
-
.account_key ⇒ String
An Account Key obtained from the Azure Marketplace.
-
.web_only ⇒ Boolean
Whether to use the less expensive web-only API.
Class Method Summary collapse
-
.composite(*args) ⇒ CompositeSearchResult
Convenience method that creates a Client and searches multiple sources.
-
.image(*args) ⇒ Array<ImageResult>
Convenience method that creates a Client and searches for images.
-
.news(*args) ⇒ Array<NewsResult>
Convenience method that creates a Client and searches for news.
-
.related_search(*args) ⇒ Array<RelatedSearchResult>
(also: related)
Convenience method that creates a Client and searches for related queries.
-
.spelling_suggestions(*args) ⇒ Array<SpellingSuggestionsResult>
(also: spelling)
Convenience method that creates a Client and corrects spelling in the query text.
-
.video(*args) ⇒ Array<VideoResult>
Convenience method that creates a Client and searches for videos.
-
.web(*args) ⇒ Array<WebResult>
Convenience method that creates a Client and searches for web pages.
Class Attribute Details
.account_key ⇒ String
An Account Key obtained from the Azure Marketplace. You can set this attribute once instead of instantiating each Client with an Account Key.
20 21 22 |
# File 'lib/bing-search.rb', line 20 def account_key @account_key end |
.web_only ⇒ Boolean
Whether to use the less expensive web-only API
24 25 26 |
# File 'lib/bing-search.rb', line 24 def web_only @web_only end |
Class Method Details
.composite(*args) ⇒ CompositeSearchResult
Convenience method that creates a Client and searches multiple sources. Takes the same arguments as BingSearch::Client#related_search. Set account_key before calling.
90 91 92 |
# File 'lib/bing-search.rb', line 90 def composite(*args) Client.new.composite(*args) end |
.image(*args) ⇒ Array<ImageResult>
Convenience method that creates a Client and searches for images. Takes the same arguments as BingSearch::Client#image. Set account_key before calling.
40 41 42 |
# File 'lib/bing-search.rb', line 40 def image(*args) Client.new.image(*args) end |
.news(*args) ⇒ Array<NewsResult>
Convenience method that creates a Client and searches for news. Takes the same arguments as BingSearch::Client#news. Set account_key before calling.
58 59 60 |
# File 'lib/bing-search.rb', line 58 def news(*args) Client.new.news(*args) end |
.related_search(*args) ⇒ Array<RelatedSearchResult> Also known as:
Convenience method that creates a Client and searches for related queries. Takes the same arguments as BingSearch::Client#related_search. Set account_key before calling.
68 69 70 |
# File 'lib/bing-search.rb', line 68 def (*args) Client.new.(*args) end |
.spelling_suggestions(*args) ⇒ Array<SpellingSuggestionsResult> Also known as: spelling
Convenience method that creates a Client and corrects spelling in the query text. Takes the same arguments as BingSearch::Client#related_search. Set account_key before calling.
79 80 81 |
# File 'lib/bing-search.rb', line 79 def spelling_suggestions(*args) Client.new.spelling_suggestions(*args) end |
.video(*args) ⇒ Array<VideoResult>
Convenience method that creates a Client and searches for videos. Takes the same arguments as BingSearch::Client#video. Set account_key before calling.
49 50 51 |
# File 'lib/bing-search.rb', line 49 def video(*args) Client.new.video(*args) end |
.web(*args) ⇒ Array<WebResult>
Convenience method that creates a Client and searches for web pages. Takes the same arguments as BingSearch::Client#web. Set account_key before calling.
31 32 33 |
# File 'lib/bing-search.rb', line 31 def web(*args) Client.new.web(*args) end |