Class: BandwidthIris::Disconnect

Inherits:
Object
  • Object
show all
Extended by:
ClientWrapper
Includes:
ApiItem
Defined in:
lib/bandwidth-iris/disconnect.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

.create(client, order_name, numbers) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bandwidth-iris/disconnect.rb', line 8

def self.create(client, order_name, numbers)
  data = {
    :disconnect_telephone_number_order =>{
      :name => order_name,
      '_nameXmlElement' => 'name',
      :disconnect_telephone_number_order_type => {
          :telephone_number_list => {
            :telephone_number => numbers
          }
        }
    }
  }
  client.make_request(:post, client.(DISCONNECT_PATH), data)[0]
end

.get(client, id) ⇒ Object



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

def self.get(client, id)
  data = client.make_request(:get, "#{client.(DISCONNECT_PATH)}/#{id}")
  data
end

Instance Method Details

#add_notes(note) ⇒ Object



40
41
42
43
44
# File 'lib/bandwidth-iris/disconnect.rb', line 40

def add_notes(note)
  r = @client.make_request(:post, "#{@client.(DISCONNECT_PATH)}/#{id}/notes", {:note => note})
  note_id = Client.get_id_from_location_header(r[1][:location])
  (get_notes().select {|n| n[:id].to_s == note_id }).first
end

#get_notesObject



30
31
32
33
34
35
36
37
38
# File 'lib/bandwidth-iris/disconnect.rb', line 30

def get_notes()
  list = @client.make_request(:get, "#{@client.(DISCONNECT_PATH)}/#{id}/notes")[0][:note]
  return [] if !list
  if list.is_a?(Array)
    list
  else
    [list]
  end
end