Class: HttpStub::Configurer::Server::CommandProcessor
- Inherits:
-
Object
- Object
- HttpStub::Configurer::Server::CommandProcessor
- Defined in:
- lib/http_stub/configurer/server/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.
7 8 9 |
# File 'lib/http_stub/configurer/server/command_processor.rb', line 7 def initialize(configurer) @configurer = configurer end |
Instance Method Details
#process(command) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/http_stub/configurer/server/command_processor.rb', line 11 def process(command) response = Net::HTTP.start(host, port) { |http| http.request(command.http_request) } raise "#{(command)}: #{response.code} #{response.}" unless response.code == "200" response rescue StandardError => err raise "#{(command)}: #{err}" end |