module GoogleImages
Namespace for classes and modules that handle Google Images search
Constants
- VERSION
Public Class Methods
search(text, options = {})
click to toggle source
Google Images Lookup
@param [String] text to perform search with @param [Hash] options the options perform search with
@example Search images by `ruby` keyword
GoogleImages.search('ruby')
@example Search images with keyword and optional parameters
GoogleImages.search('ruby', img_size: 'large', safe: 'high')
@raise [GoogleImages::Errors::GeneralError] @raise [GoogleImages::Errors::NetworkError] @raise [GoogleImages::Errors::URLGenerationError] @raise [GoogleImages::Errors::ResponseParsingError] @raise [GoogleImages::Errors::ImageMappingError]
@return [Array<GoogleImages::Image] array of found images
# 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
Private Class Methods
authentication()
click to toggle source
# File lib/google_images.rb, line 35 def self.authentication Auth.new(key, cx) end
cx()
click to toggle source
# File lib/google_images.rb, line 43 def self.cx ENV['GOOGLE_IMAGES_CX'] end
key()
click to toggle source
# File lib/google_images.rb, line 39 def self.key ENV['GOOGLE_IMAGES_KEY'] end