Method: Voxbone#method_missing

Defined in:
lib/voxbone/voxbone.rb

#method_missing(method_name, params = {}) ⇒ Hash

Provides the dispatcher to the available SOAP methods defined in the WSDL

Examples:

Retrieve a country list

voxbone.get_countries_list(:type => 'GEOGRAPHIC')

Parameters:

  • the (required, Symbol)

    method name to invoke on the SOAP API

  • the (optional, Hash)

    parameters to pass to the method, should be symbols and may be all lowercase with underscores

Returns:

  • (Hash)

    containing the results of the SOAP call

Raises:

  • NoMethodError if the method requested is not defined in the WSDL



43
44
45
46
47
48
49
50
51
52
# File 'lib/voxbone/voxbone.rb', line 43

def method_missing(method_name, params={})
  if @methods.include? method_name
    response = @client.request :vox, method_name do
      prepare_soap(soap, capitalize_params(params))
    end
    response.to_hash
  else
    raise NoMethodError, "The method #{method_name.to_s} does not exist."
  end
end