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 14 15 16 17 |
# File 'lib/http_stub/configurer/command_processor.rb', line 10 def process(command) begin response = Net::HTTP.start(host, port) { |http| http.request(command.request) } raise "#{error_message_prefix(command)}: #{response.code} #{response.message}" unless response.code == "200" rescue Exception => exc raise "#{error_message_prefix(command)}: #{exc}" end end |