ruby-bandwidth-iris 2.0.1 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +403 -7
- data/examples/create_reservation_and_order.rb +79 -0
- data/examples/order_number.rb +83 -0
- data/lib/bandwidth-iris/applications.rb +61 -0
- data/lib/bandwidth-iris/client.rb +33 -1
- data/lib/bandwidth-iris/csr.rb +44 -0
- data/lib/bandwidth-iris/import_tn_orders.rb +44 -1
- data/lib/bandwidth-iris/order.rb +15 -0
- data/lib/bandwidth-iris/sip_peer_products.rb +118 -0
- data/lib/bandwidth-iris/tn_reservation.rb +4 -2
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +3 -0
- data/spec/bandwidth-iris/application_spec.rb +90 -0
- data/spec/bandwidth-iris/csr_spec.rb +73 -0
- data/spec/bandwidth-iris/import_tn_orders_spec.rb +82 -4
- data/spec/bandwidth-iris/order_spec.rb +18 -9
- data/spec/bandwidth-iris/sip_peer_products_spec.rb +162 -0
- data/spec/bandwidth-iris/tn_reservation_spec.rb +5 -5
- data/spec/xml.yml +16 -3
- metadata +13 -2
@@ -0,0 +1,79 @@
|
|
1
|
+
lib = File.expand_path("../../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'ruby-bandwidth-iris'
|
5
|
+
|
6
|
+
$bandwidth_account_id = ENV['BANDWIDTH_ACCOUNT_ID']
|
7
|
+
$bandwidth_user_name = ENV['BANDWIDTH_API_USER']
|
8
|
+
$bandwidth_password = ENV['BANDWIDTH_API_PASSWORD']
|
9
|
+
## Fill these in
|
10
|
+
$bandwidth_site_id = ENV['BANDWIDTH_SITE_ID']
|
11
|
+
$bandwidth_to_sippeer_id = ENV['BANDWIDTH_SIPPEER_ID']
|
12
|
+
|
13
|
+
|
14
|
+
def get_order_by_id(client, order_id:, attempts: 0)
|
15
|
+
begin
|
16
|
+
order_result = BandwidthIris::Order.get(client, order_id)
|
17
|
+
return order_result
|
18
|
+
rescue Exception => e
|
19
|
+
if attempts > 3
|
20
|
+
puts("Completely Failed fetching Order")
|
21
|
+
raise StandardError.new e
|
22
|
+
end
|
23
|
+
puts("Error Message: #{e.message}")
|
24
|
+
attempts = attempts+1
|
25
|
+
sleep(1)
|
26
|
+
return get_order_by_id(client, order_id: order_id, attempts: attempts)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_numbers_from_order_id(client, order_id:)
|
31
|
+
order = BandwidthIris::Order.new({:id => order_id}, client)
|
32
|
+
numbers_result = order.get_tns
|
33
|
+
return numbers_result
|
34
|
+
end
|
35
|
+
|
36
|
+
def order_numbers_with_reservation_id(client, reservation_id:, number:)
|
37
|
+
order_data = {
|
38
|
+
:name => "Reservation Test",
|
39
|
+
:site_id => $bandwidth_site_id,
|
40
|
+
:existing_telephone_number_order_type => {
|
41
|
+
:telephone_number_list => [
|
42
|
+
:telephone_number => number
|
43
|
+
],
|
44
|
+
:reservation_id_list => [
|
45
|
+
:reservation_id => reservation_id
|
46
|
+
]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
order_result = BandwidthIris::Order.create(client, order_data)
|
50
|
+
return order_result
|
51
|
+
end
|
52
|
+
|
53
|
+
def reserve_numbers(client, number:)
|
54
|
+
reservation = BandwidthIris::TnReservation.create(client, number)
|
55
|
+
return reservation
|
56
|
+
end
|
57
|
+
|
58
|
+
def search_numbers(client, area_code: 919)
|
59
|
+
list = BandwidthIris::AvailableNumber.list(client, {:area_code => area_code, :quantity => 5})
|
60
|
+
return list
|
61
|
+
end
|
62
|
+
|
63
|
+
def main()
|
64
|
+
client = BandwidthIris::Client.new($bandwidth_account_id, $bandwidth_user_name, $bandwidth_password)
|
65
|
+
available_numbers = search_numbers(client)
|
66
|
+
number = available_numbers[0]
|
67
|
+
reservation = reserve_numbers(client, number: number)
|
68
|
+
reservation_id = reservation.id
|
69
|
+
order = order_numbers_with_reservation_id(client, reservation_id: reservation_id, number: number)
|
70
|
+
order_id = order.id
|
71
|
+
puts(order_id)
|
72
|
+
my_order = get_order_by_id(client, order_id: order_id)
|
73
|
+
my_numbers = get_numbers_from_order_id(client, order_id:order_id)
|
74
|
+
puts(my_numbers)
|
75
|
+
end
|
76
|
+
|
77
|
+
if __FILE__ == $0
|
78
|
+
main
|
79
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
lib = File.expand_path("../../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require "ruby-bandwidth-iris"
|
5
|
+
|
6
|
+
def order_numbers_in_area_code(client, site_id:, sippeer_id:, area_code: 919, quantity: 1)
|
7
|
+
order_data = {
|
8
|
+
:name => "Test",
|
9
|
+
:site_id => site_id,
|
10
|
+
:area_code_search_and_order_type => {
|
11
|
+
:area_code => area_code,
|
12
|
+
:quantity => quantity
|
13
|
+
}
|
14
|
+
}
|
15
|
+
order_result = BandwidthIris::Order.create(client, order_data)
|
16
|
+
order_id = order_result.to_data[:id]
|
17
|
+
return order_id
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_order_by_id(client, order_id:, attempts: 0)
|
21
|
+
begin
|
22
|
+
order_result = BandwidthIris::Order.get(client, order_id)
|
23
|
+
return order_result
|
24
|
+
rescue Exception => e
|
25
|
+
if attempts > 3
|
26
|
+
puts("Completely Failed fetching Order")
|
27
|
+
raise StandardError.new e
|
28
|
+
end
|
29
|
+
puts("Error Message: #{e.message}\nCode:#{e.code}")
|
30
|
+
attempts = attempts+1
|
31
|
+
sleep(1)
|
32
|
+
return get_order_by_id(client, order_id: order_id, attempts: attempts)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_order_response_by_id(client, order_id:, attempts: 0)
|
37
|
+
begin
|
38
|
+
order_response = BandwidthIris::Order.get_order_response(client, order_id)
|
39
|
+
order_data = order_response.to_data
|
40
|
+
numbers = order_response.completed_numbers
|
41
|
+
completed_number = order_data[:completed_numbers][:telephone_number][:full_number]
|
42
|
+
return order_data
|
43
|
+
rescue Exception => e
|
44
|
+
if attempts > 3
|
45
|
+
puts("Completely Failed fetching Order")
|
46
|
+
raise StandardError.new e
|
47
|
+
end
|
48
|
+
puts("Error Message: #{e.message}\nCode:#{e.code}")
|
49
|
+
attempts = attempts+1
|
50
|
+
sleep(1)
|
51
|
+
return get_order_response(client, order_id: order_id, attempts: attempts)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def get_numbers_from_order_id(client, order_id:)
|
57
|
+
order = BandwidthIris::Order.new({:id => order_id}, client)
|
58
|
+
numbers_result = order.get_tns
|
59
|
+
return numbers_result
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_numbers_from_order(order)
|
63
|
+
numbers_result = order.get_tns
|
64
|
+
return numbers_result
|
65
|
+
end
|
66
|
+
|
67
|
+
def main
|
68
|
+
bandwidth_account_id = ENV["BANDWIDTH_ACCOUNT_ID"]
|
69
|
+
bandwidth_user_name = ENV["BANDWIDTH_API_USER"]
|
70
|
+
bandwidth_password = ENV["BANDWIDTH_API_PASSWORD"]
|
71
|
+
bandwidth_site_id = ENV["BANDWIDTH_SITE_ID"]
|
72
|
+
bandwidth_to_sippeer_id = ENV["BANDWIDTH_SIPPEER_ID"]
|
73
|
+
client = BandwidthIris::Client.new(bandwidth_account_id, bandwidth_user_name, bandwidth_password)
|
74
|
+
order_id = order_numbers_in_area_code(client, site_id: bandwidth_site_id, sippeer_id: bandwidth_to_sippeer_id)
|
75
|
+
my_order = get_order_by_id(client, order_id: order_id)
|
76
|
+
my_order_response = get_order_response_by_id(client, order_id: order_id)
|
77
|
+
my_numbers = get_numbers_from_order_id(client, order_id:order_id)
|
78
|
+
my_numbers = get_numbers_from_order(my_order)
|
79
|
+
end
|
80
|
+
|
81
|
+
if __FILE__ == $0
|
82
|
+
main
|
83
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
APPLICATIONS_PATH = "applications"
|
3
|
+
|
4
|
+
class Applications
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.get_applications(client)
|
9
|
+
data = client.make_request(:get, client.concat_account_path(APPLICATIONS_PATH))
|
10
|
+
list = data[0][:application_list][:application]
|
11
|
+
return [] if !list
|
12
|
+
if list.is_a?(Array) then
|
13
|
+
return list
|
14
|
+
else
|
15
|
+
return [list]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
wrap_client_arg :get_applications
|
19
|
+
|
20
|
+
def self.create_application(client, application_data)
|
21
|
+
data = client.make_request(:post, client.concat_account_path(APPLICATIONS_PATH), {:application => application_data})
|
22
|
+
return data[0][:application]
|
23
|
+
end
|
24
|
+
wrap_client_arg :create_application
|
25
|
+
|
26
|
+
def self.get_application(client, application_id)
|
27
|
+
data = client.make_request(:get, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"))
|
28
|
+
return data[0][:application]
|
29
|
+
end
|
30
|
+
wrap_client_arg :get_application
|
31
|
+
|
32
|
+
def self.partial_update_application(client, application_id, application_data)
|
33
|
+
data = client.make_request(:patch, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"), {:application => application_data})
|
34
|
+
return data[0][:application]
|
35
|
+
end
|
36
|
+
wrap_client_arg :partial_update_application
|
37
|
+
|
38
|
+
def self.complete_update_application(client, application_id, application_data)
|
39
|
+
data = client.make_request(:put, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"), {:application => application_data})
|
40
|
+
return data[0][:application]
|
41
|
+
end
|
42
|
+
wrap_client_arg :complete_update_application
|
43
|
+
|
44
|
+
def self.delete_application(client, application_id)
|
45
|
+
client.make_request(:delete, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"))
|
46
|
+
end
|
47
|
+
wrap_client_arg :delete_application
|
48
|
+
|
49
|
+
def self.get_application_sippeers(client, application_id)
|
50
|
+
data = client.make_request(:get, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}/associatedsippeers"))
|
51
|
+
list = data[0][:associated_sip_peers][:associated_sip_peer]
|
52
|
+
return [] if !list
|
53
|
+
if list.is_a?(Array) then
|
54
|
+
return list
|
55
|
+
else
|
56
|
+
return [list]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
wrap_client_arg :get_application_sippeers
|
60
|
+
end
|
61
|
+
end
|
@@ -77,12 +77,44 @@ module BandwidthIris
|
|
77
77
|
req.params = d unless d == nil || d.empty?
|
78
78
|
end
|
79
79
|
else
|
80
|
-
|
80
|
+
xml_to_send = build_xml(data) # help debug
|
81
|
+
connection.run_request(method, @build_path.call(path), xml_to_send, {'Content-Type' => 'application/xml'})
|
81
82
|
end
|
82
83
|
body = check_response(response)
|
83
84
|
[body || {}, symbolize(response.headers || {})]
|
84
85
|
end
|
85
86
|
|
87
|
+
# Makes an HTTP request for file uploads
|
88
|
+
# @param method [Symbol] http method to make
|
89
|
+
# @param path [string] path of url (exclude api verion and endpoint) to make call
|
90
|
+
# @param data [string] the raw binary string representing the file to upload
|
91
|
+
# @param content_type [string] the content type of the request
|
92
|
+
# @return [Array] array with 2 elements: parsed data of response and response headers
|
93
|
+
def make_request_file_upload(method, path, data, content_type)
|
94
|
+
connection = @create_connection.call()
|
95
|
+
response = connection.run_request(method, @build_path.call(path), data, {'Content-Type' => content_type})
|
96
|
+
body = check_response(response)
|
97
|
+
[body || {}, symbolize(response.headers || {})]
|
98
|
+
end
|
99
|
+
|
100
|
+
# Makes an HTTP request for a file download
|
101
|
+
# @param method [Symbol] http method to make
|
102
|
+
# @param path [string] path of url (exclude api verion and endpoint) to make call
|
103
|
+
# @param data [Hash] data which will be sent with request (for :get and :delete request they will be sent with query in url)
|
104
|
+
# @return [string] raw response from the API
|
105
|
+
def make_request_file_download(method, path, data = {})
|
106
|
+
connection = @create_connection.call()
|
107
|
+
response = if method == :get || method == :delete
|
108
|
+
d = camelcase(data)
|
109
|
+
connection.run_request(method, @build_path.call(path), nil, nil) do |req|
|
110
|
+
req.params = d unless d == nil || d.empty?
|
111
|
+
end
|
112
|
+
else
|
113
|
+
connection.run_request(method, @build_path.call(path), build_xml(data), {'Content-Type' => 'application/xml'})
|
114
|
+
end
|
115
|
+
return response.body
|
116
|
+
end
|
117
|
+
|
86
118
|
# Check response object and raise error if status code >= 400
|
87
119
|
# @param response response object
|
88
120
|
def check_response(response)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
CSR_PATH = 'csrs'
|
3
|
+
|
4
|
+
class Csr
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.create(client, csr_data)
|
9
|
+
data = client.make_request(:post, client.concat_account_path("#{CSR_PATH}"), {:csr => csr_data})
|
10
|
+
return data
|
11
|
+
end
|
12
|
+
wrap_client_arg :create
|
13
|
+
|
14
|
+
def self.get(client, csr_id)
|
15
|
+
data = client.make_request(:get, client.concat_account_path("#{CSR_PATH}/#{csr_id}"))
|
16
|
+
return data
|
17
|
+
end
|
18
|
+
wrap_client_arg :get
|
19
|
+
|
20
|
+
def self.replace(client, csr_id, csr_data)
|
21
|
+
data = client.make_request(:put, client.concat_account_path("#{CSR_PATH}/#{csr_id}"), {:csr => csr_data})
|
22
|
+
return data
|
23
|
+
end
|
24
|
+
wrap_client_arg :replace
|
25
|
+
|
26
|
+
def self.get_notes(client, csr_id)
|
27
|
+
data = client.make_request(:get, client.concat_account_path("#{CSR_PATH}/#{csr_id}/notes"))
|
28
|
+
return data
|
29
|
+
end
|
30
|
+
wrap_client_arg :get_notes
|
31
|
+
|
32
|
+
def self.add_note(client, csr_id, note_data)
|
33
|
+
data = client.make_request(:post, client.concat_account_path("#{CSR_PATH}/#{csr_id}/notes"), {:note => note_data})
|
34
|
+
return data
|
35
|
+
end
|
36
|
+
wrap_client_arg :add_note
|
37
|
+
|
38
|
+
def self.update_note(client, csr_id, note_id, note_data)
|
39
|
+
data = client.make_request(:put, client.concat_account_path("#{CSR_PATH}/#{csr_id}/notes/#{note_id}"), {:note => note_data})
|
40
|
+
return data
|
41
|
+
end
|
42
|
+
wrap_client_arg :update_note
|
43
|
+
end
|
44
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module BandwidthIris
|
2
|
-
IMPORT_TN_ORDERS_PATH = "
|
2
|
+
IMPORT_TN_ORDERS_PATH = "importtnorders"
|
3
3
|
|
4
4
|
class ImportTnOrders
|
5
5
|
extend ClientWrapper
|
@@ -28,5 +28,48 @@ module BandwidthIris
|
|
28
28
|
return data
|
29
29
|
end
|
30
30
|
wrap_client_arg :create_import_tn_order
|
31
|
+
|
32
|
+
def self.get_loa_files(client, order_id)
|
33
|
+
data = client.make_request(:get, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}"))
|
34
|
+
return data
|
35
|
+
end
|
36
|
+
wrap_client_arg :get_loa_files
|
37
|
+
|
38
|
+
def self.upload_loa_file(client, order_id, file_contents, mime_type)
|
39
|
+
client.make_request_file_upload(:post, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}"), file_contents, mime_type)
|
40
|
+
end
|
41
|
+
wrap_client_arg :upload_loa_file
|
42
|
+
|
43
|
+
def self.download_loa_file(client, order_id, file_id)
|
44
|
+
data = client.make_request_file_download(:get, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}"))
|
45
|
+
return data
|
46
|
+
end
|
47
|
+
wrap_client_arg :download_loa_file
|
48
|
+
|
49
|
+
def self.replace_loa_file(client, order_id, file_id, file_contents, mime_type)
|
50
|
+
data = client.make_request_file_upload(:put, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}"), file_contents, mime_type)
|
51
|
+
end
|
52
|
+
wrap_client_arg :replace_loa_file
|
53
|
+
|
54
|
+
def self.delete_loa_file(client, order_id, file_id)
|
55
|
+
client.make_request(:delete, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}"))
|
56
|
+
end
|
57
|
+
wrap_client_arg :delete_loa_file
|
58
|
+
|
59
|
+
def self.get_loa_file_metadata(client, order_id, file_id)
|
60
|
+
data = client.make_request(:get, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}/metadata"))
|
61
|
+
return data
|
62
|
+
end
|
63
|
+
wrap_client_arg :get_loa_file_metadata
|
64
|
+
|
65
|
+
def self.update_loa_file_metadata(client, order_id, file_id, file_metadata)
|
66
|
+
client.make_request(:put, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}/metadata"), {:file_meta_data => file_metadata})
|
67
|
+
end
|
68
|
+
wrap_client_arg :update_loa_file_metadata
|
69
|
+
|
70
|
+
def self.delete_loa_file_metadata(client, order_id, file_id)
|
71
|
+
client.make_request(:delete, client.concat_account_path("#{IMPORT_TN_ORDERS_PATH}/#{order_id}/#{LOAS_PATH}/#{file_id}/metadata"))
|
72
|
+
end
|
73
|
+
wrap_client_arg :delete_loa_file_metadata
|
31
74
|
end
|
32
75
|
end
|
data/lib/bandwidth-iris/order.rb
CHANGED
@@ -13,6 +13,14 @@ module BandwidthIris
|
|
13
13
|
|
14
14
|
def self.get(client, id)
|
15
15
|
data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0][:order]
|
16
|
+
data[:id] = id
|
17
|
+
Order.new(data, client)
|
18
|
+
end
|
19
|
+
wrap_client_arg :get
|
20
|
+
|
21
|
+
def self.get_order_response(client, id)
|
22
|
+
data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0]
|
23
|
+
data[:id] = id
|
16
24
|
Order.new(data, client)
|
17
25
|
end
|
18
26
|
wrap_client_arg :get
|
@@ -25,6 +33,13 @@ module BandwidthIris
|
|
25
33
|
end
|
26
34
|
wrap_client_arg :list
|
27
35
|
|
36
|
+
#`get order` no longer returns an `id`, which means the subsequent `get_tns` call will fail
|
37
|
+
#This is a workaround to provide the "get tns by order id" functionality
|
38
|
+
def self.get_tns_by_order_id(client, id)
|
39
|
+
client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}/tns")[0]
|
40
|
+
end
|
41
|
+
wrap_client_arg :get_tns_by_order_id
|
42
|
+
|
28
43
|
def update(data)
|
29
44
|
@client.make_request(:put, "#{@client.concat_account_path(ORDER_PATH)}/#{id}", {:order => data})[0]
|
30
45
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
SIPPEER_PRODUCTS_PATH = 'products'
|
3
|
+
|
4
|
+
class SipPeerProducts
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.get_origination_settings(client, site_id, sippeer_id)
|
9
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings")
|
10
|
+
return response[0][:sip_peer_origination_settings]
|
11
|
+
end
|
12
|
+
wrap_client_arg :get_origination_settings
|
13
|
+
|
14
|
+
def self.create_origination_settings(client, site_id, sippeer_id, data)
|
15
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings", {:sip_peer_origination_settings => data})
|
16
|
+
return response[0][:sip_peer_origination_settings]
|
17
|
+
end
|
18
|
+
wrap_client_arg :create_origination_settings
|
19
|
+
|
20
|
+
def self.update_origination_settings(client, site_id, sippeer_id, data)
|
21
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings", {:sip_peer_origination_settings => data})
|
22
|
+
end
|
23
|
+
wrap_client_arg :update_origination_settings
|
24
|
+
|
25
|
+
def self.get_termination_settings(client, site_id, sippeer_id)
|
26
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings")
|
27
|
+
return response[0][:sip_peer_termination_settings]
|
28
|
+
end
|
29
|
+
wrap_client_arg :get_termination_settings
|
30
|
+
|
31
|
+
def self.create_termination_settings(client, site_id, sippeer_id, data)
|
32
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings", {:sip_peer_termination_settings => data})
|
33
|
+
return response[0][:sip_peer_termination_settings]
|
34
|
+
end
|
35
|
+
wrap_client_arg :create_termination_settings
|
36
|
+
|
37
|
+
def self.update_termination_settings(client, site_id, sippeer_id, data)
|
38
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings", {:sip_peer_termination_settings => data})
|
39
|
+
end
|
40
|
+
wrap_client_arg :update_termination_settings
|
41
|
+
|
42
|
+
def self.get_sms_feature_settings(client, site_id, sippeer_id)
|
43
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms")
|
44
|
+
return response[0][:sip_peer_sms_feature]
|
45
|
+
end
|
46
|
+
wrap_client_arg :get_sms_feature_settings
|
47
|
+
|
48
|
+
def self.create_sms_feature_settings(client, site_id, sippeer_id, data)
|
49
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms", {:sip_peer_sms_feature => data})
|
50
|
+
return response[0][:sip_peer_sms_feature]
|
51
|
+
end
|
52
|
+
wrap_client_arg :create_sms_feature_settings
|
53
|
+
|
54
|
+
def self.update_sms_feature_settings(client, site_id, sippeer_id, data)
|
55
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms", {:sip_peer_sms_feature => data})
|
56
|
+
return response[0][:sip_peer_sms_feature]
|
57
|
+
end
|
58
|
+
wrap_client_arg :update_sms_feature_settings
|
59
|
+
|
60
|
+
def self.delete_sms_feature_settings(client, site_id, sippeer_id)
|
61
|
+
response = client.make_request(:delete, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms")
|
62
|
+
return response
|
63
|
+
end
|
64
|
+
wrap_client_arg :delete_sms_feature_settings
|
65
|
+
|
66
|
+
def self.get_mms_feature_settings(client, site_id, sippeer_id)
|
67
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms")
|
68
|
+
return response[0][:mms_feature]
|
69
|
+
end
|
70
|
+
wrap_client_arg :get_mms_feature_settings
|
71
|
+
|
72
|
+
def self.create_mms_feature_settings(client, site_id, sippeer_id, data)
|
73
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms", {:mms_feature => data})
|
74
|
+
return response[0][:mms_feature]
|
75
|
+
end
|
76
|
+
wrap_client_arg :create_mms_feature_settings
|
77
|
+
|
78
|
+
def self.update_mms_feature_settings(client, site_id, sippeer_id, data)
|
79
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms", {:mms_feature => data})
|
80
|
+
end
|
81
|
+
wrap_client_arg :update_mms_feature_settings
|
82
|
+
|
83
|
+
def self.delete_mms_feature_settings(client, site_id, sippeer_id)
|
84
|
+
client.make_request(:delete, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms")
|
85
|
+
end
|
86
|
+
wrap_client_arg :delete_mms_feature_settings
|
87
|
+
|
88
|
+
def self.get_mms_feature_mms_settings(client, site_id, sippeer_id)
|
89
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms/settings")
|
90
|
+
return response[0][:mms_settings]
|
91
|
+
end
|
92
|
+
wrap_client_arg :get_mms_feature_mms_settings
|
93
|
+
|
94
|
+
def self.get_messaging_application_settings(client, site_id, sippeer_id)
|
95
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/applicationSettings")
|
96
|
+
return response[0][:applications_settings]
|
97
|
+
end
|
98
|
+
wrap_client_arg :get_messaging_application_settings
|
99
|
+
|
100
|
+
def self.update_messaging_application_settings(client, site_id, sippeer_id, data)
|
101
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/applicationSettings", {:applications_settings => data})
|
102
|
+
return response[0][:applications_settings]
|
103
|
+
end
|
104
|
+
wrap_client_arg :update_messaging_application_settings
|
105
|
+
|
106
|
+
def self.get_messaging_settings(client, site_id, sippeer_id)
|
107
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/settings")
|
108
|
+
return response[0][:sip_peer_messaging_settings]
|
109
|
+
end
|
110
|
+
wrap_client_arg :get_messaging_settings
|
111
|
+
|
112
|
+
def self.update_messaging_settings(client, site_id, sippeer_id, data)
|
113
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/settings", {:sip_peer_messaging_settings => data})
|
114
|
+
return response[0][:sip_peer_messaging_settings]
|
115
|
+
end
|
116
|
+
wrap_client_arg :update_messaging_settings
|
117
|
+
end
|
118
|
+
end
|