Class: BandwidthIris::Dlda

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



26
27
28
29
30
# File 'lib/bandwidth-iris/dlda.rb', line 26

def self.create(client, item)
  location = client.make_request(:post, client.(DLDA_PATH), {:dlda_order => item})[1][:location]
  id = Client.get_id_from_location_header(location)
  self.get(client, id)
end

.get(client, id) ⇒ Object



19
20
21
22
23
# File 'lib/bandwidth-iris/dlda.rb', line 19

def self.get(client, id)
  data  = client.make_request(:get, "#{client.(DLDA_PATH)}/#{id}")[0]
  data[:id] = data[:dlda_order][:order_id]
  Dlda.new(data, client)
end

.list(client, query = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/bandwidth-iris/dlda.rb', line 8

def self.list(client, query = nil)
  list = client.make_request(:get, client.(DLDA_PATH), query)[0][:list_order_id_user_id_date][:order_id_user_id_date]
  return [] if !list
  list = if list.is_a?(Array) then list else [list] end
  list.map do |i|
    i[:id] = i[:order_id]
    Dlda.new(i, client)
  end
end

Instance Method Details

#get_historyObject



34
35
36
# File 'lib/bandwidth-iris/dlda.rb', line 34

def get_history()
  @client.make_request(:get,"#{@client.(DLDA_PATH)}/#{id}/history")[0][:order_history]
end