Class: HttpStub::Configurer::Server::CommandProcessor

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

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ CommandProcessor

Returns a new instance of CommandProcessor.



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

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#process(command, http_options = {}) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/http_stub/configurer/server/command_processor.rb', line 11

def process(command, http_options={})
  response = send_command(command, http_options)
  raise "#{error_message_prefix(command)}: #{response.code} #{response.message}" unless response.code == "200"
  response
rescue StandardError => err
  raise "#{error_message_prefix(command)}: #{err}"
end