class Exotel::Client

Public Class Methods

new(sid,token) click to toggle source
# File lib/exotel-api-client/client.rb, line 7
def initialize(sid,token)
  @auth = {:username => sid, :password => token}
  @resource = Resource.new
end

Public Instance Methods

execute(method) click to toggle source
# File lib/exotel-api-client/client.rb, line 24
def execute(method)
  response = Response.construct self.class.send(method,@resource.url(@auth[:username]),@opts)
  @resource = Resource.new
  response
end
method_missing(method, *args, &block) click to toggle source
# File lib/exotel-api-client/client.rb, line 12
def method_missing(method, *args, &block)
  @resource.append(method, args[0])
  @opts = {:query => @resource.options, :basic_auth => @auth}
  if args.size > 0 && !method.to_s.eql?("post")
    execute("get")
  elsif method.to_s.match /\bget\b|\bpost\b/
    execute(method)
  else
    return self
  end
end