Class: BandwidthIris::TnReservation

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



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

def self.create(client, number)
  reservation_request = {:reservation => {:reserved_tn => number } }
  location = client.make_request(:post, client.(TN_RESERVATION_PATH), reservation_request)[1][:location]
  id = Client.get_id_from_location_header(location)
  self.get(client, id)
end

.get(client, id) ⇒ Object



9
10
11
12
13
# File 'lib/bandwidth-iris/tn_reservation.rb', line 9

def self.get(client, id)
  data  = client.make_request(:get, "#{client.(TN_RESERVATION_PATH)}/#{id}")[0][:reservation]
  data[:id] = id
  TnReservation.new(data, client)
end

Instance Method Details

#deleteObject



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

def delete()
  @client.make_request(:delete,"#{@client.(TN_RESERVATION_PATH)}/#{id}")
end