Class: ExotelApi::Call

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/exotel_api/call.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCall

Returns a new instance of Call.



9
# File 'lib/exotel_api/call.rb', line 9

def initialize; end

Class Method Details

.connect_to_agent(params = {}) ⇒ Object



20
21
22
# File 'lib/exotel_api/call.rb', line 20

def self.connect_to_agent(params={})
  self.new.connect_to_agent(params)
end

.connect_to_flow(params = {}) ⇒ Object



16
17
18
# File 'lib/exotel_api/call.rb', line 16

def self.connect_to_flow(params={})
  self.new.connect_to_flow(params)
end

.details(params = {}) ⇒ Object



24
25
26
# File 'lib/exotel_api/call.rb', line 24

def self.details(params={})
  self.new.details(params)
end

.shoot(params = {}) ⇒ Object

TODO check if this is a good decision to provide a wrapper.



12
13
14
# File 'lib/exotel_api/call.rb', line 12

def self.shoot(params={})
  self.new.shoot(params)
end

Instance Method Details

#connect_to_agent(params = {}) ⇒ Object



42
43
44
45
46
47
# File 'lib/exotel_api/call.rb', line 42

def connect_to_agent(params={})
  if valid?(params, {:type => 'agent'})
    params = transfrom_params(params, {:type => 'agent'})
    make_call(params)
  end
end

#connect_to_flow(params = {}) ⇒ Object



35
36
37
38
39
40
# File 'lib/exotel_api/call.rb', line 35

def connect_to_flow(params={})
  if valid?(params, {:type => 'flow'})
    params = transfrom_params(params, {:type => 'flow'})
    make_call(params)
  end
end

#details(sid) ⇒ Object



49
50
51
52
# File 'lib/exotel_api/call.rb', line 49

def details(sid)
  response = self.class.get("/#{ExotelApi.exotel_sid}/Calls/#{sid}",  :basic_auth => auth)
  handle_response(response)
end

#shoot(params = {}) ⇒ Object



28
29
30
31
32
33
# File 'lib/exotel_api/call.rb', line 28

def shoot(params={})
  if valid?(params, {:type => 'flow'})
    params = transfrom_params(params, {:type => 'flow'})
    make_call(params)
  end
end