Module: GoogleImages

Defined in:
lib/google_images.rb,
lib/google_images/auth.rb,
lib/google_images/image.rb,
lib/google_images/query.rb,
lib/google_images/errors.rb,
lib/google_images/mapper.rb,
lib/google_images/version.rb,
lib/google_images/url_builder.rb,
lib/google_images/query_executor.rb,
lib/google_images/network_requester.rb,
lib/google_images/errors/general_error.rb,
lib/google_images/errors/network_error.rb,
lib/google_images/errors/image_mapping_error.rb,
lib/google_images/errors/url_generation_error.rb,
lib/google_images/errors/response_parsing_error.rb

Overview

Namespace for classes and modules that handle Google Images search

Defined Under Namespace

Modules: Errors, Mapper, NetworkRequester Classes: Auth, Image, Query, QueryExecutor, URLBuilder

Constant Summary collapse

VERSION =
'1.0.2'

Class Method Summary collapse

Class Method Details

.search(text, options = {}) ⇒ Array<GoogleImages::Image] array of found images

Google Images Lookup

Examples:

Search images by ‘ruby` keyword

GoogleImages.search('ruby')

Search images with keyword and optional parameters

GoogleImages.search('ruby', img_size: 'large', safe: 'high')

Parameters:

  • text (String)

    to perform search with

  • options (Hash) (defaults to: {})

    the options perform search with

Returns:

  • (Array<GoogleImages::Image] array of found images)

    Array<GoogleImages::Image] array of found images

Raises:



27
28
29
30
31
# File 'lib/google_images.rb', line 27

def self.search(text, options = {})
  query = Query.new(text, options)
  images_hash = QueryExecutor.run(query, authentication)
  Mapper.build_images(images_hash)
end