class BandwidthIris::Order

Public Class Methods

create(client, item) click to toggle source
# File lib/bandwidth-iris/order.rb, line 8
def self.create(client, item)
  data = client.make_request(:post, client.concat_account_path(ORDER_PATH), {:order => item})[0][:order]
  Order.new(data, client)
end
get(client, id) click to toggle source
# File lib/bandwidth-iris/order.rb, line 14
def self.get(client, id)
  data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0][:order]
  data[:id] = id
  Order.new(data, client)
end
get_order_response(client, id) click to toggle source
# File lib/bandwidth-iris/order.rb, line 21
def self.get_order_response(client, id)
  data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0]
  data[:id] = id
  Order.new(data, client)
end
get_tns_by_order_id(client, id) click to toggle source

‘get order` no longer returns an `id`, which means the subsequent `get_tns` call will fail This is a workaround to provide the “get tns by order id” functionality

# File lib/bandwidth-iris/order.rb, line 38
def self.get_tns_by_order_id(client, id)
  client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}/tns")[0]
end
list(client, query = nil) click to toggle source
# File lib/bandwidth-iris/order.rb, line 28
def self.list(client, query = nil)
  list = client.make_request(:get, client.concat_account_path(ORDER_PATH), query)[0][:orders][:order]
  return [] if !list
  list = if list.is_a?(Array) then list else [list]  end
  list.map {|i| Order.new(i, client)}
end

Public Instance Methods

add_notes(note) click to toggle source
# File lib/bandwidth-iris/order.rb, line 57
def add_notes(note)
  r = @client.make_request(:post, "#{@client.concat_account_path(ORDER_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_area_codes() click to toggle source
# File lib/bandwidth-iris/order.rb, line 63
def get_area_codes()
  list = @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/areaCodes")[0][:telephone_details_report]
  return [] if !list
  if list.is_a?(Array) then list else [list]  end
end
get_history() click to toggle source
# File lib/bandwidth-iris/order.rb, line 85
def get_history()
  list = @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/history")[0][:order_history]
  return [] if !list
  if list.is_a?(Array) then list else [list]  end
end
get_notes() click to toggle source
# File lib/bandwidth-iris/order.rb, line 47
def get_notes()
  list = @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/notes")[0][:note]
  return [] if !list
  if list.is_a?(Array)
    list
  else
    [list]
  end
end
get_npa_npx() click to toggle source
# File lib/bandwidth-iris/order.rb, line 69
def get_npa_npx()
  list = @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/npaNxx")[0][:telephone_details_report]
  return [] if !list
  if list.is_a?(Array) then list else [list]  end
end
get_tns() click to toggle source
# File lib/bandwidth-iris/order.rb, line 81
def get_tns()
  @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/tns")[0]
end
get_totals() click to toggle source
# File lib/bandwidth-iris/order.rb, line 75
def get_totals()
  list = @client.make_request(:get, "#{@client.concat_account_path(ORDER_PATH)}/#{id}/totals")[0][:telephone_details_report]
  return [] if !list
  if list.is_a?(Array) then list else [list]  end
end
update(data) click to toggle source
# File lib/bandwidth-iris/order.rb, line 43
def update(data)
  @client.make_request(:put, "#{@client.concat_account_path(ORDER_PATH)}/#{id}", {:order => data})[0]
end