Class: HttpStub::Client::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/client/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_uri) ⇒ Server

Returns a new instance of Server.


6
7
8
# File 'lib/http_stub/client/server.rb', line 6

def initialize(base_uri)
  @base_uri = base_uri
end

Instance Method Details

#submit!(args) ⇒ Object


10
11
12
13
14
15
# File 'lib/http_stub/client/server.rb', line 10

def submit!(args)
  request = HttpStub::Client::Request.new(args.merge(base_uri: @base_uri))
  response = request.submit
  raise "#{request.error_message_prefix} #{response.code} #{response.message}" unless response.code == "200"
  response
end