ruby-bandwidth-iris 2.7.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -7
- data/lib/bandwidth-iris/client.rb +1 -20
- data/lib/bandwidth-iris/dlda.rb +1 -1
- data/lib/bandwidth-iris/version.rb +1 -1
- data/spec/bandwidth-iris/client_spec.rb +0 -35
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f848141460dbc00663529dd048bdb76e1a8e26860c18ece42b62e607ad97330
|
4
|
+
data.tar.gz: 9d7cd88f53989bc55a452eb1a14654cf4887dddc81263aaadb6da1aaaf9e3b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9a1d38bda953a82a7513bb6160c6689a2bdd893d7c04175c52c09da8baca93a8b28aa74c9541246e74e2ee212ae46cdcb8dafe936188d5baac9c7f9c7735cf
|
7
|
+
data.tar.gz: c5b16c0e5407e8f3efb7c20a87503b27fbb36b27fe68fc1cd6d7678a4614ff42cb28b8b0eca6414c974d581b9f17f1479c8a8eea336378f01be97650666f8c23
|
data/README.md
CHANGED
@@ -6,18 +6,45 @@ Ruby Client library for IRIS / BBS API
|
|
6
6
|
|
7
7
|
## Release Notes
|
8
8
|
|
9
|
-
| Release Version | Notes
|
10
|
-
|
11
|
-
| 1.0.5
|
12
|
-
| 2.0.0
|
13
|
-
| 2.0.1
|
14
|
-
| 2.1.0
|
9
|
+
| Release Version | Notes |
|
10
|
+
|--|--|
|
11
|
+
| 1.0.5 | Fixed incorrect generation of XML for a Disconnect request |
|
12
|
+
| 2.0.0 | Added `importTnOrders`, `removeImportedTnOrders`, `inserviceNumbers`, and `importTnChecker` endpoints. This release also changed the response body of `BandwidthIris::InServiceNumber.list()`. Please make sure to update your code to include this change. |
|
13
|
+
| 2.0.1 | Updated gem dependencies to be less restrictive |
|
14
|
+
| 2.1.0 | Added `csrs` endpoints |
|
15
|
+
| 2.2.0 | Added `loas` endpoints to `importTnOrders` |
|
15
16
|
| 2.2.0 | Added `loas` endpoints to `importTnOrders` |
|
16
17
|
| 2.3.0 | Added `get_tns_by_order_id` to the Orders class |
|
17
18
|
| 2.4.0.pre | Added application management and sippeer products endpoints |
|
18
19
|
| 2.5.0 | Added `get_order_response` to pull full `<OrderResponse>` object from API, added `id` back to order object on get requests. Fixed TN Reservation and updated tests to match reality |
|
19
20
|
| 2.6.0 | Added Emergency Calling Notification, Emergeny Notification Group, Emergency Notification Endpoint, and Alternate End User Identity methods |
|
20
21
|
| 2.7.0 | Added TNOptions endpoints |
|
22
|
+
| 3.0.0 | Removed functionality that causes an error to be raised when some type of `error` field is returned in the XML body response. This change reduces the situations that cause an error to be thrown to simply be 4XX and 5XX http responses. This change was made to improve communication when an error is found. Please update your code to handle this change. |
|
23
|
+
| 3.0.2 | Fixed an incorrect retrieval of DLDA objects |
|
24
|
+
|
25
|
+
### 3.x.x release
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
failed_import_tn_order = "some_id"
|
29
|
+
begin
|
30
|
+
response = BandwidthIris::ImportTnOrders.get_import_tn_order(failed_import_tn_order)
|
31
|
+
puts response[0]
|
32
|
+
rescue BandwidthIris::Errors::GenericError => e
|
33
|
+
puts e
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
#### 2.x.x result
|
38
|
+
|
39
|
+
```
|
40
|
+
Messaging route of External Third Party TNs is not configured.
|
41
|
+
```
|
42
|
+
|
43
|
+
#### 3.x.x result
|
44
|
+
|
45
|
+
```
|
46
|
+
{:customer_order_id=>"custom_id", :order_create_date=>Mon, 02 Mar 2020 20:56:48 +0000, :account_id=>123, :created_by_user=>"user", :order_id=>"0f2", :last_modified_date=>Mon, 02 Mar 2020 20:56:48 +0000, :site_id=>123, :subscriber=>{:name=>"Company INC", :service_address=>{:house_number=>123, :street_name=>"Street", :city=>"City", :state_code=>"XY", :zip=>12345, :county=>"County", :country=>"Country", :address_type=>"Service"}}, :loa_authorizing_person=>"Person", :telephone_numbers=>{:telephone_number=>"5554443333"}, :processing_status=>"FAILED", :errors=>{:error=>{:code=>19005, :description=>"Messaging route of External Third Party TNs is not configured.", :telephone_numbers=>{:telephone_number=>"5554443333"}}}, :sip_peer_id=>123}
|
47
|
+
```
|
21
48
|
|
22
49
|
## Install
|
23
50
|
|
@@ -433,6 +460,7 @@ BandwidthIris::RateCenter.list(query)
|
|
433
460
|
|
434
461
|
## SIP Peers
|
435
462
|
### Create SIP Peer
|
463
|
+
A Sip Peer is what is called Location in the web UI.
|
436
464
|
```ruby
|
437
465
|
data = {
|
438
466
|
:peer_name => "A New SIP Peer",
|
@@ -495,7 +523,7 @@ sipPeer.move_tns(numbers_to_move)
|
|
495
523
|
## Sites
|
496
524
|
|
497
525
|
### Create A Site
|
498
|
-
A site is what is called
|
526
|
+
A site is what is called Sub-Account in the web UI.
|
499
527
|
```ruby
|
500
528
|
site = {
|
501
529
|
:name =>"A new site",
|
@@ -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://dashboard.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) }
|
@@ -120,25 +120,6 @@ module BandwidthIris
|
|
120
120
|
# @param response response object
|
121
121
|
def check_response(response)
|
122
122
|
parsed_body = parse_xml(response.body || '')
|
123
|
-
code = find_first_descendant(parsed_body, :error_code)
|
124
|
-
description = find_first_descendant(parsed_body, :description)
|
125
|
-
unless code
|
126
|
-
error = find_first_descendant(parsed_body, :error)
|
127
|
-
if error
|
128
|
-
code = error[:code]
|
129
|
-
description = error[:description]
|
130
|
-
else
|
131
|
-
errors = find_first_descendant(parsed_body, :errors)
|
132
|
-
if errors == nil || errors.length == 0
|
133
|
-
code = find_first_descendant(parsed_body, :result_code)
|
134
|
-
description = find_first_descendant(parsed_body, :result_message)
|
135
|
-
else
|
136
|
-
errors = [errors] if errors.is_a?(Hash)
|
137
|
-
raise Errors::AgregateError.new(errors.map {|e| Errors::GenericError.new(e[:code], e[:description], response.status)})
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
raise Errors::GenericError.new(code, description, response.status) if code && description && code != '0' && code != 0
|
142
123
|
raise Errors::GenericError.new('', "Http code #{response.status}", response.status) if response.status >= 400
|
143
124
|
parsed_body
|
144
125
|
end
|
data/lib/bandwidth-iris/dlda.rb
CHANGED
@@ -17,7 +17,7 @@ module BandwidthIris
|
|
17
17
|
wrap_client_arg :list
|
18
18
|
|
19
19
|
def self.get(client, id)
|
20
|
-
data = client.make_request(:get, "#{client.concat_account_path(DLDA_PATH)}/#{id}")[0]
|
20
|
+
data = client.make_request(:get, "#{client.concat_account_path(DLDA_PATH)}/#{id}")[0]
|
21
21
|
data[:id] = data[:order_id]
|
22
22
|
Dlda.new(data, client)
|
23
23
|
end
|
@@ -86,41 +86,6 @@ describe BandwidthIris::Client do
|
|
86
86
|
client.stubs.get('/v1.0/path1') { |env| [400, {}, ''] }
|
87
87
|
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::GenericError, "Http code 400")
|
88
88
|
end
|
89
|
-
|
90
|
-
it 'should fail if output contains ErrorCode and Description' do
|
91
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><ErrorCode>400</ErrorCode><Description>Error</Description></Test></Response>'] }
|
92
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::GenericError, "Error")
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should fail if output contains element Error with Code and Description' do
|
96
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><Error><Code>400</Code><Description>Error</Description></Error></Test></Response>'] }
|
97
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::GenericError, "Error")
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'should fail if output contains elements Errors with Code and Description' do
|
101
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><Errors><Code>400</Code><Description>Error</Description></Errors><Errors><Code>401</Code><Description>Error1</Description></Errors></Test></Response>'] }
|
102
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::AgregateError)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'should fail if output contains elements Errors with Code and Description (for 1 element)' do
|
106
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><Errors><Code>400</Code><Description>Error</Description></Errors></Test></Response>'] }
|
107
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::AgregateError)
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'should fail if output contains elements resultCode and resultMessage' do
|
111
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><resultCode>400</resultCode><resultMessage>Error</resultMessage></Test></Response>'] }
|
112
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::GenericError, "Error")
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'should fail if output contains elements resultCode and resultMessage (more deep)' do
|
116
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Tests><Test></Test><Test><resultCode>400</resultCode><resultMessage>Error</resultMessage></Test></Tests></Response>'] }
|
117
|
-
expect{client.make_request(:get, '/path1')}.to raise_error(Errors::GenericError, "Error")
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'should not fail if resultCode == 0' do
|
121
|
-
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Response><Test><resultCode>0</resultCode><resultMessage>Completed</resultMessage></Test></Response>'] }
|
122
|
-
client.make_request(:get, '/path1')
|
123
|
-
end
|
124
89
|
end
|
125
90
|
end
|
126
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bandwidth-iris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Belchikov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: Gem for integrating to Bandwidth's Iris API
|
140
|
-
email:
|
140
|
+
email:
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
@@ -247,7 +247,7 @@ homepage: https://github.com/bandwidthcom/ruby-bandwidth-iris
|
|
247
247
|
licenses:
|
248
248
|
- MIT
|
249
249
|
metadata: {}
|
250
|
-
post_install_message:
|
250
|
+
post_install_message:
|
251
251
|
rdoc_options: []
|
252
252
|
require_paths:
|
253
253
|
- lib
|
@@ -263,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
263
|
version: '0'
|
264
264
|
requirements: []
|
265
265
|
rubygems_version: 3.0.6
|
266
|
-
signing_key:
|
266
|
+
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Gem for integrating to Bandwidth's Iris API
|
269
269
|
test_files:
|