ruby-bandwidth-iris 2.7.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbe7fbc5dcefe17806397fdf31f547dca15ca31abe404cfd89916531885ca901
4
- data.tar.gz: 21618c8c74f583fab7e9ddb7c5d6d689128fbcfc853d450e215972deca18e9f3
3
+ metadata.gz: f0fc9397fe7618a3cf11f3ac0df6e8c3734ae20050eaa6387d4eec429e980c64
4
+ data.tar.gz: d1cbbf35a9815c4fafb8690d3bd4cb74f1ec8c0767af173971e748b9fc9868e7
5
5
  SHA512:
6
- metadata.gz: 1df9daf8667a8b098a0fb4fff416d9b3529364f9d7eee08c342297c2489142bc465f5efbac7d8f0e1d386c04c7e742073aeed8601314e7e1a412f8d25f3ce681
7
- data.tar.gz: 2c2359325581abc5d177334bf3e5f463973f1e2055fb3b433c8150f474fb024164b427843478910c6a019cf4d93ebfd2664b89794be647441b811d6c71fc965c
6
+ metadata.gz: c7b435165d5f807dc1f8a41f5fc7c18fd91340ebf4a6f2e7c914ea0cf5a6e1038871c9cc8f2d2e5c0f8433189950af48b02b8eb71d109bc35d53a7d6855d9934
7
+ data.tar.gz: 4b289e5077bb3b7cd12f1806cdfa541a477334d5fae1d15e3a378bb44606a3f90764596f5f767ef85a69e83d8d8a3a579cf57d52598f51d433240d36f566fbf4
data/README.md CHANGED
@@ -6,18 +6,44 @@ Ruby Client library for IRIS / BBS API
6
6
 
7
7
  ## Release Notes
8
8
 
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 |
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
+
24
+ ### 3.x.x release
25
+
26
+ ```ruby
27
+ failed_import_tn_order = "some_id"
28
+ begin
29
+ response = BandwidthIris::ImportTnOrders.get_import_tn_order(failed_import_tn_order)
30
+ puts response[0]
31
+ rescue BandwidthIris::Errors::GenericError => e
32
+ puts e
33
+ end
34
+ ```
35
+
36
+ #### 2.x.x result
37
+
38
+ ```
39
+ Messaging route of External Third Party TNs is not configured.
40
+ ```
41
+
42
+ #### 3.x.x result
43
+
44
+ ```
45
+ {: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}
46
+ ```
21
47
 
22
48
  ## Install
23
49
 
@@ -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://api.inetwork.com"
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
@@ -1,4 +1,4 @@
1
1
  module BandwidthIris
2
2
  # Version of this gem
3
- VERSION = "2.7.0"
3
+ VERSION = "3.0.1"
4
4
  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: 2.7.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Belchikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-06 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder