Class: HttpStub::Configurer::CommandProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/configurer/command_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(configurer) ⇒ CommandProcessor

Returns a new instance of CommandProcessor.



6
7
8
# File 'lib/http_stub/configurer/command_processor.rb', line 6

def initialize(configurer)
  @configurer = configurer
end

Instance Method Details

#process(command) ⇒ Object



10
11
12
13
# File 'lib/http_stub/configurer/command_processor.rb', line 10

def process(command)
  response = Net::HTTP.start(@configurer.get_host, @configurer.get_port) { |http| http.request(command.request) }
  raise "Error occurred #{command.description}: #{response.message}" unless response.code == "200"
end