Class: MultiInfo::API::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/multiinfo/api/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(command_name) ⇒ Command

Returns a new instance of Command.



9
10
11
# File 'lib/multiinfo/api/command.rb', line 9

def initialize(command_name)
  @command_name = command_name
end

Instance Method Details

#with_params(param_hash) ⇒ Object



13
14
15
16
# File 'lib/multiinfo/api/command.rb', line 13

def with_params(param_hash)
  param_string = '?' + param_hash.map { |key, value| "#{::CGI.escape(key.to_s.camelize(false))}=#{::CGI.escape(value.to_s)}" }.sort.join('&')
  URI.parse(File.join("#{API_SERVICE_HOST}", "#{@command_name}.#{API_SCRIPT_TYPE}" + param_string))
end