Class: HttpStub::Configurer::CommandProcessor
- Inherits:
-
Object
- Object
- HttpStub::Configurer::CommandProcessor
- Defined in:
- lib/http_stub/configurer/command_processor.rb
Instance Method Summary collapse
-
#initialize(configurer) ⇒ CommandProcessor
constructor
A new instance of CommandProcessor.
- #process(command) ⇒ Object
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.}" unless response.code == "200" end |