ruby-bandwidth-iris 1.0.1 → 1.0.2
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/.editorconfig +0 -0
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/examples/account.rb +0 -0
- data/examples/available_npa_nxx.rb +0 -0
- data/examples/available_number.rb +0 -0
- data/examples/city.rb +0 -0
- data/examples/config.yml.example +0 -0
- data/examples/covered-rate-center.rb +0 -0
- data/examples/loa.pdf +0 -0
- data/examples/order.rb +0 -0
- data/examples/port-in.rb +0 -0
- data/examples/sip_peer.rb +0 -0
- data/examples/site.rb +0 -0
- data/examples/tn.rb +0 -0
- data/lib/bandwidth-iris/account.rb +0 -0
- data/lib/bandwidth-iris/api_item.rb +0 -0
- data/lib/bandwidth-iris/available_npa_nxx.rb +0 -0
- data/lib/bandwidth-iris/available_number.rb +0 -0
- data/lib/bandwidth-iris/city.rb +0 -0
- data/lib/bandwidth-iris/client.rb +27 -4
- data/lib/bandwidth-iris/client_wrapper.rb +0 -0
- data/lib/bandwidth-iris/covered_rate_center.rb +0 -0
- data/lib/bandwidth-iris/disc_number.rb +0 -0
- data/lib/bandwidth-iris/disconnect.rb +0 -0
- data/lib/bandwidth-iris/dlda.rb +0 -0
- data/lib/bandwidth-iris/errors.rb +0 -0
- data/lib/bandwidth-iris/import_to_account.rb +0 -0
- data/lib/bandwidth-iris/in_service_number.rb +0 -0
- data/lib/bandwidth-iris/lidb.rb +0 -0
- data/lib/bandwidth-iris/lnp_checker.rb +2 -1
- data/lib/bandwidth-iris/lsr_order.rb +0 -0
- data/lib/bandwidth-iris/order.rb +0 -0
- data/lib/bandwidth-iris/port_in.rb +0 -0
- data/lib/bandwidth-iris/port_out.rb +0 -0
- data/lib/bandwidth-iris/rate_center.rb +0 -0
- data/lib/bandwidth-iris/sip_peer.rb +0 -0
- data/lib/bandwidth-iris/site.rb +0 -0
- data/lib/bandwidth-iris/subscription.rb +0 -0
- data/lib/bandwidth-iris/tn.rb +0 -0
- data/lib/bandwidth-iris/tn_reservation.rb +0 -0
- data/lib/bandwidth-iris/user.rb +0 -0
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +0 -0
- data/ruby-bandwidth-iris.gemspec +0 -0
- data/spec/bandwidth-iris/account_spec.rb +0 -0
- data/spec/bandwidth-iris/available_npa_nxx_spec.rb +0 -0
- data/spec/bandwidth-iris/available_number_spec.rb +0 -0
- data/spec/bandwidth-iris/city_spec.rb +0 -0
- data/spec/bandwidth-iris/client_spec.rb +14 -0
- data/spec/bandwidth-iris/covered_rate_center_spec.rb +0 -0
- data/spec/bandwidth-iris/disc_number_spec.rb +0 -0
- data/spec/bandwidth-iris/disconnect_spec.rb +0 -0
- data/spec/bandwidth-iris/dlda_spec.rb +0 -0
- data/spec/bandwidth-iris/import_to_account_spec.rb +0 -0
- data/spec/bandwidth-iris/in_service_number_spec.rb +0 -0
- data/spec/bandwidth-iris/lidb_spec.rb +0 -0
- data/spec/bandwidth-iris/lnp_checker_spec.rb +10 -0
- data/spec/bandwidth-iris/lsr_order_spec.rb +0 -0
- data/spec/bandwidth-iris/order_spec.rb +0 -0
- data/spec/bandwidth-iris/port_in_spec.rb +0 -0
- data/spec/bandwidth-iris/port_out_spec.rb +0 -0
- data/spec/bandwidth-iris/rate_center_spec.rb +0 -0
- data/spec/bandwidth-iris/sip_peer_spec.rb +0 -0
- data/spec/bandwidth-iris/site_spec.rb +0 -0
- data/spec/bandwidth-iris/subscription_spec.rb +0 -0
- data/spec/bandwidth-iris/tn_reservation_spec.rb +0 -0
- data/spec/bandwidth-iris/tn_spec.rb +0 -0
- data/spec/bandwidth-iris/user_spec.rb +0 -0
- data/spec/helper.rb +0 -0
- data/spec/xml.yml +0 -0
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c07a2a93d28a4b21c5c1fac4c2d3fb6d70e9a14
|
|
4
|
+
data.tar.gz: 53ed1ef78f197603c74524930b4d2a4182f98909
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aaf2f58842efa4971157bf3f2528a267e2c33ea9f83eeabb35608ba4b077bb662d671936ceebdc1b285d76c4c15de4c9277b6410cd0d061c0838ce74df107d02
|
|
7
|
+
data.tar.gz: 0b39fcf710b427c0b5e8dc62efcda645f54fe98c2e4707c254a9034848b9f98d55d0f3790633fe107dfa9917590cb8202221f0a65dc57434c9168eb6828a973c
|
data/.editorconfig
CHANGED
|
File without changes
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rspec
CHANGED
|
File without changes
|
data/.travis.yml
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
File without changes
|
data/Rakefile
CHANGED
|
File without changes
|
data/examples/account.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/examples/city.rb
CHANGED
|
File without changes
|
data/examples/config.yml.example
CHANGED
|
File without changes
|
|
File without changes
|
data/examples/loa.pdf
CHANGED
|
File without changes
|
data/examples/order.rb
CHANGED
|
File without changes
|
data/examples/port-in.rb
CHANGED
|
File without changes
|
data/examples/sip_peer.rb
CHANGED
|
File without changes
|
data/examples/site.rb
CHANGED
|
File without changes
|
data/examples/tn.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/city.rb
CHANGED
|
File without changes
|
|
@@ -120,7 +120,7 @@ module BandwidthIris
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def build_xml(data)
|
|
123
|
-
doc = build_doc(data)
|
|
123
|
+
doc = build_doc(data, data.keys.first.to_s().camelcase(:upper))
|
|
124
124
|
doc.values.first.to_xml({:root => doc.keys.first, :skip_types => true, :indent => 0 })
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -163,15 +163,19 @@ module BandwidthIris
|
|
|
163
163
|
process_parsed_doc(doc.values.first)
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
def build_doc(v)
|
|
166
|
+
def build_doc(v, name)
|
|
167
167
|
case
|
|
168
168
|
when v.is_a?(Array)
|
|
169
|
-
v.map {|i| build_doc(i)}
|
|
169
|
+
list = v.map {|i| build_doc(i, name)}
|
|
170
|
+
list.extend(XmlArraySerializer)
|
|
171
|
+
list.element_name = name
|
|
172
|
+
list
|
|
170
173
|
when v.is_a?(Hash)
|
|
171
174
|
result = {}
|
|
172
175
|
v.each do |k, val|
|
|
173
176
|
if k[0] != '_'
|
|
174
|
-
|
|
177
|
+
element_name = v["_#{k}XmlElement"] || (k.to_s().camelcase(:upper))
|
|
178
|
+
result[element_name] = build_doc(val, element_name)
|
|
175
179
|
end
|
|
176
180
|
end
|
|
177
181
|
result
|
|
@@ -229,4 +233,23 @@ module BandwidthIris
|
|
|
229
233
|
result
|
|
230
234
|
end
|
|
231
235
|
end
|
|
236
|
+
|
|
237
|
+
module XmlArraySerializer
|
|
238
|
+
def element_name=(name)
|
|
239
|
+
@element_name = name
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def to_xml(options = {})
|
|
243
|
+
builder = options[:builder]
|
|
244
|
+
self.map do |item|
|
|
245
|
+
if item.class.method_defined?(:to_xml)
|
|
246
|
+
builder << item.to_xml({skip_instruct: true, root: @element_name, skip_types: true, indent:0})
|
|
247
|
+
else
|
|
248
|
+
builder << "<#{@element_name}>#{item}</#{@element_name}>"
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
builder
|
|
252
|
+
end
|
|
253
|
+
end
|
|
232
254
|
end
|
|
255
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/dlda.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/lidb.rb
CHANGED
|
File without changes
|
|
@@ -5,9 +5,10 @@ module BandwidthIris
|
|
|
5
5
|
extend ClientWrapper
|
|
6
6
|
|
|
7
7
|
def self.check(client, numbers, full_check = false)
|
|
8
|
+
list = if numbers.is_a?(Array) then numbers else [numbers] end
|
|
8
9
|
data = {
|
|
9
10
|
:number_portability_request => {
|
|
10
|
-
:tn_list => {:tn =>
|
|
11
|
+
:tn_list => {:tn => list}
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
client.make_request(:post, "#{client.concat_account_path(LNP_CHECKER_PATH)}?fullCheck=#{full_check}", data)[0]
|
|
File without changes
|
data/lib/bandwidth-iris/order.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/site.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/tn.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/bandwidth-iris/user.rb
CHANGED
|
File without changes
|
data/lib/ruby-bandwidth-iris.rb
CHANGED
|
File without changes
|
data/ruby-bandwidth-iris.gemspec
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -123,3 +123,17 @@ describe BandwidthIris::Client do
|
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
|
+
|
|
127
|
+
describe '#build_xml' do
|
|
128
|
+
client = nil
|
|
129
|
+
before :each do
|
|
130
|
+
client = Helper.get_client()
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'should generate valid XML' do
|
|
134
|
+
expect(client.build_xml({root: {item: {value: '123'}}})).to eql('<?xml version="1.0" encoding="UTF-8"?><Root><Item><Value>123</Value></Item></Root>')
|
|
135
|
+
expect(client.build_xml({root: {item: [1,2,3]}})).to eql('<?xml version="1.0" encoding="UTF-8"?><Root><Item>1</Item><Item>2</Item><Item>3</Item></Root>')
|
|
136
|
+
expect(client.build_xml({root: {item: [{value: '111'}, {value: '222'}]}})).to eql('<?xml version="1.0" encoding="UTF-8"?><Root><Item><Value>111</Value></Item><Item><Value>222</Value></Item></Root>')
|
|
137
|
+
expect(client.build_xml({root: {item: [{value: [1,2,3]}, {value: '222'}]}})).to eql('<?xml version="1.0" encoding="UTF-8"?><Root><Item><Value>1</Value><Value>2</Value><Value>3</Value></Item><Item><Value>222</Value></Item></Root>')
|
|
138
|
+
end
|
|
139
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -19,6 +19,16 @@ describe BandwidthIris::LnpChecker do
|
|
|
19
19
|
expect(result[:supported_rate_centers][:rate_center_group][:city]).to eql("City1")
|
|
20
20
|
expect(result[:supported_rate_centers][:rate_center_group][:state]).to eql("State1")
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
it 'should allow to use 1 number as string' do
|
|
24
|
+
number = '1111'
|
|
25
|
+
data = {:number_portability_request => {:tn_list => {:tn => number}}}
|
|
26
|
+
client.stubs.post('/v1.0/accounts/accountId/lnpchecker?fullCheck=true', client.build_xml(data)) {|env| [200, {}, Helper.xml['lnp_check']]}
|
|
27
|
+
result = LnpChecker.check(client, number, true)
|
|
28
|
+
expect(result[:supported_rate_centers][:rate_center_group][:rate_center]).to eql("Center1")
|
|
29
|
+
expect(result[:supported_rate_centers][:rate_center_group][:city]).to eql("City1")
|
|
30
|
+
expect(result[:supported_rate_centers][:rate_center_group][:state]).to eql("State1")
|
|
31
|
+
end
|
|
22
32
|
end
|
|
23
33
|
|
|
24
34
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/helper.rb
CHANGED
|
File without changes
|
data/spec/xml.yml
CHANGED
|
File without changes
|
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: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrey Belchikov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
224
224
|
version: '0'
|
|
225
225
|
requirements: []
|
|
226
226
|
rubyforge_project:
|
|
227
|
-
rubygems_version: 2.
|
|
227
|
+
rubygems_version: 2.6.4
|
|
228
228
|
signing_key:
|
|
229
229
|
specification_version: 4
|
|
230
230
|
summary: Gem for integrating to Bandwidth's Iris API
|
|
@@ -255,4 +255,3 @@ test_files:
|
|
|
255
255
|
- spec/bandwidth-iris/user_spec.rb
|
|
256
256
|
- spec/helper.rb
|
|
257
257
|
- spec/xml.yml
|
|
258
|
-
has_rdoc:
|