Class: BandwidthIris::LsrOrder
- Inherits:
-
Object
- Object
- BandwidthIris::LsrOrder
show all
- Extended by:
- ClientWrapper
- Includes:
- ApiItem
- Defined in:
- lib/bandwidth-iris/lsr_order.rb
Class Method Summary
collapse
Instance Method Summary
collapse
wrap_client_arg
Methods included from ApiItem
#[], #[]=, #initialize, #to_data
Class Method Details
.create(client, item) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 8
def self.create(client, item)
item['_sPIDXmlElement'] = 'sPID'
location = client.make_request(:post, client.concat_account_path(LSR_ORDER_PATH), {:lsr_order => item})[1][:location]
id = Client.(location)
self.get(client, id)
end
|
.get(client, id) ⇒ Object
27
28
29
30
31
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 27
def self.get(client, id)
data = client.make_request(:get, "#{client.concat_account_path(LSR_ORDER_PATH)}/#{id}")[0]
data[:id] = data[:order_id]
LsrOrder.new(data, client)
end
|
.list(client, query = nil) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 16
def self.list(client, query = nil)
list = client.make_request(:get, client.concat_account_path(LSR_ORDER_PATH), query)[0][:lsr_order_summary]
return [] if !list
list = if list.is_a?(Array) then list else [list] end
list.map do |i|
i[:id] = i[:order_id]
LsrOrder.new(i, client)
end
end
|
Instance Method Details
#add_notes(note) ⇒ Object
47
48
49
50
51
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 47
def add_notes(note)
r = @client.make_request(:post, "#{@client.concat_account_path(LSR_ORDER_PATH)}/#{id}/notes", {:note => note})
note_id = Client.(r[1][:location])
(get_notes().select {|n| n[:id].to_s == note_id }).first
end
|
#get_history ⇒ Object
54
55
56
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 54
def get_history()
@client.make_request(:get,"#{@client.concat_account_path(LSR_ORDER_PATH)}/#{id}/history")[0][:order_history]
end
|
#get_notes ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 38
def get_notes()
list = @client.make_request(:get, "#{@client.concat_account_path(LSR_ORDER_PATH)}/#{id}/notes")[0][:note]
if list.is_a?(Array)
list
else
[list]
end
end
|
#update(data) ⇒ Object
34
35
36
|
# File 'lib/bandwidth-iris/lsr_order.rb', line 34
def update(data)
@client.make_request(:put,"#{@client.concat_account_path(LSR_ORDER_PATH)}/#{id}", {:lsr_order => data})
end
|