class FakeServer::RemoteAPI

Attributes

host[R]

Public Class Methods

new(host) click to toggle source
# File lib/fake_server/remote_api.rb, line 5
def initialize(host)
  @host = host
  @host = "http://#{host}" unless host[/\Ahttp/]
end

Public Instance Methods

request(method, relative_url) click to toggle source
# File lib/fake_server/remote_api.rb, line 12
def request(method, relative_url)
  response = HTTParty.public_send(method.downcase, "#{host}#{relative_url}")
  response.headers.delete 'transfer-encoding'
  [response.code, response.headers, [response.body]]
end