Class: Clickatell::API::Command
Overview
Represents a Clickatell HTTP gateway command in the form of a complete URL (the raw, low-level request).
Constant Summary collapse
- API_SERVICE_HOST =
- 'api.clickatell.com'
Instance Method Summary collapse
- 
  
    
      #initialize(command_name, service = 'http', opts = {})  ⇒ Command 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Command. 
- 
  
    
      #with_params(param_hash)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns a URL for the given parameters (a hash). 
Constructor Details
#initialize(command_name, service = 'http', opts = {}) ⇒ Command
Returns a new instance of Command.
| 9 10 11 12 13 | # File 'lib/clickatell/api/command.rb', line 9 def initialize(command_name, service = 'http', opts={}) @command_name = command_name @service = service = { :secure => false }.merge(opts) end | 
Instance Method Details
#with_params(param_hash) ⇒ Object
Returns a URL for the given parameters (a hash).
| 16 17 18 19 | # File 'lib/clickatell/api/command.rb', line 16 def with_params(param_hash) param_string = '?' + param_hash.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.sort.join('&') return URI.parse(File.join(api_service_uri, @command_name + param_string)) end |