Class: BandwidthIris::Tn

Inherits:
Object
  • Object
show all
Extended by:
ClientWrapper
Includes:
ApiItem
Defined in:
lib/bandwidth-iris/tn.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClientWrapper

wrap_client_arg

Methods included from ApiItem

#[], #[]=, #initialize, #to_data

Class Method Details

.get(client, number) ⇒ Object



8
9
10
11
# File 'lib/bandwidth-iris/tn.rb', line 8

def self.get(client, number)
  data  = client.make_request(:get, "#{TN_PATH}/#{CGI.escape(number)}")[0]
  Tn.new(data, client)
end

.list(client, query = nil) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/bandwidth-iris/tn.rb', line 15

def self.list(client, query = nil)
  list = client.make_request(:get, TN_PATH, query)[0][:telephone_numbers][:telephone_number]
  return [] if !list
  list = if list.is_a?(Array) then list else [list] end
  list.map do |i|
    Tn.new(i, client)
  end
end

Instance Method Details

#get_detailsObject



37
38
39
# File 'lib/bandwidth-iris/tn.rb', line 37

def get_details()
  @client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/tndetails")[0][:telephone_number_details]
end

#get_rate_centerObject



33
34
35
# File 'lib/bandwidth-iris/tn.rb', line 33

def get_rate_center()
  @client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/ratecenter")[0][:telephone_number_details]
end

#get_sip_peersObject



29
30
31
# File 'lib/bandwidth-iris/tn.rb', line 29

def get_sip_peers()
  @client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/sippeers")[0]
end

#get_sitesObject



25
26
27
# File 'lib/bandwidth-iris/tn.rb', line 25

def get_sites()
  @client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/sites")[0]
end

#move(params) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/bandwidth-iris/tn.rb', line 41

def move(params)
  @client.make_request(
    :post,
    @client.("moveTns"),
    MoveTnsOrder: params.merge(TelephoneNumbers: { TelephoneNumber: telephone_number })
  )
end