ruby-bandwidth-iris 1.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 +7 -0
- data/.editorconfig +13 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +20 -0
- data/README.md +571 -0
- data/Rakefile +5 -0
- data/examples/account.rb +15 -0
- data/examples/available_npa_nxx.rb +17 -0
- data/examples/available_number.rb +17 -0
- data/examples/city.rb +16 -0
- data/examples/config.yml.example +4 -0
- data/examples/covered-rate-center.rb +19 -0
- data/examples/loa.pdf +0 -0
- data/examples/order.rb +51 -0
- data/examples/port-in.rb +95 -0
- data/examples/sip_peer.rb +60 -0
- data/examples/site.rb +29 -0
- data/examples/tn.rb +20 -0
- data/lib/bandwidth-iris/account.rb +10 -0
- data/lib/bandwidth-iris/api_item.rb +36 -0
- data/lib/bandwidth-iris/available_npa_nxx.rb +15 -0
- data/lib/bandwidth-iris/available_number.rb +15 -0
- data/lib/bandwidth-iris/city.rb +15 -0
- data/lib/bandwidth-iris/client.rb +232 -0
- data/lib/bandwidth-iris/client_wrapper.rb +28 -0
- data/lib/bandwidth-iris/covered_rate_center.rb +17 -0
- data/lib/bandwidth-iris/disc_number.rb +19 -0
- data/lib/bandwidth-iris/disconnect.rb +36 -0
- data/lib/bandwidth-iris/dlda.rb +39 -0
- data/lib/bandwidth-iris/errors.rb +31 -0
- data/lib/bandwidth-iris/import_to_account.rb +24 -0
- data/lib/bandwidth-iris/in_service_number.rb +24 -0
- data/lib/bandwidth-iris/lidb.rb +24 -0
- data/lib/bandwidth-iris/lnp_checker.rb +18 -0
- data/lib/bandwidth-iris/lsr_order.rb +58 -0
- data/lib/bandwidth-iris/order.rb +76 -0
- data/lib/bandwidth-iris/port_in.rb +80 -0
- data/lib/bandwidth-iris/port_out.rb +24 -0
- data/lib/bandwidth-iris/rate_center.rb +19 -0
- data/lib/bandwidth-iris/sip_peer.rb +47 -0
- data/lib/bandwidth-iris/site.rb +83 -0
- data/lib/bandwidth-iris/subscription.rb +42 -0
- data/lib/bandwidth-iris/tn.rb +41 -0
- data/lib/bandwidth-iris/tn_reservation.rb +26 -0
- data/lib/bandwidth-iris/user.rb +20 -0
- data/lib/bandwidth-iris/version.rb +4 -0
- data/lib/ruby-bandwidth-iris.rb +29 -0
- data/ruby-bandwidth-iris.gemspec +26 -0
- data/spec/bandwidth-iris/account_spec.rb +19 -0
- data/spec/bandwidth-iris/available_npa_nxx_spec.rb +22 -0
- data/spec/bandwidth-iris/available_number_spec.rb +19 -0
- data/spec/bandwidth-iris/city_spec.rb +22 -0
- data/spec/bandwidth-iris/client_spec.rb +125 -0
- data/spec/bandwidth-iris/covered_rate_center_spec.rb +22 -0
- data/spec/bandwidth-iris/disconnect_spec.rb +52 -0
- data/spec/bandwidth-iris/dlda_spec.rb +47 -0
- data/spec/bandwidth-iris/import_to_account_spec.rb +36 -0
- data/spec/bandwidth-iris/in_service_number_spec.rb +33 -0
- data/spec/bandwidth-iris/lidb_spec.rb +44 -0
- data/spec/bandwidth-iris/lnp_checker_spec.rb +24 -0
- data/spec/bandwidth-iris/lsr_order_spec.rb +96 -0
- data/spec/bandwidth-iris/order_spec.rb +124 -0
- data/spec/bandwidth-iris/port_in_spec.rb +135 -0
- data/spec/bandwidth-iris/port_out_spec.rb +36 -0
- data/spec/bandwidth-iris/rate_center_spec.rb +29 -0
- data/spec/bandwidth-iris/sip_peer_spec.rb +86 -0
- data/spec/bandwidth-iris/site_spec.rb +95 -0
- data/spec/bandwidth-iris/subscription_spec.rb +58 -0
- data/spec/bandwidth-iris/tn_reservation_spec.rb +39 -0
- data/spec/bandwidth-iris/tn_spec.rb +68 -0
- data/spec/bandwidth-iris/user_spec.rb +21 -0
- data/spec/helper.rb +75 -0
- data/spec/xml.yml +46 -0
- metadata +256 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 538d68fb402de2a2d2e6205243b35c9e234d2470
|
4
|
+
data.tar.gz: 6fa4ef1e716a3cd1cba14b08a84636225f623169
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36d2daed8eaa6e88775d8fbd2d0e1f7c5ca4c86223c8d28d903d5d425cc5bf061f4e78cc8a7de87d4060142df052c2e338a53a52574c93635c938ab46402b2d9
|
7
|
+
data.tar.gz: 833a20b387718587bf59e6c94e7c8c66fd2d8069eb57050f701a97df1e7009230bc7b2b549619560c3a6de2a6fc509bf9c500808acd28eb0cf9dd687076b60e0
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,571 @@
|
|
1
|
+
# ruby-bandwidth-iris
|
2
|
+
|
3
|
+
[](https://travis-ci.org/bandwidthcom/ruby-bandwidth-iris)
|
4
|
+
|
5
|
+
Ruby Client library for IRIS / BBS API
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
Run
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install ruby-bandwidth-iris
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'ruby-bandwidth-iris'
|
19
|
+
|
20
|
+
# Using directly
|
21
|
+
client = BandwidthIris::Client.new('accountId', 'userName', 'password')
|
22
|
+
sites = BandwidthIris::Site.list(client)
|
23
|
+
|
24
|
+
# Or you can use default client instance (do this only once)
|
25
|
+
BandwidthIris::Client.global_options = {
|
26
|
+
:account_id => 'accountId',
|
27
|
+
:username => 'userName',
|
28
|
+
:password => 'password'
|
29
|
+
}
|
30
|
+
|
31
|
+
# Now you can call any functions without first arg 'client'
|
32
|
+
|
33
|
+
sites = BandwidthIris::Site.list()
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
## Examples
|
38
|
+
There is an 'examples' folder in the source tree that shows how each of the API objects work with simple example code. To run the examples:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ cd examples
|
42
|
+
$ cp config.yml.example config.yml
|
43
|
+
```
|
44
|
+
Edit the config.yml to match your IRIS credentials and run the examples individually. e.g.
|
45
|
+
|
46
|
+
```bash
|
47
|
+
ruby covered_rate_centers.rb
|
48
|
+
```
|
49
|
+
If the examples take command line parameters, you will get the usage by just executing the individual script.
|
50
|
+
|
51
|
+
|
52
|
+
## API Objects
|
53
|
+
### General principles
|
54
|
+
When fetching objects from the API, it will always return an object that has the client
|
55
|
+
instantiated so that you can call dependent methods as well as update, delete.
|
56
|
+
|
57
|
+
Example:
|
58
|
+
```ruby
|
59
|
+
site = BandwidthIris::Site.create({siteObject})
|
60
|
+
|
61
|
+
# or
|
62
|
+
|
63
|
+
site = BandwidthIris::Site.create(client, {siteObject})
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
Each entity has a get, list, create, update and delete method if appropriate.
|
68
|
+
|
69
|
+
All properties are underscored and low-cased for Ruby readability, and are converted on the fly to the proper
|
70
|
+
case by the internals of the API when converted to XML.
|
71
|
+
|
72
|
+
## Available Numbers
|
73
|
+
|
74
|
+
```Ruby
|
75
|
+
list = BandwidthIris::AvailableNumbers.list(query)
|
76
|
+
```
|
77
|
+
|
78
|
+
## Available NpaNxx
|
79
|
+
```ruby
|
80
|
+
list = BandwidthIris::AvailableNpaNxx.list({:area_code => "818", :quantity =>5})
|
81
|
+
```
|
82
|
+
|
83
|
+
## Cities
|
84
|
+
```ruby
|
85
|
+
list = Bandwidth::City.list(:available => true, :state =>"CA"})
|
86
|
+
```
|
87
|
+
|
88
|
+
## Covered Rate Centers
|
89
|
+
```ruby
|
90
|
+
Bandwidth::CoveredRateCenter.list({:zip => "27601"})
|
91
|
+
```
|
92
|
+
|
93
|
+
## Disconnected Numbers
|
94
|
+
Retrieves a list of disconnected numbers for an account
|
95
|
+
```ruby
|
96
|
+
Bandwidth::DiscNumber.list({:area_code => "919"})
|
97
|
+
```
|
98
|
+
|
99
|
+
## Disconnect Numbers
|
100
|
+
The Disconnect object is used to disconnect numbers from an account. Creates a disconnect order that can be tracked
|
101
|
+
|
102
|
+
### Create Disconnect
|
103
|
+
```ruby
|
104
|
+
Bandwidth::Disconnect.create("Disconnect Order Name", ["9195551212", "9195551213"])
|
105
|
+
```
|
106
|
+
|
107
|
+
### Add Note to Disconnect
|
108
|
+
```ruby
|
109
|
+
order.add_note({:user_id => "my id", :description => "Test"})
|
110
|
+
```
|
111
|
+
|
112
|
+
### Get Notes for Disconnect
|
113
|
+
```ruby
|
114
|
+
order.get_notes()
|
115
|
+
```
|
116
|
+
|
117
|
+
## Dlda
|
118
|
+
|
119
|
+
### Create Ddla
|
120
|
+
```ruby
|
121
|
+
dlda = {
|
122
|
+
:customer_order_id => "Your Order Id",
|
123
|
+
:dlda_tn_groups => [
|
124
|
+
:dlda_tn_group => {
|
125
|
+
:telephone_numbers => ["9195551212"],
|
126
|
+
:subscriber_type => "RESIDENTIAL",
|
127
|
+
:listing_type => "LISTED",
|
128
|
+
:listing_name => {
|
129
|
+
:first_name => "John",
|
130
|
+
:last_name => "Smith"
|
131
|
+
},
|
132
|
+
:list_address => true,
|
133
|
+
:address => {
|
134
|
+
:house_number => "123",
|
135
|
+
:street_name => "Elm",
|
136
|
+
:street_suffix => "Ave",
|
137
|
+
:city => "Carpinteria",
|
138
|
+
:state_code => "CA",
|
139
|
+
:zip => "93013",
|
140
|
+
:address_type => "DLDA"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
]
|
144
|
+
}
|
145
|
+
|
146
|
+
Bandwidth::Dlda.create(dlda)
|
147
|
+
```
|
148
|
+
|
149
|
+
### Get Dlda
|
150
|
+
```ruby
|
151
|
+
dlda = Bandwidth::Dlda.get(id)
|
152
|
+
```
|
153
|
+
|
154
|
+
### Get Dlda History
|
155
|
+
```ruby
|
156
|
+
dlda.get_history()
|
157
|
+
```
|
158
|
+
|
159
|
+
### List Dldas
|
160
|
+
```ruby
|
161
|
+
Bandwidth::Dlda.list({:telephone_number => "9195551212"})
|
162
|
+
```
|
163
|
+
|
164
|
+
## Import To Account
|
165
|
+
This path is generally not available to Bandwidth accounts, and as such is not documented in this API
|
166
|
+
|
167
|
+
## In Service Numbers
|
168
|
+
|
169
|
+
### List InService Numbers
|
170
|
+
```ruby
|
171
|
+
Bandwidth::InServiceNumber.list({:area_code => "919"})
|
172
|
+
```
|
173
|
+
|
174
|
+
### Get InService Number Detail
|
175
|
+
```ruby
|
176
|
+
Bandwidth::InServiceNumber.get("9195551212")
|
177
|
+
```
|
178
|
+
|
179
|
+
## Lidb
|
180
|
+
|
181
|
+
### Create
|
182
|
+
```ruby
|
183
|
+
data = {
|
184
|
+
:customer_order_id => "A test order",
|
185
|
+
:lidb_tn_groups => {
|
186
|
+
:lidb_tn_group => {
|
187
|
+
:telephone_numbers => ["8048030097", "8045030098"],
|
188
|
+
:subscriber_information => "Joes Grarage",
|
189
|
+
:use_type => "RESIDENTIAL",
|
190
|
+
:visibility => "PUBLIC"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
Bandwidth::Lidbs.create(data)
|
195
|
+
```
|
196
|
+
### Get Lidb
|
197
|
+
```ruby
|
198
|
+
Bandwidth::Lidbs.get(id)
|
199
|
+
```
|
200
|
+
### List Lidbs
|
201
|
+
```ruby
|
202
|
+
Bandwidth::Lidbs.list({:telephone_number => "9195551212"})
|
203
|
+
```
|
204
|
+
|
205
|
+
## LNP Checker
|
206
|
+
### Check LNP
|
207
|
+
```ruby
|
208
|
+
numbers = ["9195551212", "9195551213"]
|
209
|
+
full_check = true
|
210
|
+
Bandwidth::LnpChecker.check(numbers, full_check)
|
211
|
+
```
|
212
|
+
|
213
|
+
## LSR Orders
|
214
|
+
### Create LSR Order
|
215
|
+
```ruby
|
216
|
+
data = {
|
217
|
+
:pon => "Some Pon",
|
218
|
+
:customer_order_id => "MyId5",
|
219
|
+
'sPID' => "123C",
|
220
|
+
:billing_telephone_number => "9192381468",
|
221
|
+
:requested_foc_date => "2015-11-15",
|
222
|
+
:authorizing_person => "Jim Hopkins",
|
223
|
+
:subscriber => {
|
224
|
+
:subscriber_type => "BUSINESS",
|
225
|
+
:business_name => "BusinessName",
|
226
|
+
:service_address => {
|
227
|
+
:house_number => "11",
|
228
|
+
:street_name => "Park",
|
229
|
+
:street_suffix => "Ave",
|
230
|
+
:city => "New York",
|
231
|
+
:state_code => "NY",
|
232
|
+
:zip => "90025"
|
233
|
+
},
|
234
|
+
:account_number => "123463",
|
235
|
+
:pin_number => "1231"
|
236
|
+
},
|
237
|
+
:list_of_telephone_numbers => {
|
238
|
+
:telephone_number => ["9192381848", "9192381467"]
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
Bandwidth::LsrOrder.create(data)
|
243
|
+
```
|
244
|
+
### Get LSR Order
|
245
|
+
```ruby
|
246
|
+
Bandwidth::LsrOrder.get(id)
|
247
|
+
```
|
248
|
+
### List LSR Orders
|
249
|
+
```ruby
|
250
|
+
Bandwidth::LsrOrder.list({:pon =>"Some Pon"})
|
251
|
+
```
|
252
|
+
### Update LSR Order
|
253
|
+
```ruby
|
254
|
+
order.requestedFocDate = "2015-11-16"
|
255
|
+
Bandwidth::LsrOrder.update(order)
|
256
|
+
```
|
257
|
+
### Get LSR Order History
|
258
|
+
```ruby
|
259
|
+
order.get_history()
|
260
|
+
```
|
261
|
+
### Get LSR Order Notes
|
262
|
+
```ruby
|
263
|
+
order.get_notes()
|
264
|
+
```
|
265
|
+
### Add LSR Order Note
|
266
|
+
```ruby
|
267
|
+
var note = {:user_id => "my id", :description => "Test"}
|
268
|
+
order.add_note(note)
|
269
|
+
```
|
270
|
+
|
271
|
+
## Orders
|
272
|
+
### Create Order
|
273
|
+
```ruby
|
274
|
+
order = {
|
275
|
+
:name => "A Test Order",
|
276
|
+
:site_id => 1111,
|
277
|
+
:existing_telephone_number_order_type => {
|
278
|
+
telephone_number_list =>
|
279
|
+
{
|
280
|
+
:telephone_number => ["9195551212"]
|
281
|
+
}
|
282
|
+
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
Bandwidth::Order.create(order)
|
287
|
+
```
|
288
|
+
### Get Order
|
289
|
+
```ruby
|
290
|
+
Bandwidth::Order.get(id)
|
291
|
+
```
|
292
|
+
### List Orders
|
293
|
+
```ruby
|
294
|
+
Bandwidth::Order.list(query)
|
295
|
+
```
|
296
|
+
### Order Instance Methods
|
297
|
+
```ruby
|
298
|
+
// get Area Codes
|
299
|
+
order.get_area_codes()
|
300
|
+
|
301
|
+
// add note to order
|
302
|
+
var note = {:user_id => "my id", :description => "Test"}
|
303
|
+
order.add_note(note)
|
304
|
+
|
305
|
+
//get Npa Nxxs
|
306
|
+
order.get_npa_nxx()
|
307
|
+
|
308
|
+
// get number totals
|
309
|
+
order.get_totals()
|
310
|
+
|
311
|
+
// get all Tns for an order
|
312
|
+
order.get_tns()
|
313
|
+
|
314
|
+
// get order history
|
315
|
+
order.get_history()
|
316
|
+
|
317
|
+
// get order notes
|
318
|
+
order.get_notes()
|
319
|
+
```
|
320
|
+
|
321
|
+
## Port Ins
|
322
|
+
### Create PortIn
|
323
|
+
```ruby
|
324
|
+
data = {
|
325
|
+
:site_id =>1234,
|
326
|
+
:peer_id => 5678,
|
327
|
+
:billing_telephone_number => "9195551212",
|
328
|
+
:subscriber => {
|
329
|
+
:subscriber_type => "BUSINESS",
|
330
|
+
:business_name => "Company",
|
331
|
+
:service_address => {
|
332
|
+
:house_number => "123",
|
333
|
+
:street_name => "EZ Street",
|
334
|
+
:city => "Raleigh",
|
335
|
+
:state_code => "NC",
|
336
|
+
:county => "Wake"
|
337
|
+
}
|
338
|
+
},
|
339
|
+
:loa_authorizing_person => "Joe Blow",
|
340
|
+
:list_of_phone_numbers => {
|
341
|
+
:phone_number => ["9195551212"]
|
342
|
+
},
|
343
|
+
:billing_type => "PORTIN"
|
344
|
+
}
|
345
|
+
|
346
|
+
Bandwidth::PortIn.create(data)
|
347
|
+
```
|
348
|
+
## Get PortIn
|
349
|
+
```ruby
|
350
|
+
Bandwidth::PortIn.get("id", callback)
|
351
|
+
```
|
352
|
+
|
353
|
+
### PortIn Instance methods
|
354
|
+
```ruby
|
355
|
+
portIn.update(data)
|
356
|
+
portIn.delete()
|
357
|
+
```
|
358
|
+
### PortIn File Management
|
359
|
+
```ruby
|
360
|
+
|
361
|
+
# Add File
|
362
|
+
portIn.create_file(IO.read("myFile.txt"))
|
363
|
+
|
364
|
+
# Update File
|
365
|
+
portIn.update_file("myFile.txt", IO.read("myFile.txt"))
|
366
|
+
|
367
|
+
# Get File
|
368
|
+
portIn.get_file("myFile.txt")
|
369
|
+
|
370
|
+
# Get File Metadata
|
371
|
+
portIn.get_file_metadata("myFile.txt")
|
372
|
+
|
373
|
+
# Get Files
|
374
|
+
portIn.get_files()
|
375
|
+
```
|
376
|
+
|
377
|
+
## Port Out
|
378
|
+
### List PortOuts
|
379
|
+
```ruby
|
380
|
+
query = {:status => "complete"}
|
381
|
+
Bandwidth::PortOut.list(query)
|
382
|
+
```
|
383
|
+
### Get PortOut
|
384
|
+
```ruby
|
385
|
+
Bandwidth::PortOut.get(id)
|
386
|
+
```
|
387
|
+
|
388
|
+
## Rate Centers
|
389
|
+
### List Ratecenters
|
390
|
+
```ruby
|
391
|
+
query = {:available => true, :state => "CA"}
|
392
|
+
Bandwidth::RateCenter.list(query)
|
393
|
+
```
|
394
|
+
|
395
|
+
## SIP Peers
|
396
|
+
### Create SIP Peer
|
397
|
+
```ruby
|
398
|
+
data = {
|
399
|
+
:peer_name => "A New SIP Peer",
|
400
|
+
:is_default_peer => false,
|
401
|
+
:short_messaging_protocol =>"SMPP",
|
402
|
+
:site_id => selectedSite,
|
403
|
+
:voice_hosts =>
|
404
|
+
{
|
405
|
+
:host => [{
|
406
|
+
:host_name => "1.1.1.1"
|
407
|
+
}]
|
408
|
+
},
|
409
|
+
:sms_hosts =>
|
410
|
+
{
|
411
|
+
:host => [{
|
412
|
+
:host_name => "1.1.1.1"
|
413
|
+
}]
|
414
|
+
},
|
415
|
+
:termination_hosts =>
|
416
|
+
{
|
417
|
+
:termination_host =>[{
|
418
|
+
:host_name => "1.1.1.1",
|
419
|
+
:port => 5060
|
420
|
+
}]
|
421
|
+
}
|
422
|
+
|
423
|
+
}
|
424
|
+
|
425
|
+
Bandwidth::SipPeer.create(data)
|
426
|
+
```
|
427
|
+
### Get SIP Peer
|
428
|
+
```ruby
|
429
|
+
Bandwidth::SipPeer.get("id")
|
430
|
+
```
|
431
|
+
### List SIP Peers
|
432
|
+
```ruby
|
433
|
+
Bandwidth::SipPeer.list(siteId)
|
434
|
+
```
|
435
|
+
### Delete SIP Peer
|
436
|
+
```ruby
|
437
|
+
sipPeer.delete()
|
438
|
+
```
|
439
|
+
### SipPeer TN Methods
|
440
|
+
```ruby
|
441
|
+
# get TN for this peer
|
442
|
+
sipPeer.get_tns(number)
|
443
|
+
|
444
|
+
# get all TNs for this peer
|
445
|
+
sipPeer.get_tns()
|
446
|
+
|
447
|
+
# Update TNs for this peer
|
448
|
+
tns = {:full_number => "123456", :rewrite_user => "test"}
|
449
|
+
sipPeer.update_tns(number, tns)
|
450
|
+
|
451
|
+
# Move Tns to new peer
|
452
|
+
numbers_to_move = ["9195551212", "9195551213"]
|
453
|
+
sipPeer.move_tns(numbers_to_move)
|
454
|
+
```
|
455
|
+
|
456
|
+
## Sites
|
457
|
+
|
458
|
+
### Create A Site
|
459
|
+
A site is what is called Location in the web UI.
|
460
|
+
```ruby
|
461
|
+
site = {
|
462
|
+
:name =>"A new site",
|
463
|
+
:description =>"A new description",
|
464
|
+
:address => {
|
465
|
+
:house_number => "123",
|
466
|
+
:street_name => "Anywhere St",
|
467
|
+
:city => "Raleigh",
|
468
|
+
:state_code =>"NC",
|
469
|
+
:zip => "27609",
|
470
|
+
:address_type => "Service"
|
471
|
+
}
|
472
|
+
};
|
473
|
+
Bandwidth::Site.create(site)
|
474
|
+
```
|
475
|
+
|
476
|
+
### Updating a Site
|
477
|
+
```ruby
|
478
|
+
site.update({:name => "New name"})
|
479
|
+
```
|
480
|
+
### Deleting a Site
|
481
|
+
```ruby
|
482
|
+
site.delete()
|
483
|
+
```
|
484
|
+
### Listing All Sites
|
485
|
+
```ruby
|
486
|
+
Bandwidth::Site.list()
|
487
|
+
```
|
488
|
+
```
|
489
|
+
### Site SipPeer Methods
|
490
|
+
```ruby
|
491
|
+
# get Sip Peers
|
492
|
+
site.get_sip_peers()
|
493
|
+
|
494
|
+
# get Sip Peer
|
495
|
+
site.get_sip_peer(id)
|
496
|
+
|
497
|
+
# create Sip Peer
|
498
|
+
sip_peer = {:name =>"SIP Peer"}
|
499
|
+
site.create_sip_peer(sipPeer)
|
500
|
+
```
|
501
|
+
|
502
|
+
## Subscriptions
|
503
|
+
### Create Subscription
|
504
|
+
```ruby
|
505
|
+
subscription = {
|
506
|
+
:order_type => "orders",
|
507
|
+
:callback_subcription => {
|
508
|
+
:url => "http://mycallbackurl.com",
|
509
|
+
:user => "userid",
|
510
|
+
:expiry => 12000
|
511
|
+
}
|
512
|
+
}
|
513
|
+
Bandwidth::Subscription.create(subscription)
|
514
|
+
```
|
515
|
+
### Get Subscription
|
516
|
+
```ruby
|
517
|
+
Bandwidth::Subscription.get(id)
|
518
|
+
```
|
519
|
+
### List Subscriptions
|
520
|
+
```ruby
|
521
|
+
Bandwidth::Subscription.list(query)
|
522
|
+
```
|
523
|
+
### Subscription Instance Methods
|
524
|
+
```ruby
|
525
|
+
# update subscription
|
526
|
+
updatedData = {:order_type => "portins"}
|
527
|
+
subscription.update(updatedData)
|
528
|
+
|
529
|
+
# delete subscription
|
530
|
+
subscription.delete()
|
531
|
+
});
|
532
|
+
```
|
533
|
+
|
534
|
+
## TNs
|
535
|
+
### Get TN
|
536
|
+
```ruby
|
537
|
+
tn = Bandwidth::Tn.get(fullNumber)
|
538
|
+
```
|
539
|
+
### List TNs
|
540
|
+
```ruby
|
541
|
+
Bandwidth::Tn.list(query)
|
542
|
+
```
|
543
|
+
### TN Instance Methods
|
544
|
+
```ruby
|
545
|
+
# Get TN Details
|
546
|
+
tn = tn.geti_tn_details()
|
547
|
+
|
548
|
+
# Get Sites
|
549
|
+
tn.get_sites()
|
550
|
+
|
551
|
+
# Get Sip Peers
|
552
|
+
tn.get_sip_peers()
|
553
|
+
|
554
|
+
# Get Rate Center
|
555
|
+
tn.get_rate_center()
|
556
|
+
|
557
|
+
```
|
558
|
+
|
559
|
+
## TN Reservation
|
560
|
+
### Create TN Reservation
|
561
|
+
```ruby
|
562
|
+
Bandwidth::TnReservation.create({:reserved_tn => "9195551212"})
|
563
|
+
```
|
564
|
+
### Get TN Reservation
|
565
|
+
```ruby
|
566
|
+
tn = Bandwidth::TnReservation.get(id)
|
567
|
+
```
|
568
|
+
### Delete TN Reservation
|
569
|
+
```ruby
|
570
|
+
tn.delete()
|
571
|
+
```
|
data/Rakefile
ADDED
data/examples/account.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'yaml'
|
5
|
+
require 'ruby-bandwidth-iris'
|
6
|
+
config = YAML.load_file('config.yml')
|
7
|
+
|
8
|
+
BandwidthIris::Client.global_options = {
|
9
|
+
:api_endpoint => config['api_endpoint'],
|
10
|
+
:user_name => config['user_name'],
|
11
|
+
:password => config['password'],
|
12
|
+
:account_id => config['account_id']
|
13
|
+
}
|
14
|
+
puts BandwidthIris::Account.get()
|
15
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'yaml'
|
5
|
+
require 'ruby-bandwidth-iris'
|
6
|
+
config = YAML.load_file('config.yml')
|
7
|
+
|
8
|
+
BandwidthIris::Client.global_options = {
|
9
|
+
:api_endpoint => config['api_endpoint'],
|
10
|
+
:user_name => config['user_name'],
|
11
|
+
:password => config['password'],
|
12
|
+
:account_id => config['account_id']
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
puts BandwidthIris::AvailableNpaNxx.list({:state => 'NC', :quantity => 3})
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'yaml'
|
5
|
+
require 'ruby-bandwidth-iris'
|
6
|
+
config = YAML.load_file('config.yml')
|
7
|
+
|
8
|
+
BandwidthIris::Client.global_options = {
|
9
|
+
:api_endpoint => config['api_endpoint'],
|
10
|
+
:user_name => config['user_name'],
|
11
|
+
:password => config['password'],
|
12
|
+
:account_id => config['account_id']
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
puts BandwidthIris::AvailableNumber.list({:state => "NC", :quantity => 3})
|
17
|
+
|