ruby-bandwidth-iris 3.0.0.pre → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +510 -5
- data/examples/create_reservation_and_order.rb +79 -0
- data/examples/order_number.rb +83 -0
- data/lib/bandwidth-iris/aeui.rb +20 -0
- data/lib/bandwidth-iris/applications.rb +61 -0
- data/lib/bandwidth-iris/client.rb +6 -4
- data/lib/bandwidth-iris/emergency_notification_endpoints.rb +26 -0
- data/lib/bandwidth-iris/emergency_notification_groups.rb +39 -0
- data/lib/bandwidth-iris/emergency_notification_recipients.rb +37 -0
- data/lib/bandwidth-iris/order.rb +15 -0
- data/lib/bandwidth-iris/sip_peer_products.rb +118 -0
- data/lib/bandwidth-iris/tn_options.rb +26 -0
- data/lib/bandwidth-iris/tn_reservation.rb +4 -2
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +7 -0
- data/spec/bandwidth-iris/aeui_spec.rb +25 -0
- data/spec/bandwidth-iris/application_spec.rb +90 -0
- data/spec/bandwidth-iris/emergency_notification_endpoints_spec.rb +35 -0
- data/spec/bandwidth-iris/emergency_notification_groups_spec.rb +48 -0
- data/spec/bandwidth-iris/emergency_notification_recipients_spec.rb +48 -0
- 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_options_spec.rb +42 -0
- data/spec/bandwidth-iris/tn_reservation_spec.rb +5 -5
- data/spec/xml.yml +28 -3
- metadata +27 -4
@@ -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,20 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
AEUI_PATH = 'aeuis'
|
3
|
+
|
4
|
+
class AlternateEndUserIdentity
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.get_alternate_end_user_information(client, query=nil)
|
9
|
+
response = client.make_request(:get, "#{client.concat_account_path(AEUI_PATH)}", query)
|
10
|
+
return response[0]
|
11
|
+
end
|
12
|
+
wrap_client_arg :get_alternate_end_user_information
|
13
|
+
|
14
|
+
def self.get_alternate_caller_information(client, acid)
|
15
|
+
response = client.make_request(:get, "#{client.concat_account_path(AEUI_PATH)}/#{acid}")
|
16
|
+
return response[0][:alternate_end_user_identifier]
|
17
|
+
end
|
18
|
+
wrap_client_arg :get_alternate_caller_information
|
19
|
+
end
|
20
|
+
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
|
@@ -22,7 +22,7 @@ module BandwidthIris
|
|
22
22
|
password = options[:password] unless password
|
23
23
|
options[:api_endpoint] = @@global_options[:api_endpoint] unless options[:api_endpoint]
|
24
24
|
options[:api_version] = @@global_options[:api_version] unless options[:api_version]
|
25
|
-
api_endpoint = options[:api_endpoint] || "https://
|
25
|
+
api_endpoint = options[:api_endpoint] || "https://dasbhoard.bandwidth.com"
|
26
26
|
api_version = options[:api_version] || "v1.0"
|
27
27
|
|
28
28
|
@build_path = lambda {|path| "/#{api_version}" + (if path[0] == "/" then path else "/#{path}" end) }
|
@@ -32,6 +32,7 @@ module BandwidthIris
|
|
32
32
|
faraday.basic_auth(user_name, password)
|
33
33
|
#faraday.response :logger
|
34
34
|
faraday.headers['Accept'] = 'application/xml'
|
35
|
+
faraday.headers['user-agent'] = 'Ruby-Bandwidth-Iris'
|
35
36
|
faraday.use FaradayMiddleware::FollowRedirects
|
36
37
|
@set_adapter.call(faraday)
|
37
38
|
}
|
@@ -77,7 +78,8 @@ module BandwidthIris
|
|
77
78
|
req.params = d unless d == nil || d.empty?
|
78
79
|
end
|
79
80
|
else
|
80
|
-
|
81
|
+
xml_to_send = build_xml(data) # help debug
|
82
|
+
connection.run_request(method, @build_path.call(path), xml_to_send, {'Content-Type' => 'application/xml'})
|
81
83
|
end
|
82
84
|
body = check_response(response)
|
83
85
|
[body || {}, symbolize(response.headers || {})]
|
@@ -86,7 +88,7 @@ module BandwidthIris
|
|
86
88
|
# Makes an HTTP request for file uploads
|
87
89
|
# @param method [Symbol] http method to make
|
88
90
|
# @param path [string] path of url (exclude api verion and endpoint) to make call
|
89
|
-
# @param data [string] the raw binary string representing the file to upload
|
91
|
+
# @param data [string] the raw binary string representing the file to upload
|
90
92
|
# @param content_type [string] the content type of the request
|
91
93
|
# @return [Array] array with 2 elements: parsed data of response and response headers
|
92
94
|
def make_request_file_upload(method, path, data, content_type)
|
@@ -100,7 +102,7 @@ module BandwidthIris
|
|
100
102
|
# @param method [Symbol] http method to make
|
101
103
|
# @param path [string] path of url (exclude api verion and endpoint) to make call
|
102
104
|
# @param data [Hash] data which will be sent with request (for :get and :delete request they will be sent with query in url)
|
103
|
-
# @return [string] raw response from the API
|
105
|
+
# @return [string] raw response from the API
|
104
106
|
def make_request_file_download(method, path, data = {})
|
105
107
|
connection = @create_connection.call()
|
106
108
|
response = if method == :get || method == :delete
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
ENE_ORDERS_PATH = 'emergencyNotificationEndpointOrders'
|
3
|
+
|
4
|
+
class EmergencyNotificationEndpoints
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.create_emergency_notification_endpoint_order(client, data)
|
9
|
+
response = client.make_request(:post, "#{client.concat_account_path(ENE_ORDERS_PATH)}", {:emergency_notification_endpoint_order => data})
|
10
|
+
return response[0][:emergency_notification_endpoint_order]
|
11
|
+
end
|
12
|
+
wrap_client_arg :create_emergency_notification_endpoint_order
|
13
|
+
|
14
|
+
def self.get_emergency_notification_endpoint_orders(client, query=nil)
|
15
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENE_ORDERS_PATH)}", query)
|
16
|
+
return response[0]
|
17
|
+
end
|
18
|
+
wrap_client_arg :get_emergency_notification_endpoint_orders
|
19
|
+
|
20
|
+
def self.get_emergency_notification_endpoint_order(client, order_id)
|
21
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENE_ORDERS_PATH)}/#{order_id}")
|
22
|
+
return response[0][:emergency_notification_endpoint_order]
|
23
|
+
end
|
24
|
+
wrap_client_arg :get_emergency_notification_endpoint_order
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
ENG_ORDERS_PATH = 'emergencyNotificationGroupOrders'
|
3
|
+
ENG_PATH = 'emergencyNotificationGroups'
|
4
|
+
|
5
|
+
class EmergencyNotificationGroups
|
6
|
+
extend ClientWrapper
|
7
|
+
include ApiItem
|
8
|
+
|
9
|
+
def self.create_emergency_notification_group_order(client, data)
|
10
|
+
response = client.make_request(:post, "#{client.concat_account_path(ENG_ORDERS_PATH)}", {:emergency_notification_group_order => data})
|
11
|
+
return response[0][:emergency_notification_endpoint_order]
|
12
|
+
end
|
13
|
+
wrap_client_arg :create_emergency_notification_group_order
|
14
|
+
|
15
|
+
def self.get_emergency_notification_group_orders(client, query=nil)
|
16
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENG_ORDERS_PATH)}", query)
|
17
|
+
return response[0]
|
18
|
+
end
|
19
|
+
wrap_client_arg :get_emergency_notification_group_orders
|
20
|
+
|
21
|
+
def self.get_emergency_notification_group_order(client, order_id)
|
22
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENG_ORDERS_PATH)}/#{order_id}")
|
23
|
+
return response[0][:emergency_notification_endpoint_order]
|
24
|
+
end
|
25
|
+
wrap_client_arg :get_emergency_notification_group_order
|
26
|
+
|
27
|
+
def self.get_emergency_notification_group(client, eng_id)
|
28
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENG_PATH)}/#{eng_id}")
|
29
|
+
return response[0][:emergency_notification_group]
|
30
|
+
end
|
31
|
+
wrap_client_arg :get_emergency_notification_group
|
32
|
+
|
33
|
+
def self.get_emergency_notification_groups(client, query=nil)
|
34
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENG_PATH)}", query)
|
35
|
+
return response[0]
|
36
|
+
end
|
37
|
+
wrap_client_arg :get_emergency_notification_groups
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
ENR_PATH = 'emergencyNotificationRecipients'
|
3
|
+
|
4
|
+
class EmergencyNotificationRecipients
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.create_emergency_notification_recipient(client, data)
|
9
|
+
response = client.make_request(:post, "#{client.concat_account_path(ENR_PATH)}", {:emergency_notification_recipient => data})
|
10
|
+
return response[0][:emergency_notification_recipient]
|
11
|
+
end
|
12
|
+
wrap_client_arg :create_emergency_notification_recipient
|
13
|
+
|
14
|
+
def self.get_emergency_notification_recipients(client, query=nil)
|
15
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENR_PATH)}", query)
|
16
|
+
return response[0]
|
17
|
+
end
|
18
|
+
wrap_client_arg :get_emergency_notification_recipients
|
19
|
+
|
20
|
+
def self.get_emergency_notification_recipient(client, enr_id)
|
21
|
+
response = client.make_request(:get, "#{client.concat_account_path(ENR_PATH)}/#{enr_id}")
|
22
|
+
return response[0][:emergency_notification_recipient]
|
23
|
+
end
|
24
|
+
wrap_client_arg :get_emergency_notification_recipient
|
25
|
+
|
26
|
+
def self.replace_emergency_notification_recipient(client, enr_id, data)
|
27
|
+
response = client.make_request(:put, "#{client.concat_account_path(ENR_PATH)}/#{enr_id}", {:emergency_notification_recipient => data})
|
28
|
+
return response[0][:emergency_notification_recipient]
|
29
|
+
end
|
30
|
+
wrap_client_arg :replace_emergency_notification_recipient
|
31
|
+
|
32
|
+
def self.delete_emergency_notification_recipient(client, enr_id)
|
33
|
+
client.make_request(:delete, "#{client.concat_account_path(ENR_PATH)}/#{enr_id}")
|
34
|
+
end
|
35
|
+
wrap_client_arg :delete_emergency_notification_recipient
|
36
|
+
end
|
37
|
+
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
|