Class: FancyHands::Outgoing

Inherits:
Object
  • Object
show all
Defined in:
lib/fancyhands/v1/outgoing.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Outgoing

Returns a new instance of Outgoing.



6
7
8
# File 'lib/fancyhands/v1/outgoing.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#get(key = "", status = "", cursor = "") ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/fancyhands/v1/outgoing.rb', line 31

def get(key="", status="", cursor="")
  data = {
    :key => key,
    :status => status,
    :cursor => cursor
  }
  return @client.request.get("call/outgoing", data)
end

#post(phone = "", conversation = {}, title = "", record = "", _retry = "", retry_delay = "", retry_limit = "", call_window_start = nil, call_window_end = nil, timeout = nil, voicemail = false) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fancyhands/v1/outgoing.rb', line 10

def post(phone="", conversation={}, title="", record="", _retry="", retry_delay="", retry_limit="", call_window_start=nil, call_window_end=nil, timeout=nil, voicemail=false)
  data = {
    :phone => phone,
    :conversation => JSON.generate(conversation),
    :title => title,
    :record => record,
    :retry => _retry,
    :retry_delay => retry_delay,
    :retry_limit => retry_limit,
    :timeout => timeout,
    :voicemail => voicemail,
  }

  if call_window_start and call_window_end
    data[:call_window_start] = call_window_start.strftime("%Y-%m-%dT%H:%M:%SZ")
    data[:call_window_end] = call_window_end.strftime("%Y-%m-%dT%H:%M:%SZ")
  end

  return @client.request.post("call/outgoing", data)
end