Class: Google::Apis::CustomsearchV1::CustomsearchService

Inherits:
Google::Apis::Core::BaseService show all
Defined in:
generated/google/apis/customsearch_v1/service.rb

Overview

CustomSearch API

Searches over a website or collection of websites

Examples:

require 'google/apis/customsearch_v1'

Customsearch = Google::Apis::CustomsearchV1 # Alias the module
service = Customsearch::CustomsearchService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Google::Apis::Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Google::Apis::Core::Logging

#logger

Constructor Details

#initializeCustomsearchService

Returns a new instance of CustomsearchService.



49
50
51
52
# File 'generated/google/apis/customsearch_v1/service.rb', line 49

def initialize
  super('https://www.googleapis.com/', 'customsearch/')
  @batch_path = 'batch/customsearch/v1'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'generated/google/apis/customsearch_v1/service.rb', line 38

def key
  @key
end

#quota_userString

Returns An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

Returns:

  • (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.



43
44
45
# File 'generated/google/apis/customsearch_v1/service.rb', line 43

def quota_user
  @quota_user
end

#user_ipString

Returns Deprecated. Please use quotaUser instead.

Returns:

  • (String)

    Deprecated. Please use quotaUser instead.



47
48
49
# File 'generated/google/apis/customsearch_v1/service.rb', line 47

def user_ip
  @user_ip
end

Instance Method Details

#list_cse_siterestricts(q, c2coff: nil, cr: nil, cx: nil, date_restrict: nil, exact_terms: nil, exclude_terms: nil, file_type: nil, filter: nil, gl: nil, googlehost: nil, high_range: nil, hl: nil, hq: nil, img_color_type: nil, img_dominant_color: nil, img_size: nil, img_type: nil, link_site: nil, low_range: nil, lr: nil, num: nil, or_terms: nil, related_site: nil, rights: nil, safe: nil, search_type: nil, site_search: nil, site_search_filter: nil, sort: nil, start: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CustomsearchV1::Search

Returns metadata about the search performed, metadata about the custom search engine used for the search, and the search results. Uses a small set of url patterns.

Parameters:

  • q (String)

    Query

  • c2coff (String) (defaults to: nil)

    Turns off the translation between zh-CN and zh-TW.

  • cr (String) (defaults to: nil)

    Country restrict(s).

  • cx (String) (defaults to: nil)

    The custom search engine ID to scope this search query

  • date_restrict (String) (defaults to: nil)

    Specifies all search results are from a time period

  • exact_terms (String) (defaults to: nil)

    Identifies a phrase that all documents in the search results must contain

  • exclude_terms (String) (defaults to: nil)

    Identifies a word or phrase that should not appear in any documents in the search results

  • file_type (String) (defaults to: nil)

    Returns images of a specified type. Some of the allowed values are: bmp, gif, png, jpg, svg, pdf, ...

  • filter (String) (defaults to: nil)

    Controls turning on or off the duplicate content filter.

  • gl (String) (defaults to: nil)

    Geolocation of end user.

  • googlehost (String) (defaults to: nil)

    The local Google domain to use to perform the search.

  • high_range (String) (defaults to: nil)

    Creates a range in form as_nlo value..as_nhi value and attempts to append it to query

  • hl (String) (defaults to: nil)

    Sets the user interface language.

  • hq (String) (defaults to: nil)

    Appends the extra query terms to the query.

  • img_color_type (String) (defaults to: nil)

    Returns black and white, grayscale, or color images: mono, gray, and color.

  • img_dominant_color (String) (defaults to: nil)

    Returns images of a specific dominant color: red, orange, yellow, green, teal, blue, purple, pink, white, gray, black and brown.

  • img_size (String) (defaults to: nil)

    Returns images of a specified size, where size can be one of: icon, small, medium, large, xlarge, xxlarge, and huge.

  • img_type (String) (defaults to: nil)

    Returns images of a type, which can be one of: clipart, face, lineart, news, and photo.

  • link_site (String) (defaults to: nil)

    Specifies that all search results should contain a link to a particular URL

  • low_range (String) (defaults to: nil)

    Creates a range in form as_nlo value..as_nhi value and attempts to append it to query

  • lr (String) (defaults to: nil)

    The language restriction for the search results

  • num (Fixnum) (defaults to: nil)

    Number of search results to return

  • or_terms (String) (defaults to: nil)

    Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms

  • related_site (String) (defaults to: nil)

    Specifies that all search results should be pages that are related to the specified URL

  • rights (String) (defaults to: nil)

    Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived and combinations of these.

  • safe (String) (defaults to: nil)

    Search safety level

  • search_type (String) (defaults to: nil)

    Specifies the search type: image.

  • site_search (String) (defaults to: nil)

    Specifies all search results should be pages from a given site

  • site_search_filter (String) (defaults to: nil)

    Controls whether to include or exclude results from the site named in the as_sitesearch parameter

  • sort (String) (defaults to: nil)

    The sort expression to apply to the results

  • start (Fixnum) (defaults to: nil)

    The index of the first result to return

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String) (defaults to: nil)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'generated/google/apis/customsearch_v1/service.rb', line 288

def list_cse_siterestricts(q, c2coff: nil, cr: nil, cx: nil, date_restrict: nil, exact_terms: nil, exclude_terms: nil, file_type: nil, filter: nil, gl: nil, googlehost: nil, high_range: nil, hl: nil, hq: nil, img_color_type: nil, img_dominant_color: nil, img_size: nil, img_type: nil, link_site: nil, low_range: nil, lr: nil, num: nil, or_terms: nil, related_site: nil, rights: nil, safe: nil, search_type: nil, site_search: nil, site_search_filter: nil, sort: nil, start: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/siterestrict', options)
  command.response_representation = Google::Apis::CustomsearchV1::Search::Representation
  command.response_class = Google::Apis::CustomsearchV1::Search
  command.query['c2coff'] = c2coff unless c2coff.nil?
  command.query['cr'] = cr unless cr.nil?
  command.query['cx'] = cx unless cx.nil?
  command.query['dateRestrict'] = date_restrict unless date_restrict.nil?
  command.query['exactTerms'] = exact_terms unless exact_terms.nil?
  command.query['excludeTerms'] = exclude_terms unless exclude_terms.nil?
  command.query['fileType'] = file_type unless file_type.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['gl'] = gl unless gl.nil?
  command.query['googlehost'] = googlehost unless googlehost.nil?
  command.query['highRange'] = high_range unless high_range.nil?
  command.query['hl'] = hl unless hl.nil?
  command.query['hq'] = hq unless hq.nil?
  command.query['imgColorType'] = img_color_type unless img_color_type.nil?
  command.query['imgDominantColor'] = img_dominant_color unless img_dominant_color.nil?
  command.query['imgSize'] = img_size unless img_size.nil?
  command.query['imgType'] = img_type unless img_type.nil?
  command.query['linkSite'] = link_site unless link_site.nil?
  command.query['lowRange'] = low_range unless low_range.nil?
  command.query['lr'] = lr unless lr.nil?
  command.query['num'] = num unless num.nil?
  command.query['orTerms'] = or_terms unless or_terms.nil?
  command.query['q'] = q unless q.nil?
  command.query['relatedSite'] = related_site unless related_site.nil?
  command.query['rights'] = rights unless rights.nil?
  command.query['safe'] = safe unless safe.nil?
  command.query['searchType'] = search_type unless search_type.nil?
  command.query['siteSearch'] = site_search unless site_search.nil?
  command.query['siteSearchFilter'] = site_search_filter unless site_search_filter.nil?
  command.query['sort'] = sort unless sort.nil?
  command.query['start'] = start unless start.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_cses(q, c2coff: nil, cr: nil, cx: nil, date_restrict: nil, exact_terms: nil, exclude_terms: nil, file_type: nil, filter: nil, gl: nil, googlehost: nil, high_range: nil, hl: nil, hq: nil, img_color_type: nil, img_dominant_color: nil, img_size: nil, img_type: nil, link_site: nil, low_range: nil, lr: nil, num: nil, or_terms: nil, related_site: nil, rights: nil, safe: nil, search_type: nil, site_search: nil, site_search_filter: nil, sort: nil, start: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CustomsearchV1::Search

Returns metadata about the search performed, metadata about the custom search engine used for the search, and the search results.

Parameters:

  • q (String)

    Query

  • c2coff (String) (defaults to: nil)

    Turns off the translation between zh-CN and zh-TW.

  • cr (String) (defaults to: nil)

    Country restrict(s).

  • cx (String) (defaults to: nil)

    The custom search engine ID to scope this search query

  • date_restrict (String) (defaults to: nil)

    Specifies all search results are from a time period

  • exact_terms (String) (defaults to: nil)

    Identifies a phrase that all documents in the search results must contain

  • exclude_terms (String) (defaults to: nil)

    Identifies a word or phrase that should not appear in any documents in the search results

  • file_type (String) (defaults to: nil)

    Returns images of a specified type. Some of the allowed values are: bmp, gif, png, jpg, svg, pdf, ...

  • filter (String) (defaults to: nil)

    Controls turning on or off the duplicate content filter.

  • gl (String) (defaults to: nil)

    Geolocation of end user.

  • googlehost (String) (defaults to: nil)

    The local Google domain to use to perform the search.

  • high_range (String) (defaults to: nil)

    Creates a range in form as_nlo value..as_nhi value and attempts to append it to query

  • hl (String) (defaults to: nil)

    Sets the user interface language.

  • hq (String) (defaults to: nil)

    Appends the extra query terms to the query.

  • img_color_type (String) (defaults to: nil)

    Returns black and white, grayscale, or color images: mono, gray, and color.

  • img_dominant_color (String) (defaults to: nil)

    Returns images of a specific dominant color: red, orange, yellow, green, teal, blue, purple, pink, white, gray, black and brown.

  • img_size (String) (defaults to: nil)

    Returns images of a specified size, where size can be one of: icon, small, medium, large, xlarge, xxlarge, and huge.

  • img_type (String) (defaults to: nil)

    Returns images of a type, which can be one of: clipart, face, lineart, news, and photo.

  • link_site (String) (defaults to: nil)

    Specifies that all search results should contain a link to a particular URL

  • low_range (String) (defaults to: nil)

    Creates a range in form as_nlo value..as_nhi value and attempts to append it to query

  • lr (String) (defaults to: nil)

    The language restriction for the search results

  • num (Fixnum) (defaults to: nil)

    Number of search results to return

  • or_terms (String) (defaults to: nil)

    Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms

  • related_site (String) (defaults to: nil)

    Specifies that all search results should be pages that are related to the specified URL

  • rights (String) (defaults to: nil)

    Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived and combinations of these.

  • safe (String) (defaults to: nil)

    Search safety level

  • search_type (String) (defaults to: nil)

    Specifies the search type: image.

  • site_search (String) (defaults to: nil)

    Specifies all search results should be pages from a given site

  • site_search_filter (String) (defaults to: nil)

    Controls whether to include or exclude results from the site named in the as_sitesearch parameter

  • sort (String) (defaults to: nil)

    The sort expression to apply to the results

  • start (Fixnum) (defaults to: nil)

    The index of the first result to return

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String) (defaults to: nil)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'generated/google/apis/customsearch_v1/service.rb', line 150

def list_cses(q, c2coff: nil, cr: nil, cx: nil, date_restrict: nil, exact_terms: nil, exclude_terms: nil, file_type: nil, filter: nil, gl: nil, googlehost: nil, high_range: nil, hl: nil, hq: nil, img_color_type: nil, img_dominant_color: nil, img_size: nil, img_type: nil, link_site: nil, low_range: nil, lr: nil, num: nil, or_terms: nil, related_site: nil, rights: nil, safe: nil, search_type: nil, site_search: nil, site_search_filter: nil, sort: nil, start: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1', options)
  command.response_representation = Google::Apis::CustomsearchV1::Search::Representation
  command.response_class = Google::Apis::CustomsearchV1::Search
  command.query['c2coff'] = c2coff unless c2coff.nil?
  command.query['cr'] = cr unless cr.nil?
  command.query['cx'] = cx unless cx.nil?
  command.query['dateRestrict'] = date_restrict unless date_restrict.nil?
  command.query['exactTerms'] = exact_terms unless exact_terms.nil?
  command.query['excludeTerms'] = exclude_terms unless exclude_terms.nil?
  command.query['fileType'] = file_type unless file_type.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['gl'] = gl unless gl.nil?
  command.query['googlehost'] = googlehost unless googlehost.nil?
  command.query['highRange'] = high_range unless high_range.nil?
  command.query['hl'] = hl unless hl.nil?
  command.query['hq'] = hq unless hq.nil?
  command.query['imgColorType'] = img_color_type unless img_color_type.nil?
  command.query['imgDominantColor'] = img_dominant_color unless img_dominant_color.nil?
  command.query['imgSize'] = img_size unless img_size.nil?
  command.query['imgType'] = img_type unless img_type.nil?
  command.query['linkSite'] = link_site unless link_site.nil?
  command.query['lowRange'] = low_range unless low_range.nil?
  command.query['lr'] = lr unless lr.nil?
  command.query['num'] = num unless num.nil?
  command.query['orTerms'] = or_terms unless or_terms.nil?
  command.query['q'] = q unless q.nil?
  command.query['relatedSite'] = related_site unless related_site.nil?
  command.query['rights'] = rights unless rights.nil?
  command.query['safe'] = safe unless safe.nil?
  command.query['searchType'] = search_type unless search_type.nil?
  command.query['siteSearch'] = site_search unless site_search.nil?
  command.query['siteSearchFilter'] = site_search_filter unless site_search_filter.nil?
  command.query['sort'] = sort unless sort.nil?
  command.query['start'] = start unless start.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end