Class: Wave::Phone

Inherits:
Object
  • Object
show all
Defined in:
lib/wave/phone.rb

Overview

Phone — VoIP phone lines and call management

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Phone

Returns a new instance of Phone.



6
7
8
# File 'lib/wave/phone.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#list_calls(page: nil, per_page: nil, line_id: nil, direction: nil) ⇒ Object

List calls (operationId: listCalls, GET /phone/calls).



25
26
27
28
29
30
31
32
33
# File 'lib/wave/phone.rb', line 25

def list_calls(page: nil, per_page: nil, line_id: nil, direction: nil)
  query = {
    "page" => page,
    "perPage" => per_page,
    "lineId" => line_id,
    "direction" => direction,
  }
  @client.request("GET", "/phone/calls", query: query)
end

#list_lines(page: nil, per_page: nil) ⇒ Object

List phone lines (operationId: listPhoneLines, GET /phone/lines).



11
12
13
14
15
16
17
# File 'lib/wave/phone.rb', line 11

def list_lines(page: nil, per_page: nil)
  query = {
    "page" => page,
    "perPage" => per_page,
  }
  @client.request("GET", "/phone/lines", query: query)
end

#make_call(body) ⇒ Object

Make a call (operationId: makeCall, POST /phone/calls).



36
37
38
# File 'lib/wave/phone.rb', line 36

def make_call(body)
  @client.request("POST", "/phone/calls", body: body)
end

#provision_line(body) ⇒ Object

Provision a phone line (operationId: provisionPhoneLine, POST /phone/lines).



20
21
22
# File 'lib/wave/phone.rb', line 20

def provision_line(body)
  @client.request("POST", "/phone/lines", body: body)
end