Module: GoogleImages::NetworkRequester

Defined in:
lib/google_images/network_requester.rb

Overview

This class acts as a facade between http client library ‘http.rb` and our source code for abstracting library’s entities and exceptions and using only needed part of the http client library API

Class Method Summary collapse

Class Method Details

.get(url) ⇒ Object

Performs json GET request

Examples:

Get data from url

NetworkRequester.get("http://url")

Parameters:

  • url (String)

Raises:



17
18
19
20
21
# File 'lib/google_images/network_requester.rb', line 17

def self.get(url)
  HTTP.headers(accept: 'application/json').get(url)
rescue => e
  raise GoogleImages::Errors::NetworkError, 'Network Error'
end