Class: Exetel::API::CommandExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/exetel/api/command_executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(authentication_hash, debug = false) ⇒ CommandExecutor

Returns a new instance of CommandExecutor.



9
10
11
12
# File 'lib/exetel/api/command_executor.rb', line 9

def initialize(authentication_hash, debug=false)
  @authentication_hash = authentication_hash
  @debug = debug
end

Instance Method Details

#execute(command_name, parameters) ⇒ Object

Builds a command object and sends it using HTTP GET. Will output URLs as they are requested to stdout when debugging is enabled.



17
18
19
20
21
# File 'lib/exetel/api/command_executor.rb', line 17

def execute(command_name, parameters)
  request_uri = command(command_name, parameters)
  puts "[debug] Sending request to #{request_uri}" if @debug
  get_response(request_uri).first
end