Class: Clickatell::API::CommandExecutor

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

Overview

Used to run commands agains the Clickatell gateway.

Instance Method Summary collapse

Constructor Details

#initialize(authentication_hash, secure = false, debug = false) ⇒ CommandExecutor

Returns a new instance of CommandExecutor.



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

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

Instance Method Details

#execute(command_name, service, 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.



18
19
20
21
22
# File 'lib/clickatell/api/command_executor.rb', line 18

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