Module: Governator::HTTPClient

Included in:
Governator, BioPage, CivilServices
Defined in:
lib/governator/http_client.rb

Overview

Module to mixin HTTP web content retrieval

Class Method Summary collapse

Class Method Details

.base_uriObject



16
17
18
# File 'lib/governator/http_client.rb', line 16

def base_uri
  @base_uri ||= 'https://www.nga.org'
end

.get_page_contents(path) ⇒ Object



10
11
12
13
14
# File 'lib/governator/http_client.rb', line 10

def get_page_contents(path)
  path = URI.parse(path)
  uri  = path.relative? ? "#{base_uri}#{path}" : path
  open(uri, &:read)
end