├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── config.yml
└── workflows
│ └── test.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── composer.phar
├── core
└── Client.php
├── examples
├── NpaNxx-search-sample.php
├── availableNumbers-sample.php
├── cities-sample.php
├── composer.json
├── config.php.example
├── coveredRate-sample.php
├── loa.pdf
├── order-create-sample.php
├── order-get-sample.php
├── portin-sample.php
├── rateCenter-sample.php
├── sippeers-create-sample.php
├── site-create-sample.php
├── tns-details-sample.php
└── tns-list-sample.php
├── phpunit.xml
├── src
├── Account.php
├── AddressModel.php
├── BaseModel.php
├── BillingReports.php
├── CityModel.php
├── CoveredRateCenter.php
├── DisconnectsModel.php
├── DldaModel.php
├── HostsModel.php
├── LidbModel.php
├── LsrorderModel.php
├── NotesModel.php
├── Order.php
├── PortinsModel.php
├── PortoutModel.php
├── RateCenter.php
├── ReportsInstanceModel.php
├── ReportsModel.php
├── RestEntry.php
├── Sippeers.php
├── Sites.php
├── SubscriptionsModel.php
├── Suggestions.php
├── TnOptionModel.php
├── Tns.php
├── TnsReservationModel.php
├── UserModel.php
├── ValidateException.php
└── simpleModels
│ ├── A2pSettings.php
│ ├── ActivationStatus.php
│ ├── AvailableNpaNxx.php
│ ├── BasicAuthentication.php
│ ├── Bdr.php
│ ├── BdrCreationResponse.php
│ ├── CallbackCredentials.php
│ ├── CallbackSubscription.php
│ ├── Cities.php
│ ├── Csr.php
│ ├── CsrData.php
│ ├── CsrNote.php
│ ├── CsrNotesList.php
│ ├── CsrResponse.php
│ ├── DateRange.php
│ ├── DldaOrder.php
│ ├── EmailSubscription.php
│ ├── Error.php
│ ├── Features.php
│ ├── FileListResponse.php
│ ├── FileMetaData.php
│ ├── History.php
│ ├── ImportTnCheckerPayload.php
│ ├── ImportTnCheckerResponse.php
│ ├── ImportTnError.php
│ ├── ImportTnErrors.php
│ ├── ImportTnOrder.php
│ ├── ImportTnOrderResponse.php
│ ├── InserviceTns.php
│ ├── LcaSearch.php
│ ├── LidbTnGroups.php
│ ├── LineOptionOrders.php
│ ├── Links.php
│ ├── MessageSettings.php
│ ├── NpaNxxXs.php
│ ├── NumberPortabilityRequest.php
│ ├── NumberPortabilityResponse.php
│ ├── OrderHistoryResponse.php
│ ├── OrderRequest.php
│ ├── OrderResponse.php
│ ├── OriginationRoutePlan.php
│ ├── Phones.php
│ ├── RemoveImportedTnOrder.php
│ ├── RemoveImportedTnOrderResponse.php
│ ├── RemoveImportedTnOrderSummary.php
│ ├── RemoveImportedTnOrderSummaryResponse.php
│ ├── Roles.php
│ ├── Route.php
│ ├── SearchOrderType.php
│ ├── ServiceAddress.php
│ ├── SipPeerTelephoneNumber.php
│ ├── Status.php
│ ├── Subscriber.php
│ ├── TelephoneNumberDetail.php
│ ├── TelephoneNumberList.php
│ ├── Tiers.php
│ ├── TnAttributes.php
│ ├── TnList.php
│ ├── TnOptionGroups.php
│ ├── WirelessInfo.php
│ └── ZipCodes.php
└── tests
├── AccountTest.php
├── BadCredsTest.php
├── BaseModelTest.php
├── CoveredRateCentersTest.php
├── DisconnectsTest.php
├── DldaTest.php
├── LidbsTest.php
├── NotesReferencesTest.php
├── NotesTest.php
├── OrderTest.php
├── OtherTest.php
├── PortinsTest.php
├── PortoutsTest.php
├── ReportsTest.php
├── SippeersTest.php
├── SiteTest.php
├── SubscriptionsNew.php
├── SubscriptionsTest.php
├── TnsTest.php
├── UsersTest.php
├── fixtures
└── loa_test.txt
└── lib
├── CheckBody.php
└── Client.php
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Global rule:
2 | * @Bandwidth/band-swi @Bandwidth/band-swi-github-repo-admin @Bandwidth/band-programmable-voice-swi @Bandwidth/band-devx
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug Report
3 | about: Create a bug report.
4 | title: '[BUG] Description'
5 | labels: 'bug'
6 | ---
7 |
8 | ### Checklist
9 | - [ ] Have you provided a description of the bug?
10 | - [ ] Have you provided your Environment information?
11 | - [ ] Have you provided a sample code snippet?
12 | - [ ] Have you provided a stack trace?
13 | - [ ] Have you outlined the expected behavior?
14 |
15 | ### Description
16 |
17 |
18 | ### Environment Information
19 |
20 | - OS Version: _(e.g. Windows 10)_
21 | - SDK Version: _(e.g. 1.1.0)_
22 | - Environment: _(e.g. PHP 8.1)_
23 |
24 | ### Sample Code Snippet
25 |
26 | ```php
27 | // Sample Code Snippet
28 | ```
29 |
30 | ### Stack Trace
31 |
32 | ```shell
33 | # Stack Trace
34 | ```
35 |
36 | ### Expected Behavior
37 |
38 |
39 | ### Suggested Fix
40 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Bandwidth Support
4 | url: https://www.bandwidth.com/support/
5 | about: Current customers can create tickets for our Support Team here.
6 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: Test
2 |
3 | on:
4 | schedule:
5 | - cron: "0 4 * * *"
6 | pull_request:
7 | workflow_dispatch:
8 |
9 | concurrency:
10 | group: ${{ github.workflow }}-${{ github.head_ref }}
11 | cancel-in-progress: true
12 |
13 | jobs:
14 | test:
15 | name: Test
16 | runs-on: ${{ matrix.os }}
17 | strategy:
18 | matrix:
19 | os: [ windows-2019, windows-2022, ubuntu-22.04, ubuntu-24.04 ]
20 | php-version: [8.0, 8.1, 8.2, 8.3]
21 | steps:
22 | - name: Checkout
23 | uses: actions/checkout@v4
24 |
25 | - name: Setup PHP
26 | uses: shivammathur/setup-php@v2
27 | with:
28 | php-version: ${{ matrix.php-version }}
29 |
30 | - name: Install Packages
31 | run: composer install
32 |
33 | - name: Test
34 | run: ./vendor/bin/phpunit tests
35 |
36 | - uses: Bandwidth/build-notify-slack-action@v2
37 | if: failure() && !github.event.pull_request.draft
38 | with:
39 | job-status: ${{ job.status }}
40 | slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
41 | slack-channel: ${{ secrets.SLACK_CHANNEL }}
42 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | vendor/
3 | selftests/
4 | config.php
5 | /bin
6 | composer.lock
7 | .idea/
8 | .DS_Store
9 | .phpunit.result.cache
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: trusty
2 | language: php
3 | php:
4 | - '7.2'
5 | - '7.3'
6 | install: composer install
7 | script: php ./bin/phpunit --bootstrap ./vendor/autoload.php --testdox --colors=always tests
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Bandwidth
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bandwidth/iris",
3 | "type": "library",
4 | "description": "Bandwidth's Iris SDK for PHP",
5 | "keywords": ["iris","sdk","php"],
6 | "homepage": "http://dev.bandwidth.com",
7 | "reference": "v3.4.0",
8 | "license": "MIT",
9 | "authors": [
10 | ],
11 | "require": {
12 | "php": ">=7.2",
13 | "guzzlehttp/guzzle": "~7.0"
14 | },
15 | "require-dev": {
16 | "phpunit/phpunit": "^9"
17 | },
18 | "autoload": {
19 | "psr-4": {
20 | "BandwidthLib\\": "src/"
21 | },
22 | "classmap": [
23 | "src/",
24 | "core/"
25 | ]
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/composer.phar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bandwidth/php-bandwidth-iris/0fb347dc7f9b9a667d51f7e18823e3f4aecd0f7d/composer.phar
--------------------------------------------------------------------------------
/examples/NpaNxx-search-sample.php:
--------------------------------------------------------------------------------
1 | availableNpaNxx(["areaCode" => $argv[1], "quantity" => $argv[2]]));
14 |
--------------------------------------------------------------------------------
/examples/availableNumbers-sample.php:
--------------------------------------------------------------------------------
1 | availableNumbers(["state" => $argv[1], "quantity" => $argv[2]]));
14 |
--------------------------------------------------------------------------------
/examples/cities-sample.php:
--------------------------------------------------------------------------------
1 | getList(["state" => $argv[1]]));
15 |
--------------------------------------------------------------------------------
/examples/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bandwidth/iris-php-examples",
3 | "authors": [
4 | {
5 | "name": "Ivan Selchenkov",
6 | "email": "ivan.selchenkov@ontarget-group.com"
7 | }
8 | ],
9 | "require": {
10 | "bandwidth-temp/iris": "0.0.9"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/examples/config.php.example:
--------------------------------------------------------------------------------
1 | getList(["zip" => $argv[1], "page" => "1", "size" => "30"]));
14 |
--------------------------------------------------------------------------------
/examples/loa.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bandwidth/php-bandwidth-iris/0fb347dc7f9b9a667d51f7e18823e3f4aecd0f7d/examples/loa.pdf
--------------------------------------------------------------------------------
/examples/order-create-sample.php:
--------------------------------------------------------------------------------
1 | orders()->create([
15 | "Name" => "Available Telephone Number order",
16 | "SiteId" => "2297",
17 | "CustomerOrderId" => "123456789",
18 | "ExistingTelephoneNumberOrderType" => [
19 | "TelephoneNumberList" => [
20 | "TelephoneNumber" => [ $argv[1] ]
21 | ]
22 | ]
23 | ]);
24 |
25 | echo json_encode($order->to_array());
26 |
--------------------------------------------------------------------------------
/examples/order-get-sample.php:
--------------------------------------------------------------------------------
1 | orders()->order($argv[1]);
15 |
16 | echo json_encode($order->to_array());
17 |
--------------------------------------------------------------------------------
/examples/portin-sample.php:
--------------------------------------------------------------------------------
1 | lnpChecker([ $number ], "true");
21 |
22 | if($res->PortableNumbers->Tn == $number) {
23 | echo "Your number is portable. Creating PortIn Order";
24 |
25 | $portin = $account->portins()->create(array(
26 | "BillingTelephoneNumber" => $number,
27 | "Subscriber" => array(
28 | "SubscriberType" => "BUSINESS",
29 | "BusinessName" => "Acme Corporation",
30 | "ServiceAddress" => array(
31 | "HouseNumber" => "1623",
32 | "StreetName" => "Brockton Ave",
33 | "City" => "Los Angeles",
34 | "StateCode" => "CA",
35 | "Zip" => "90025",
36 | "Country" => "USA"
37 | )
38 | ),
39 | "LoaAuthorizingPerson" => "John Doe",
40 | "ListOfPhoneNumbers" => array(
41 | "PhoneNumber" => [ $number ]
42 | ),
43 | "SiteId" => CONFIG::SITE,
44 | "Triggered" => "false"
45 | ));
46 |
47 | $filename = $portin->loas_send(__DIR__."/loa.pdf", array("Content-Type" => "application/pdf"));
48 |
49 | echo "\nSuccessfully uploaded LOA: ";
50 | echo $filename;
51 |
52 | $portin->loas_update(__DIR__."/loa.pdf", $filename, array("Content-Type" => "application/pdf"));
53 |
54 | echo "Successfully updated";
55 | }
56 |
--------------------------------------------------------------------------------
/examples/rateCenter-sample.php:
--------------------------------------------------------------------------------
1 | getList(["state" =>$argv[1]]));
15 |
--------------------------------------------------------------------------------
/examples/sippeers-create-sample.php:
--------------------------------------------------------------------------------
1 | sites()->site(Config::SITE)->sippeers()->create(array(
22 | "PeerName" => $name,
23 | "IsDefaultPeer" => true,
24 | "ShortMessagingProtocol" => "SMPP",
25 | "VoiceHosts" => array(
26 | "Host" => array(
27 | "HostName" => $host
28 | )
29 | ),
30 | "SmsHosts" => array(
31 | "Host" => array(
32 | "HostName" => $host
33 | )
34 | ),
35 | "TerminationHosts" => array(
36 | "TerminationHost" => array(
37 | "HostName" => $host,
38 | "Port" => 0,
39 | "CustomerTrafficAllowed" => "DOMESTIC",
40 | "DataAllowed" => true
41 | )
42 | )
43 | ));
44 |
45 | echo json_encode($sippeer->to_array());
46 |
--------------------------------------------------------------------------------
/examples/site-create-sample.php:
--------------------------------------------------------------------------------
1 | sites()->create(
18 | array("Name" => $name,
19 | "Address" => array(
20 | "City" => "Raleigh",
21 | "AddressType" => "Service",
22 | "HouseNumber" => "1",
23 | "StreetName" => "Avenue",
24 | "StateCode" => "NC"
25 | )));
26 |
27 | echo json_encode($site->to_array());
28 | echo "\n";
29 |
30 | $site->Address->HouseNumber = "12";
31 |
32 | $site->update();
33 |
34 | echo json_encode($account->sites()->site($site->Id)->to_array());
35 |
--------------------------------------------------------------------------------
/examples/tns-details-sample.php:
--------------------------------------------------------------------------------
1 | tn($tnarg);
18 | $tn->tndetails();
19 |
20 | echo json_encode($tn->to_array());
21 |
--------------------------------------------------------------------------------
/examples/tns-list-sample.php:
--------------------------------------------------------------------------------
1 | getList(["page" => 1, "size" => 10, "npa" => $argv[1] ]);
16 |
17 | echo json_encode($list);
18 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 | ./tests
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/AddressModel.php:
--------------------------------------------------------------------------------
1 | array(
13 | "type" => "string",
14 | "required" => true,
15 | "validate" => array(
16 | "type" => "in_array",
17 | "value" => array(
18 | "Service",
19 | "Billing",
20 | "Dlda"
21 | )
22 | )
23 | ),
24 | "City" => array("type" => "string", "required" => true),
25 | "HouseNumber" => array("type" => "string", "required" => true),
26 | "StreetName" => array("type" => "string", "required" => true),
27 | "StateCode" => array("type" => "string", "required" => true),
28 | "Zip" => array("type" => "string", "required" => true)
29 | );
30 |
31 | public function __construct($data) {
32 | $this->set_data($data);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/BaseModel.php:
--------------------------------------------------------------------------------
1 | key = $key;
10 | parent::__construct("Field {$this->key} is required.");
11 | }
12 | }
13 |
14 |
15 | #[AllowDynamicProperties]
16 | class FieldValidateInArrayException extends \Exception {
17 | public function __construct($key, $arr) {
18 | $this->key = $key;
19 | $this->arr = $arr;
20 | parent::__construct("Field {$this->key} should have one of the following values: ".implode(", ", $this->arr));
21 | }
22 | }
23 |
24 |
25 | #[AllowDynamicProperties]
26 | class FieldNotExistsException extends \Exception {
27 | public function __construct($key) {
28 | $this->key = $key;
29 | parent::__construct("Field {$this->key} not exists");
30 | }
31 | }
32 |
33 | trait BaseModel {
34 |
35 | // private $dataset = array();
36 | //
37 | // public function __get($key) {
38 | // if(!array_key_exists($key, $this->fields))
39 | // return $this->{$key};
40 | // if(isset($this->dataset[$key]))
41 | // return $this->dataset[$key];
42 | // else
43 | // return null;
44 | // }
45 | //
46 | // public function __set($key, $value) {
47 | // if(!array_key_exists($key, $this->fields)) {
48 | // $this->{$key} = $value;
49 | // } else if($this->fields[$key]["type"] == "string") {
50 | // $this->dataset[$key] = $value;
51 | // } else if(!isset($this->dataset[$key])) {
52 | // $this->dataset[$key] = $value;
53 | // } else {
54 | // $this->dataset[$key]->set_data($value);
55 | // }
56 | // }
57 |
58 | public function set_data($data) {
59 | if(!is_array($data)) {
60 | return;
61 | }
62 |
63 | foreach($data as $key => $value) {
64 | if(!array_key_exists($key, $this->fields))
65 | continue;
66 |
67 | $classname = $this->fields[$key]["type"];
68 |
69 | if($classname === "string") {
70 | $this->{$key} = $value;
71 | } else {
72 | if(is_array($value) && $this->is_assoc($value)) { // if assoc array => to object
73 | if(!property_exists($this, $key)) // if not exists create new class
74 | $this->{$key} = new $classname($value);
75 | else if(is_callable(array($this->{$key}, 'set_data'))) // or update existing class
76 | $this->{$key}->set_data($value);
77 | } else if(is_array($value)) { // if array[] => array of objects
78 | if(!property_exists($this, $key)) // create an array if not exists
79 | $this->{$key} = [];
80 |
81 | $field = & $this->{$key};
82 | $count = count($field);
83 |
84 | for($i = 0; $i < count($value); $i++) {
85 | $item = $value[$i];
86 |
87 | if($i < $count) {
88 | $field[$i]->set_data($item); // update existing objects
89 | } else {
90 | $field[] = new $classname($item); // create new objects if not exists
91 | }
92 | }
93 |
94 | if($count > count($value)) {
95 | for($i = count($value); $i < $count; $i++) {
96 | unset($field[$i]);
97 | }
98 | }
99 | }
100 | }
101 | }
102 | }
103 | protected function is_assoc($array) {
104 | $array = array_keys($array); return ($array !== array_keys($array));
105 | }
106 |
107 | public function validate($key, $value, $validate) {
108 | switch($validate['type']) {
109 | case "in_array":
110 | if(!in_array($value, $validate['value']))
111 | throw new FieldValidateInArrayException($key, $validate['value']);
112 | break;
113 | }
114 | }
115 |
116 | public function to_array() {
117 | $out = array();
118 |
119 | foreach($this->fields as $key => $rules) {
120 | if(isset($this->{$key})) {
121 | $value = $this->{$key};
122 |
123 | if($rules['type'] === "string")
124 | $out[$key] = $value;
125 | else {
126 | if(is_array($value)) {
127 | $out[$key] = [];
128 | foreach($value as $item) {
129 | $out[$key][] = $item->to_array();
130 | }
131 | } else {
132 | $out[$key] = $value->to_array();
133 | }
134 | }
135 | }
136 | else if(isset($rules['required']) && $rules['required'] === true) {
137 | throw new FieldRequiredException($key);
138 | }
139 |
140 | if(isset($rules['validate'])) {
141 | $this->validate($key, $value, $rules['validate']);
142 | }
143 | }
144 |
145 | return $out;
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/BillingReports.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
18 | parent::_init(
19 | $this->parent->get_rest_client(),
20 | $this->parent->get_relative_namespace()
21 | );
22 | }
23 |
24 | public function getList($filters = [])
25 | {
26 | $billingReports = [];
27 |
28 | $data = parent::_get('billingreports');
29 |
30 | if (!(isset($data['BillingReportList']['BillingReport']) && is_array($data['BillingReportList']['BillingReport'])))
31 | {
32 | return $billingReports;
33 | }
34 |
35 | foreach ($data['BillingReportList']['BillingReport'] as $item)
36 | {
37 | if (isset($item['BillingReportId']))
38 | {
39 | $item['Id'] = $item['BillingReportId'];
40 | unset($item['BillingReportId']);
41 | }
42 | if (isset($item['BillingReportKind']))
43 | {
44 | $item['Type'] = $item['BillingReportKind'];
45 | unset($item['BillingReportKind']);
46 | }
47 | $billingReports[] = new BillingReport($this, $item);
48 | }
49 |
50 | return $billingReports;
51 | }
52 |
53 | public function billingreport($id)
54 | {
55 | $billingReport = new BillingReport($this, ["Id" => $id]);
56 | $billingReport->get();
57 |
58 | return $billingReport;
59 | }
60 |
61 | public function get_appendix()
62 | {
63 | return '/billingreports';
64 | }
65 |
66 | public function request($data)
67 | {
68 | $billingReport = new BillingReport($this, $data);
69 |
70 | return $billingReport->save();
71 | }
72 | }
73 |
74 | #[AllowDynamicProperties]
75 | class BillingReport extends RestEntry
76 | {
77 | use BaseModel;
78 |
79 | protected $fields = array(
80 | "Id" => array("type" => "string"),
81 | "UserId" => array("type" => "string"),
82 | "Type" => array("type" => "string"),
83 | "DateRange" => array("type" => "\Iris\DateRange"),
84 | "ReportStatus" => array("type" => "string"),
85 | "CreatedDate" => array("type" => "string"),
86 | "Description" => array("type" => "string"),
87 | );
88 |
89 | public function __construct($parent, $data)
90 | {
91 | $this->set_data($data);
92 | $this->parent = $parent;
93 | parent::_init(
94 | $parent->get_rest_client(),
95 | $parent->get_relative_namespace()
96 | );
97 | }
98 |
99 | public function get()
100 | {
101 | $data = parent::_get($this->get_id());
102 | $this->set_data($data);
103 | }
104 |
105 | public function get_id()
106 | {
107 | if (!isset($this->Id))
108 | {
109 | throw new \Exception('Id should be provided');
110 | }
111 |
112 | return $this->Id;
113 | }
114 |
115 | public function save()
116 | {
117 | $header = parent::post(null, "BillingReport", $this->to_array());
118 |
119 | if (!isset($header['Location']))
120 | {
121 | return $this;
122 | }
123 |
124 | $splitted = explode("/", $header['Location']);
125 | $this->Id = end($splitted);
126 |
127 | return $this;
128 | }
129 |
130 | /**
131 | * Download zip report file
132 | *
133 | * @return mixed
134 | * @throws \Exception
135 | */
136 | public function file($options = [])
137 | {
138 | if (!isset($this->ReportStatus) || $this->ReportStatus !== 'COMPLETED')
139 | {
140 | return false;
141 | }
142 |
143 | $url = sprintf('%s/%s', $this->get_id(), 'file');
144 | $url = parent::get_url($url);
145 |
146 | return $this->client->get($url, $options);
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/src/CityModel.php:
--------------------------------------------------------------------------------
1 | client = $client;
12 | parent::_init($client, '');
13 | }
14 |
15 | public function getList($filters = Array()) {
16 | $cities = [];
17 | $data = parent::_get('cities', $filters, Array(), Array("state"));
18 |
19 | if($data['Cities']) {
20 | $items = $data['Cities']['City'];
21 |
22 | if($this->is_assoc($items))
23 | $items = [ $items ];
24 |
25 | foreach($items as $city) {
26 | $cities[] = new \Iris\CitiesS($city);
27 | }
28 | }
29 | return $cities;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/CoveredRateCenter.php:
--------------------------------------------------------------------------------
1 | client = $client;
12 | parent::_init($client, '');
13 | }
14 |
15 | public function getList($filters = Array()) {
16 | $rcs = [];
17 | $data = parent::_get('coveredRateCenters', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
18 |
19 | if(isset($data['CoveredRateCenter'])) {
20 | $items = $data['CoveredRateCenter'];
21 |
22 | if($this->is_assoc($items))
23 | $items = [ $items ];
24 |
25 | foreach($items as $rc) {
26 | $rcs[] = new CoveredRateCenter($this, $rc);
27 | }
28 | }
29 | return $rcs;
30 | }
31 |
32 | public function covered_rate_center($id) {
33 | $rc = new CoveredRateCenter($this, array("Id" => $id));
34 | $rc->get();
35 | return $rc;
36 | }
37 |
38 | public function get_rest_client() {
39 | return $this->client;
40 | }
41 |
42 | public function get_relative_namespace() {
43 | return '/coveredRateCenters';
44 | }
45 | }
46 |
47 | #[AllowDynamicProperties]
48 | final class CoveredRateCenter extends RestEntry{
49 | use BaseModel;
50 |
51 | protected $fields = [
52 | "Name" => [ "type" => "string" ],
53 | "Abbreviation" => [ "type" => "string" ],
54 | "State" => [ "type" => "string" ],
55 | "Lata" => [ "type" => "string" ],
56 | "AvailableNumberCount" => [ "type" => "string" ],
57 | "ZipCodes" => [ "type" => "\Iris\ZipCodes" ],
58 | "Cities" => [ "type" => "\Iris\CitiesS" ],
59 | "Tiers" => [ "type" => "\Iris\Tiers" ],
60 | "NpaNxxXs" => [ "type" => "\Iris\NpaNxxXs" ],
61 | "Id" => [ "type" => "string" ],
62 | ];
63 |
64 | public function __construct($parent, $data) {
65 | $this->set_data($data);
66 | $this->parent = $parent;
67 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
68 | }
69 |
70 | public function get() {
71 | $data = parent::_get($this->get_id());
72 | $data = $data['CoveredRateCenter'];
73 | $this->set_data($data);
74 | }
75 |
76 | public function get_id() {
77 | if(!isset($this->Id))
78 | throw new \Exception("You should set FullNumber");
79 | return $this->Id;
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/src/DisconnectsModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
16 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
17 | }
18 |
19 | public function getList($filters = Array())
20 | {
21 | $disconnects = [];
22 |
23 | $data = parent::_get('disconnects', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
24 |
25 | if(isset($data['ListOrderIdUserIdDate']) && isset($data['ListOrderIdUserIdDate']['OrderIdUserIdDate'])) {
26 | $items = $data['ListOrderIdUserIdDate']['OrderIdUserIdDate'];
27 |
28 | if($this->is_assoc($items))
29 | $items = [ $items ];
30 |
31 | foreach($items as $item) {
32 | $disconnects[] = new Disconnect($this, $item);
33 | }
34 | }
35 | return $disconnects;
36 | }
37 |
38 | public function disconnect($id, $tndetail = false) {
39 | $d = new Disconnect($this, array("OrderId" => $id));
40 | $d->get($tndetail);
41 | return $d;
42 | }
43 |
44 | /**
45 | * Create new disconnect
46 | * @param array $data
47 | * @return \Iris\Disconnect
48 | */
49 | public function create($data, $save = true) {
50 | $disconnect = new Disconnect($this, $data);
51 | if($save)
52 | $disconnect->save();
53 | return $disconnect;
54 | }
55 |
56 | /**
57 | * Provide path of url
58 | * @return string
59 | */
60 | public function get_appendix() {
61 | return '/disconnects';
62 | }
63 |
64 | }
65 |
66 |
67 | #[AllowDynamicProperties]
68 | class Disconnect extends RestEntry {
69 | use BaseModel;
70 |
71 | protected $fields = array(
72 | "CountOfTNs" => [ "type" => "string" ],
73 | "userId" => [ "type" => "string" ],
74 | "lastModifiedDate" => [ "type" => "string" ],
75 | "OrderId" => [ "type" => "string" ],
76 | "OrderType" => [ "type" => "string" ],
77 | "OrderDate" => [ "type" => "string" ],
78 | "OrderStatus" => [ "type" => "string" ],
79 | "TelephoneNumberDetails" => [ "type" => "\Iris\TelephoneNumberDetail" ],
80 | "name" => [ "type" => "string" ],
81 | "CustomerOrderId" => [ "type" => "string" ],
82 | "DisconnectTelephoneNumberOrderType" => [ "type" => "\Iris\TelephoneNumberList" ],
83 | "OrderCreateDate" => [ "type" => "string" ],
84 |
85 | );
86 |
87 | /**
88 | * Constructor
89 | * @param type $parent
90 | * @param array $data
91 | */
92 | public function __construct($parent, $data)
93 | {
94 | $this->parent = $parent;
95 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
96 | $this->set_data($data);
97 | $this->notes = null;
98 | }
99 |
100 | public function get($tndetail = false) {
101 | if($tndetail) {
102 | $options = [ "tndetail" => "true" ];
103 | } else {
104 | $options = [];
105 | }
106 | $data = parent::_get($this->get_id(), $options);
107 | $response = new OrderResponse($data);
108 | if(isset($data['orderRequest']))
109 | $this->set_data($data['orderRequest']);
110 | $response->orderRequest = $this;
111 | return $response;
112 | }
113 |
114 | /**
115 | * Make POST request
116 | */
117 | public function save() {
118 | $data = parent::post(null, "DisconnectTelephoneNumberOrder", $this->to_array());
119 | $this->OrderStatus = new OrderRequestStatus($data);
120 | if(isset($this->OrderStatus->orderRequest)) {
121 | $this->OrderId = $this->OrderStatus->orderRequest->id;
122 | $this->set_data($this->OrderStatus->orderRequest->to_array());
123 | }
124 | }
125 |
126 | /**
127 | * Get Entity Id
128 | * @return type
129 | * @throws Exception in case of OrderId is null
130 | */
131 | private function get_id() {
132 | if(!isset($this->OrderId))
133 | throw new \Exception("You can't use this function without OrderId");
134 | return $this->OrderId;
135 | }
136 |
137 | /**
138 | * Get Notes of Entity
139 | * @return \Iris\Notes
140 | */
141 | public function notes() {
142 | if(is_null($this->notes))
143 | $this->notes = new Notes($this);
144 | return $this->notes;
145 | }
146 | /**
147 | * Provide relative url
148 | * @return string
149 | */
150 | public function get_appendix() {
151 | return '/'.$this->get_id();
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/DldaModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array()) {
27 |
28 | $dldas = [];
29 |
30 | $data = parent::_get('dldas');
31 |
32 | if($data['ListOrderIdUserIdDate'] && $data['ListOrderIdUserIdDate']['TotalCount']) {
33 | $items = $data['ListOrderIdUserIdDate']['OrderIdUserIdDate'];
34 |
35 | if($this->is_assoc($items))
36 | $items = [ $items ];
37 |
38 | foreach($items as $dlda) {
39 | $dldas[] = new Dlda($this, $dlda);
40 | }
41 | }
42 |
43 | return $dldas;
44 | }
45 |
46 | public function dlda($id) {
47 | $dlda = new Dlda($this, array("OrderId" => $id));
48 | $dlda->get();
49 | return $dlda;
50 | }
51 |
52 | public function get_appendix() {
53 | return '/dldas';
54 | }
55 |
56 | public function create($data, $save = true) {
57 | $dlda = new Dlda($this, $data);
58 | if($save)
59 | return $dlda->save();
60 | return $dlda;
61 | }
62 | }
63 |
64 |
65 | #[AllowDynamicProperties]
66 | final class Dlda extends RestEntry{
67 | use BaseModel;
68 |
69 | protected $fields = array(
70 | "CustomerOrderId" => array("type" => "string"),
71 | "OrderCreateDate" => array("type" => "string"),
72 | "AccountId" => array("type" => "string"),
73 | "CreatedByUser" => array("type" => "string"),
74 | "OrderId" => array("type" => "string"),
75 | "LastModifiedDate" => array("type" => "string"),
76 | "ProcessingStatus" => array("type" => "string"),
77 | "DldaTnGroups" => array("type" => "\Iris\DldaTnGroups"),
78 |
79 | "accountId" => array("type" => "string"),
80 | "CountOfTNs" => array("type" => "string"),
81 | "userId" => array("type" => "string"),
82 | "lastModifiedDate" => array("type" => "string"),
83 | "OrderType" => array("type" => "string"),
84 | "OrderDate" => array("type" => "string"),
85 | "orderId" => array("type" => "string"),
86 | "OrderStatus" => array("type" => "string"),
87 |
88 | );
89 |
90 | public function __construct($parent, $data)
91 | {
92 | $this->set_data($data);
93 | $this->parent = $parent;
94 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
95 | }
96 |
97 | public function get_id() {
98 | if(!isset($this->OrderId) && !isset($this->orderId))
99 | throw new \Exception('Id should be provided');
100 | return isset($this->OrderId) ? $this->OrderId: $this->orderId;
101 | }
102 |
103 | public function get() {
104 | $data = parent::_get($this->get_id());
105 | $this->set_data($data['DldaOrder']);
106 | }
107 |
108 | public function save() {
109 | $data = parent::post(null, "DldaOrder", $this->to_array());
110 | return new Dlda($this->parent, $data['DldaOrder']);
111 | }
112 |
113 | public function update() {
114 | parent::put($this->get_id(), "DldaOrder", $this->to_array());
115 | }
116 |
117 | public function history() {
118 | $url = sprintf("%s/%s", $this->get_id(), "history");
119 | $data = parent::_get($url);
120 | return new History($data);
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/src/HostsModel.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Host"),
13 | "TerminationHost" => array("type" => "\Iris\Host")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
21 |
22 | #[AllowDynamicProperties]
23 | class Host {
24 | use BaseModel;
25 |
26 | protected $fields = array(
27 | "HostName" => array("type" => "string"),
28 | "Port" => array("type" => "string"),
29 | "CustomerTrafficAllowed" => array("type" => "string"),
30 | "DataAllowed" => array("type" => "string")
31 | );
32 |
33 | public function __construct($data) {
34 | $this->set_data($data);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/LidbModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array()) {
27 |
28 | $libds = [];
29 |
30 | $data = parent::_get('lidbs', $filters);
31 |
32 | if($data['ListOrderIdUserIdDate'] && $data['ListOrderIdUserIdDate']['TotalCount'] > 0) {
33 | $items = $data['ListOrderIdUserIdDate']['OrderIdUserIdDate'];
34 |
35 | if($this->is_assoc($items))
36 | $items = [ $items ];
37 |
38 | foreach($items as $libd) {
39 | $libds[] = new Lidb($this, $libd);
40 | }
41 | }
42 |
43 | return $libds;
44 | }
45 |
46 | public function lidb($id) {
47 | $lidb = new Lidb($this, ["orderId" => $id]);
48 | $lidb->get();
49 | return $lidb;
50 | }
51 |
52 | public function create($data, $save = true) {
53 | $lidb = new Lidb($this, $data);
54 | if($save)
55 | $lidb->save();
56 | return $lidb;
57 | }
58 |
59 | public function get_appendix() {
60 | return '/lidbs';
61 | }
62 | }
63 |
64 |
65 | #[AllowDynamicProperties]
66 | final class Lidb extends RestEntry{
67 | use BaseModel;
68 |
69 | protected $fields = array(
70 | "CustomerOrderId" => array("type" => "string"),
71 | "orderId" => array("type" => "string"),
72 | "AccountId" => array("type" => "string"),
73 | "accountId" => array("type" => "string"),
74 | "CountOfTNs" => array("type" => "string"),
75 | "userId" => array("type" => "string"),
76 | "LastModifiedDate" => array("type" => "string"),
77 | "lastModifiedDate" => array("type" => "string"),
78 | "OrderType" => array("type" => "string"),
79 | "OrderDate" => array("type" => "string"),
80 | "OrderStatus" => array("type" => "string"),
81 | "OrderCreateDate" => array("type" => "string"),
82 | "ProcessingStatus" => array("type" => "string"),
83 | "CreatedByUser" => array("type" => "string"),
84 | "OrderCompleteDate" => array("type" => "string"),
85 | "ErrorList" => array("type" => "\Iris\ErrorList"),
86 | "LidbTnGroups" => array("type" => "\Iris\LidbTnGroups"),
87 | );
88 |
89 | public function __construct($parent, $data)
90 | {
91 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
92 |
93 | $this->parent = $parent;
94 | $this->set_data($data);
95 | }
96 |
97 | public function get() {
98 | $data = parent::_get($this->get_id());
99 | $this->set_data($data);
100 | }
101 |
102 | public function save() {
103 | $data = parent::post(null, "LidbOrder", $this->to_array());
104 | if (isset($data["LidbOrder"])) {
105 | if (isset($data["LidbOrder"]["OrderId"])) {
106 | $data["LidbOrder"]["orderId"] = $data["LidbOrder"]["OrderId"];
107 | unset($data["LidbOrder"]["OrderId"]);
108 | }
109 | $this->set_data($data["LidbOrder"]);
110 | } else {
111 | $this->set_data($data);
112 | }
113 | }
114 |
115 | public function get_id() {
116 | if(is_null($this->orderId))
117 | throw new \Exception('Id should be provided');
118 | return $this->orderId;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/LsrorderModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function get($filters = Array()) {
27 |
28 | $orders = [];
29 |
30 | $data = parent::_get('lsrorders', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
31 | print_r($data); exit;
32 | if($data['ListOrderIdUserIdDate'] && $data['ListOrderIdUserIdDate']['TotalCount']) {
33 | foreach($data['ListOrderIdUserIdDate']['OrderIdUserIdDate'] as $order) {
34 | $orders[] = new Lsrorder($this, $order);
35 | }
36 | }
37 |
38 | return $orders;
39 | }
40 |
41 | public function get_by_id($id) {
42 | $order = new Lsrorder($this, array("Id" => $id));
43 | $order->get();
44 | return $order;
45 | }
46 |
47 | public function get_appendix() {
48 | return '/orders';
49 | }
50 |
51 | public function create($data) {
52 | $order = new Lsrorder($this, $data);
53 | $order->save();
54 | return $order;
55 | }
56 | }
57 |
58 |
59 | #[AllowDynamicProperties]
60 | final class Lsrorder extends RestEntry{
61 | use BaseModel;
62 |
63 | protected $fields = array(
64 | /* TODO: fill fields
65 | * */
66 | "orderId" => array(
67 | "type" => "string"
68 | ),
69 |
70 | );
71 |
72 |
73 | public function __construct($orders, $data)
74 | {
75 | if(isset($data)) {
76 | if(is_object($data) && $data->Id)
77 | $this->id = $data->Id;
78 | if(is_array($data) && isset($data['Id']))
79 | $this->id = $data['Id'];
80 | }
81 | $this->set_data($data);
82 |
83 | if(!is_null($orders)) {
84 | $this->parent = $orders;
85 | parent::_init($orders->get_rest_client(), $orders->get_relative_namespace());
86 | }
87 |
88 | }
89 |
90 | public function get() {
91 | if(is_null($this->id))
92 | throw new \Exception('Id should be provided');
93 |
94 | $data = parent::_get($this->id);
95 | $this->set_data($data['Order']);
96 | }
97 |
98 | public function save() {
99 | if(!is_null($this->id))
100 | parent::put($this->id, "Order", $this->to_array());
101 | else {
102 | $header = parent::post(null, "Order", $this->to_array());
103 | $splitted = explode("/", $header['Location']);
104 | $this->id = end($splitted);
105 | }
106 | }
107 |
108 | public function history()
109 | {
110 | $url = sprintf('%s/%s', $this->id, 'history');
111 | $data = parent::_get($url);
112 | return $data;
113 | }
114 |
115 | public function notes()
116 | {
117 | $url = sprintf('%s/%s', $this->id, 'notes');
118 | $data = parent::_get($url);
119 | return $data;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/NotesModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
15 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
16 | }
17 |
18 | /**
19 | * Get Notes
20 | * @return array Array of Notes
21 | */
22 | public function getList() {
23 | $out = [];
24 |
25 | $data = parent::_get('notes');
26 |
27 | if(isset($data) && isset($data['Note'])) {
28 | $notes = $data['Note'];
29 | if($this->is_assoc($notes))
30 | $notes = [$notes];
31 | foreach($notes as $note) {
32 | $out[] = new Note($this, $note);
33 | }
34 | }
35 |
36 | return $out;
37 | }
38 |
39 | public function create($data, $save = true) {
40 | $note = new Note($this, $data);
41 | if($save)
42 | $note->save();
43 | return $note;
44 | }
45 |
46 |
47 | public function get_appendix() {
48 | return '/notes';
49 | }
50 |
51 | }
52 |
53 | /**
54 | * Note Model Class
55 | * @property string $id ID
56 | * @property string $UserId
57 | * @property string $Description
58 | * @property string $LastDateModifier
59 | */
60 |
61 | #[AllowDynamicProperties]
62 | class Note extends RestEntry {
63 | use BaseModel;
64 |
65 | protected $fields = array(
66 | "Id" => array("type" => "string"),
67 | "UserId" => array("type" => "string"),
68 | "Description" => array("type" => "string"),
69 | "LastDateModifier" => array("type" => "string")
70 | );
71 |
72 |
73 | public function __construct($parent, $data) {
74 | $this->parent = $parent;
75 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
76 | $this->set_data($data);
77 | }
78 |
79 | public function save() {
80 | $header = parent::post(null, "Note", $this->to_array());
81 | $splitted = explode("/", $header['Location']);
82 | $this->Id = end($splitted);
83 | }
84 | }
85 | ?>
86 |
--------------------------------------------------------------------------------
/src/Order.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array(), $defaults = Array(), $required = Array()) {
27 |
28 | $orders = [];
29 |
30 | $data = parent::_get('orders', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
31 |
32 | if(isset($data['ListOrderIdUserIdDate']) && isset($data['ListOrderIdUserIdDate']['OrderIdUserIdDate'])) {
33 | $items = $data['ListOrderIdUserIdDate']['OrderIdUserIdDate'];
34 |
35 | if($this->is_assoc($items))
36 | $items = [ $items ];
37 |
38 | foreach($items as $order) {
39 | $orders[] = new Order($this, $order);
40 | }
41 | }
42 |
43 | return $orders;
44 | }
45 |
46 | public function order($id, $tndetail = false) {
47 | $order = new Order($this, array("id" => $id));
48 | return $order->get($tndetail);
49 | }
50 |
51 | public function get_appendix() {
52 | return '/orders';
53 | }
54 |
55 | public function create($data, $save = true) {
56 | $order = new Order($this, $data);
57 | if($save)
58 | $order->save();
59 | return $order;
60 | }
61 | }
62 |
63 |
64 | #[AllowDynamicProperties]
65 | final class Order extends RestEntry{
66 | use BaseModel;
67 |
68 | public $id = Null;
69 |
70 | protected $fields = array(
71 | "id" => array("type" => "string"),
72 | "orderId" => array("type" => "string"),
73 | "Quantity" => array("type" => "string"),
74 | "Name" => array("type" => "string"),
75 | "CustomerOrderId" => array("type" => "string"),
76 | "SiteId" => array("type" => "string"),
77 | "PeerId" => array("type" => "string"),
78 | "PartialAllowed" => array("type" => "string"),
79 | "BackOrderRequested" => array("type" => "string"),
80 | "AreaCodeSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
81 | "RateCenterSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
82 | "NPANXXSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
83 | "TollFreeVanitySearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
84 | "TollFreeWildCharSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
85 | "StateSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
86 | "CitySearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
87 | "ZIPSearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
88 | "LATASearchAndOrderType" => array("type" => "\Iris\SearchOrderType"),
89 | "CountOfTNs" => array("type" => "string"),
90 | "userId" => array("type" => "string"),
91 | "lastModifiedDate" => array("type" => "string"),
92 | "OrderDate" => array("type" => "string"),
93 | "OrderStatus" => array("type" => "string"),
94 | "OrderType" => array("type" => "string"),
95 | "EnableTNDetail" => array("type" => "string"),
96 | "TelephoneNumberList" => array("type" => "\Iris\TelephoneNumbers"),
97 | "ExistingTelephoneNumberOrderType" => array("type" => "\Iris\TelephoneNumberList"),
98 | "CloseOrder" => array("type" => "string"),
99 | "OrderCreateDate" => array("type" => "string"),
100 | );
101 |
102 | public function __construct($orders, $data)
103 | {
104 | $this->set_data($data);
105 | $this->parent = $orders;
106 | parent::_init($orders->get_rest_client(), $orders->get_relative_namespace());
107 | $this->notes = null;
108 | $this->tns = null;
109 | }
110 |
111 | public function get($tndetail) {
112 | if($tndetail) {
113 | $options = ["tndetail" => "true"];
114 | } else {
115 | $options = [];
116 | }
117 |
118 | $data = parent::_get($this->get_id(), $options);
119 | $response = new OrderResponse($data);
120 | if(isset($data['Order']))
121 | $this->set_data($data['Order']);
122 | $response->Order = $this;
123 | return $response;
124 | }
125 |
126 | public function save() {
127 | $data = parent::post(null, "Order", $this->to_array());
128 | $this->set_data($data["Order"]);
129 | $this->OrderStatus = $data["OrderStatus"];
130 | }
131 |
132 | public function update() {
133 | $arr = $this->to_array();
134 | unset($arr['id']);
135 | unset($arr['orderId']);
136 | parent::put($this->get_id(), "Order", $arr);
137 | }
138 |
139 | public function tns() {
140 | if(!isset($this->tns))
141 | $this->tns = new Tns($this);
142 | return $this->tns;
143 | }
144 |
145 | /**
146 | * Get Notes of Entity
147 | * @return \Iris\Notes
148 | */
149 | public function notes() {
150 | if(is_null($this->notes)) {
151 | $this->notes = new Notes($this);
152 | }
153 |
154 | return $this->notes;
155 | }
156 | /**
157 | * Provide relative url
158 | * @return string
159 | */
160 | public function get_appendix() {
161 | return '/'.$this->get_id();
162 | }
163 | /**
164 | * Get Entity Id
165 | * @return type
166 | * @throws Exception in case of OrderId is null
167 | */
168 | public function get_id() {
169 | if(!isset($this->orderId) && !isset($this->id))
170 | throw new \Exception("You can't use this function without orderId or id");
171 | return isset($this->orderId) ? $this->orderId : $this->id;
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/src/PortinsModel.php:
--------------------------------------------------------------------------------
1 | parent = $account;
19 | parent::_init($account->get_rest_client(), $account->get_relative_namespace());
20 | }
21 |
22 | public function portin($id) {
23 | $portin = new Portin($this, array("OrderId" => $id));
24 | $portin->get();
25 | return $portin;
26 | }
27 |
28 |
29 | public function getList($filters = Array()) {
30 | $out = [];
31 |
32 | $portins = parent::_get('portins', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
33 |
34 | if($portins['lnpPortInfoForGivenStatus']) {
35 | $items = $portins['lnpPortInfoForGivenStatus'];
36 |
37 | if($this->is_assoc($items)) {
38 | $items = [ $items ];
39 | }
40 |
41 | foreach($items as $portin) {
42 | $out[] = new Portin($this, $portin);
43 | }
44 | }
45 |
46 | return $out;
47 | }
48 |
49 | /**
50 | * Create new Portin
51 | * @params array $data
52 | * @return \Iris\Portin
53 | */
54 | public function create($data, $save = true) {
55 | $portin = new Portin($this, $data);
56 | if($save)
57 | $portin->save();
58 | return $portin;
59 | }
60 |
61 | public function totals()
62 | {
63 | $url = sprintf('%s/%s', 'portins', 'totals');
64 | $data = parent::_get($url);
65 | return $data;
66 | }
67 |
68 | public function get_appendix() {
69 | return '/portins';
70 | }
71 | }
72 |
73 |
74 | #[AllowDynamicProperties]
75 | class Portin extends RestEntry {
76 | use BaseModel;
77 |
78 | protected $fields = array(
79 | "CountOfTNs" => [ "type" => "string"],
80 | "lastModifiedDate" => [ "type" => "string"],
81 | "OrderDate" => [ "type" => "string"],
82 | "OrderType" => [ "type" => "string"],
83 | "LNPLosingCarrierId" => [ "type" => "string"],
84 | "LNPLosingCarrierName" => [ "type" => "string"],
85 | "RequestedFOCDate" => [ "type" => "string"],
86 | "ActualFocDate" => [ "type" => "string"],
87 | "VendorId" => [ "type" => "string"],
88 | "VendorName" => [ "type" => "string"],
89 | "PON" => [ "type" => "string"],
90 | "AccountId" => [ "type" => "string"],
91 | "PeerId" => [ "type" => "string"],
92 | "OrderCreateDate" => [ "type" => "string"],
93 | "LastModifiedBy" => [ "type" => "string"],
94 | "PartialPort" => [ "type" => "string"],
95 | "Immediately" => [ "type" => "string"],
96 | "OrderId" => array("type" => "string"),
97 | "Status" => array("type" => "\Iris\Status"),
98 | "Errors" => array("type" => "string"),
99 | "ProcessingStatus" => array("type" => "string"),
100 | "CustomerOrderId" => array("type" => "string"),
101 | "RequestedFocDate" => array("type" => "string"),
102 | "AlternateSpid" => array("type" => "string"),
103 | "WirelessInfo" => array("type" => "\Iris\WirelessInfo"),
104 | "LosingCarrierName" => array("type" => "string"),
105 | "LastModifiedDate" => array("type" => "string"),
106 | "userId" => array("type" => "string"),
107 | "BillingTelephoneNumber" => array("type" => "string"),
108 | "NewBillingTelephoneNumber" => array("type" => "string"),
109 | "Subscriber" => array("type" => "\Iris\Subscriber"),
110 | "LoaAuthorizingPerson" => array("type" => "string"),
111 | "ListOfPhoneNumbers" => array("type" => "\Iris\Phones"),
112 | "SiteId" => array("type" => "string"),
113 | "Triggered" => array("type" => "string"),
114 | "BillingType" => array("type" => "string"),
115 | "TargetRespOrgId" => array("type" => "string")
116 | );
117 |
118 | public function __construct($parent, $data) {
119 | $this->set_data($data);
120 | $this->parent = $parent;
121 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
122 | $this->notes = null;
123 | }
124 |
125 | public function save() {
126 | $data = parent::post(null, "LnpOrder", $this->to_array());
127 | $this->set_data($data);
128 | }
129 |
130 | public function update() {
131 | $set = isset($this->ActualFocDate);
132 | if ($set) {
133 | $actualFocDate = $this->ActualFocDate;
134 | $this->ActualFocDate = null; //need to clear this since the API doesn't accept this value when set
135 | }
136 | $data = parent::put($this->get_id(), "LnpOrderSupp", $this->to_array());
137 | $this->set_data($data);
138 |
139 | if ($set) {
140 | $this->ActualFocDate = $actualFocDate;
141 | }
142 | }
143 |
144 | public function delete() {
145 | parent::_delete($this->get_id());
146 | }
147 |
148 | public function loas_send($file, $headers) {
149 | $url = sprintf('%s/%s', $this->get_id(), 'loas');
150 | $content = file_get_contents($file);
151 | return trim(parent::raw_file_post($url, $content, $headers));
152 | }
153 |
154 | public function loas_update($file, $filename, $headers) {
155 | $content = file_get_contents($file);
156 | $url = sprintf('%s/%s/%s', $this->get_id(), 'loas', $filename);
157 | parent::raw_file_put($url, $content, $headers);
158 | }
159 |
160 | public function loas_delete($filename) {
161 | $url = sprintf('%s/%s/%s', $this->get_id(), 'loas', $filename);
162 | parent::_delete($url);
163 | }
164 |
165 | public function list_loas($metadata) {
166 | $url = sprintf('%s/%s', $this->get_id(), 'loas');
167 | $query = array();
168 |
169 | if($metadata) {
170 | $query['metadata'] = 'true';
171 | }
172 |
173 | return (object)parent::_get($url, $query);
174 | }
175 |
176 | public function get_metadata($filename) {
177 | $url = sprintf('%s/%s/%s/metadata', $this->get_id(), 'loas', $filename);
178 | $data = parent::_get($url);
179 | return new FileMetaData($data);
180 | }
181 |
182 | public function set_metadata($filename, $meta) {
183 | $meta = new \Iris\FileMetaData($meta);
184 | $url = sprintf('%s/%s/%s/metadata', $this->get_id(), 'loas', $filename);
185 | parent::put($url, "FileMetaData", $meta->to_array());
186 | }
187 |
188 | public function delete_metadata($filename) {
189 | $url = sprintf('%s/%s/%s/metadata', $this->get_id(), 'loas', $filename);
190 | parent::_delete($url);
191 | }
192 |
193 | public function get_activation_status() {
194 | $url = sprintf('%s/%s', $this->get_id(), 'activationStatus');
195 | $data = parent::_get($url);
196 | return new ActivationStatus($data['ActivationStatus']);
197 | }
198 |
199 | public function set_activation_status($data) {
200 | $obj = new \Iris\ActivationStatus($data);
201 | $url = sprintf('%s/%s', $this->get_id(), 'activationStatus');
202 | $res = parent::put($url, "ActivationStatus", $obj->to_array());
203 | return new ActivationStatus($res['ActivationStatus']);
204 | }
205 |
206 | public function get() {
207 | $data = parent::_get($this->get_id());
208 | $this->set_data($data);
209 | }
210 |
211 | public function history() {
212 | $url = sprintf("%s/%s", $this->get_id(), "history");
213 | $data = parent::_get($url);
214 | return new History($data);
215 | }
216 |
217 | public function totals($filters = array()) {
218 | $url = sprintf('%s/%s', $this->get_id(), 'totals');
219 | $response = parent::_get($url, $filters);
220 | return $response['Count'];
221 | }
222 |
223 | /**
224 | * Get Notes of Entity
225 | * @return \Iris\Notes
226 | */
227 | public function notes() {
228 | if(is_null($this->notes))
229 | $this->notes = new Notes($this);
230 |
231 | return $this->notes;
232 | }
233 | /**
234 | * Get Entity Id
235 | * @return type
236 | * @throws Exception in case of OrderId is null
237 | */
238 | private function get_id() {
239 | if(!isset($this->OrderId))
240 | throw new \Exception("You can't use this function without OrderId");
241 | return $this->OrderId;
242 | }
243 | /**
244 | * Provide relative url
245 | * @return string
246 | */
247 | public function get_appendix() {
248 | return '/'.$this->get_id();
249 | }
250 |
251 | }
252 |
--------------------------------------------------------------------------------
/src/PortoutModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array()) {
27 | $out = [];
28 |
29 | $portouts = parent::_get('portouts', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
30 |
31 | if($portouts['lnpPortInfoForGivenStatus']) {
32 | $items = $portouts['lnpPortInfoForGivenStatus'];
33 |
34 | if($this->is_assoc($items)) {
35 | $items = [ $items ];
36 | }
37 |
38 | foreach($items as $portout) {
39 | $out[] = new Portin($this, $portout);
40 | }
41 | }
42 |
43 | return $out;
44 | }
45 |
46 | /**
47 | * Create new Portin
48 | * @params array $data
49 | * @return \Iris\Portin
50 | */
51 | public function create($data, $save = true) {
52 | $portout = new Portout($this, $data);
53 | if($save)
54 | $portout->save();
55 | return $portout;
56 | }
57 |
58 | public function portout($id)
59 | {
60 | $portouts = new Portout($this, ["OrderId" => $id]);
61 | $portouts->get();
62 | return $portouts;
63 | }
64 |
65 | public function get_appendix() {
66 | return '/portouts';
67 | }
68 |
69 | }
70 |
71 |
72 | #[AllowDynamicProperties]
73 | class Portout extends RestEntry {
74 | use BaseModel;
75 |
76 | protected $fields = array(
77 | "CountOfTNs" => [ "type" => "string"],
78 | "lastModifiedDate" => [ "type" => "string"],
79 | "OrderDate" => [ "type" => "string"],
80 | "OrderType" => [ "type" => "string"],
81 | "LNPLosingCarrierId" => [ "type" => "string"],
82 | "LNPLosingCarrierName" => [ "type" => "string"],
83 | "RequestedFOCDate" => [ "type" => "string"],
84 | "VendorId" => [ "type" => "string"],
85 | "VendorName" => [ "type" => "string"],
86 | "PON" => [ "type" => "string"],
87 | "AccountId" => [ "type" => "string"],
88 | "PeerId" => [ "type" => "string"],
89 | "OrderCreateDate" => [ "type" => "string"],
90 | "LastModifiedBy" => [ "type" => "string"],
91 | "PartialPort" => [ "type" => "string"],
92 | "Immediately" => [ "type" => "string"],
93 | "OrderId" => array("type" => "string"),
94 | "Status" => array("type" => "\Iris\Status"),
95 | "Errors" => array("type" => "string"),
96 | "ProcessingStatus" => array("type" => "string"),
97 | "CustomerOrderId" => array("type" => "string"),
98 | "RequestedFocDate" => array("type" => "string"),
99 | "AlternateSpid" => array("type" => "string"),
100 | "WirelessInfo" => array("type" => "\Iris\WirelessInfo"),
101 | "LosingCarrierName" => array("type" => "string"),
102 | "LastModifiedDate" => array("type" => "string"),
103 | "userId" => array("type" => "string"),
104 | "BillingTelephoneNumber" => array("type" => "string"),
105 | "Subscriber" => array("type" => "\Iris\Subscriber"),
106 | "LoaAuthorizingPerson" => array("type" => "string"),
107 | "ListOfPhoneNumbers" => array("type" => "\Iris\Phones"),
108 | "SiteId" => array("type" => "string"),
109 | "Triggered" => array("type" => "string"),
110 | "BillingType" => array("type" => "string"),
111 | "PortOutStatus" => array("type" => "string"),
112 | "ActualFocDate" => array("type" => "string"),
113 | "SPID" => array("type" => "string")
114 | );
115 |
116 | public function __construct($parent, $data) {
117 | $this->set_data($data);
118 | $this->parent = $parent;
119 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
120 | $this->notes = null;
121 | }
122 |
123 | public function get() {
124 | $data = parent::_get($this->get_id());
125 | $this->set_data($data);
126 | }
127 |
128 | public function totals($filters = array()) {
129 | $url = sprintf('%s/%s', $this->get_id(), 'totals');
130 | $response = parent::_get($url, $filters);
131 | return $response['Count'];
132 | }
133 |
134 |
135 | /**
136 | * Get Notes of Entity
137 | * @return \Iris\Notes
138 | */
139 | public function notes() {
140 | if(is_null($this->notes))
141 | $this->notes = new Notes($this);
142 | return $this->notes;
143 | }
144 | /**
145 | * Get Entity Id
146 | * @return type
147 | * @throws Exception in case of OrderId is null
148 | */
149 | private function get_id() {
150 | if(!isset($this->OrderId))
151 | throw new Exception("You can't use this function without OrderId");
152 | return $this->OrderId;
153 | }
154 | /**
155 | * Provide relative url
156 | * @return string
157 | */
158 | public function get_appendix() {
159 | return '/'.$this->get_id();
160 | }
161 |
162 | }
163 |
--------------------------------------------------------------------------------
/src/RateCenter.php:
--------------------------------------------------------------------------------
1 | client = $client;
12 | parent::_init($client, '');
13 | }
14 |
15 | public function getList($filters = Array()) {
16 | $rcs = [];
17 | $data = parent::_get('rateCenters', $filters, Array(), Array("state"));
18 |
19 | if($data['RateCenters']) {
20 | $items = $data['RateCenters']['RateCenter'];
21 |
22 | if($this->is_assoc($items))
23 | $items = [ $items ];
24 |
25 | foreach($items as $rc) {
26 | $rcs[] = new \Iris\CitiesS($rc);
27 | }
28 | }
29 | return $rcs;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/ReportsInstanceModel.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\InstanceParameter")
24 | );
25 | public function __construct($data) {
26 | $this->set_data($data);
27 | }
28 | }
29 |
30 |
31 | #[AllowDynamicProperties]
32 | final class InstanceParameter {
33 | use BaseModel;
34 |
35 | protected $fields = array(
36 | "Name" => array("type" => "string"),
37 | "Value" => array("type" => "string"),
38 | );
39 | public function __construct($data) {
40 | $this->set_data($data);
41 | }
42 | }
43 |
44 |
45 | #[AllowDynamicProperties]
46 | final class ReportInstance extends RestEntry{
47 | use BaseModel;
48 |
49 | protected $fields = array(
50 | "Id" => array("type" => "string"),
51 | "ReportId" => array("type" => "string"),
52 | "ReportName" => array("type" => "string"),
53 | "OutputFormat" => array("type" => "string"),
54 | "RequestedByUserName" => array("type" => "string"),
55 | "RequestedAt" => array("type" => "string"),
56 | "Parameters" => array("type" => "\Iris\InstanceParameters"),
57 | "Status" => array("type" => "string"),
58 | "ExpiresAt" => array("type" => "string"),
59 | );
60 |
61 | public function __construct($report, $data)
62 | {
63 | if(isset($data)) {
64 | if(is_object($data) && $data->Id)
65 | $this->id = $data->Id;
66 | if(is_array($data) && isset($data['Id']))
67 | $this->id = $data['Id'];
68 | }
69 | $this->set_data($data);
70 |
71 | if(!is_null($report)) {
72 | $this->parent = $report;
73 | parent::_init($report->get_rest_client(), $report->get_relative_namespace());
74 | }
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/ReportsModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
25 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
26 | }
27 |
28 | public function getList($filters = array()) {
29 |
30 | $reports = [];
31 |
32 | $data = parent::_get('reports', $filters, array("page"=> 1, "size" => 30), array("page", "size"));
33 | if($data['Reports']) {
34 | foreach($data['Reports']['Report'] as $report) {
35 | $reports[] = new Report($this, $report);
36 | }
37 | }
38 |
39 | return $reports;
40 | }
41 |
42 | public function get_by_id($id) {
43 | $order = new Report($this, array("Id" => $id));
44 | $order->get();
45 | return $order;
46 | }
47 |
48 | public function get_appendix() {
49 | return '/reports';
50 | }
51 | }
52 |
53 |
54 | #[AllowDynamicProperties]
55 | final class ReportValue {
56 | use BaseModel;
57 |
58 | protected $fields = array(
59 | "InternalName" => array("type" => "string"),
60 | "DisplayName" => array("type" => "string"),
61 | );
62 | public function __construct($data) {
63 | $this->set_data($data);
64 | }
65 | }
66 |
67 |
68 | #[AllowDynamicProperties]
69 | final class ReportValues {
70 | use BaseModel;
71 |
72 | protected $fields = array(
73 | "Value" => array("type" => "\Iris\ReportValue")
74 | );
75 | public function __construct($data) {
76 | $this->set_data($data);
77 | }
78 | }
79 |
80 |
81 | #[AllowDynamicProperties]
82 | final class ReportParameter {
83 | use BaseModel;
84 |
85 | protected $fields = array(
86 | "Name" => array("type" => "string"),
87 | "Type" => array("type" => "string"),
88 | "Required" => array("type" => "string"),
89 | "Description" => array("type" => "string"),
90 | "MultiSelectAllowed" => array("type" => "string"),
91 | "HelpInformation" => array("type" => "string"),
92 | "Values" => array("type" => "\Iris\ReportValues"),
93 | );
94 | public function __construct($data) {
95 | $this->set_data($data);
96 | }
97 | }
98 |
99 |
100 | #[AllowDynamicProperties]
101 | final class ReportParameters {
102 | use BaseModel;
103 |
104 | protected $fields = array(
105 | "Parameter" => array("type" => "\Iris\ReportParameter")
106 | );
107 | public function __construct($data) {
108 | $this->set_data($data);
109 | }
110 | }
111 |
112 |
113 | #[AllowDynamicProperties]
114 | final class Report extends RestEntry{
115 | use BaseModel;
116 |
117 | protected $fields = array(
118 | "Id" => array("type" => "string"),
119 | "Name" => array("type" => "string"),
120 | "Description" => array("type" => "string"),
121 | "Parameters" => array("type" => "\Iris\ReportParameters"),
122 | );
123 |
124 | public function __construct($reports, $data)
125 | {
126 | if(isset($data)) {
127 | if(is_object($data) && $data->Id)
128 | $this->id = $data->Id;
129 | if(is_array($data) && isset($data['Id']))
130 | $this->id = $data['Id'];
131 | }
132 | $this->set_data($data);
133 |
134 | if(!is_null($reports)) {
135 | $this->parent = $reports;
136 | parent::_init($reports->get_rest_client(), $reports->get_relative_namespace());
137 | }
138 | }
139 |
140 | public function get() {
141 | if(is_null($this->id))
142 | throw new \Exception('Id should be provided');
143 |
144 | $data = parent::_get($this->id);
145 | $this->set_data($data['Report']);
146 | }
147 |
148 | public function areaCodes()
149 | {
150 | $url = sprintf('%s/%s', $this->id, 'areaCodes');
151 | $data = parent::_get($url);
152 | return $data;
153 | }
154 |
155 | public function instances($filters = array())
156 | {
157 | $rep_instances = [];
158 |
159 | $data = parent::_get($this->Id.'/instances', $filters, array("page"=> 1, "size" => 30), array("page", "size"));
160 |
161 | if($data['Instances']) {
162 | foreach($data['Instances']['Instance'] as $instance) {
163 | $rep_instances[] = new ReportInstance($this, $instance);
164 | }
165 | }
166 |
167 | return $rep_instances;
168 | }
169 |
170 | public function modifyInstance($instance) {
171 | $response = parent::post($this->Id."/instances/".$instance->Id, "Instance", $this->to_array());
172 | return $response; //this api endpoint returns a response header
173 | }
174 |
175 | public function get_appendix() {
176 | return $this->parent->get_appendix();
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/src/RestEntry.php:
--------------------------------------------------------------------------------
1 | client = new Client(\Iris\Config::REST_LOGIN, \Iris\Config::REST_PASS, Array('url' => \Iris\Config::REST_URL));
20 | }
21 | else
22 | {
23 | $this->client = $client;
24 | }
25 | if (!is_null($namespace))
26 | {
27 | $this->namespace = $namespace;
28 | }
29 | else
30 | {
31 | $this->namespace = strtolower(get_class($this));
32 | }
33 | }
34 |
35 | protected function is_assoc($array) {
36 | $array = array_keys($array); return ($array !== array_keys($array));
37 | }
38 |
39 | protected function get_url($path)
40 | {
41 | if(is_null($path))
42 | return $this->namespace;
43 |
44 | return sprintf('%s/%s', $this->namespace, $path);
45 | }
46 |
47 | protected function _get($url, $options=Array(), $defaults = Array(), $required = Array())
48 | {
49 | $url = $this->get_url($url);
50 | $this->set_defaults($options, $defaults);
51 | $this->check_required($options, $required);
52 |
53 | return $this->client->get($url, ['query' => $options]);
54 | }
55 |
56 | public function raw_file_post($url, $body, $headers = array()) {
57 | $url = $this->get_url($url);
58 | return $this->client->raw_file_post($url, $body, $headers);
59 | }
60 | public function raw_file_put($url, $body, $headers = array()) {
61 | $url = $this->get_url($url);
62 | return $this->client->raw_file_put($url, $body, $headers);
63 | }
64 |
65 | protected function post($url, $base_node, $data)
66 | {
67 | $url = $this->get_url($url);
68 | return $this->client->post($url, $base_node, $data);
69 | }
70 |
71 | protected function put($url, $base_node, $data)
72 | {
73 | $url = $this->get_url($url);
74 | return $this->client->put($url, $base_node, $data);
75 | }
76 |
77 | protected function _delete($url)
78 | {
79 | $url = $this->get_url($url);
80 | $this->client->delete($url);
81 | }
82 |
83 | protected function set_defaults(&$options, $defaults) {
84 | foreach($defaults as $key => $value) {
85 | if(!array_key_exists($key, $options))
86 | $options[$key] = $value;
87 | }
88 | }
89 |
90 | protected function check_required($options, $required) {
91 | foreach($required as $key) {
92 | if(!array_key_exists($key, $options))
93 | throw new ValidateException("Required options '{$key}' should be provided");
94 | }
95 | }
96 |
97 | public function get_rest_client() {
98 | return $this->parent->get_rest_client();
99 | }
100 | public function get_relative_namespace() {
101 | return $this->parent->get_relative_namespace().$this->get_appendix();
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/src/Sippeers.php:
--------------------------------------------------------------------------------
1 | parent = $site;
11 | parent::_init($site->get_rest_client(), $site->get_relative_namespace());
12 | }
13 |
14 | public function getList($filters = Array()) {
15 | $sippeers = [];
16 |
17 | $data = parent::_get('sippeers');
18 |
19 | if(isset($data['SipPeers']) && isset($data['SipPeers']['SipPeer'])) {
20 | if($this->is_assoc($data['SipPeers']['SipPeer']))
21 | $peers = [ $data['SipPeers']['SipPeer'] ];
22 | else
23 | $peers = $data['SipPeers']['SipPeer'];
24 |
25 | foreach($peers as $sippeer) {
26 | $sippeers[] = new Sippeer($this, $sippeer);
27 | }
28 | }
29 |
30 | return $sippeers;
31 | }
32 |
33 | public function sippeer($id) {
34 | $sipper = new Sippeer($this, array("PeerId" => $id));
35 | $sipper->get();
36 | return $sipper;
37 | }
38 |
39 | public function get_appendix() {
40 | return '/sippeers';
41 | }
42 |
43 | public function create($data, $save = true) {
44 | $sippeer = new Sippeer($this, $data);
45 | if($save)
46 | $sippeer->save();
47 | return $sippeer;
48 | }
49 | }
50 |
51 |
52 | #[AllowDynamicProperties]
53 | class Sippeer extends RestEntry {
54 | use BaseModel;
55 |
56 | protected $fields = array(
57 | "PeerId" => array("type" => "string"),
58 | "PeerName" => array("type" => "string"),
59 | "IsDefaultPeer" => array("type" => "string"),
60 | "ShortMessagingProtocol" => array("type" => "string"),
61 | "VoiceHosts" => array("type" => "Iris\Hosts"),
62 | "VoiceHostGroups" => array("type" => "string"),
63 | "SmsHosts" => array("type" => "Iris\Hosts"),
64 | "TerminationHosts" => array("type" => "Iris\Hosts"),
65 | "CallingName" => array("type" => "string")
66 | );
67 |
68 | public function __construct($parent, $data) {
69 | $this->PeerId = null;
70 |
71 | if(isset($data)) {
72 | if(is_object($data) && $data->PeerId)
73 | $this->PeerId = $data->PeerId;
74 | if(is_array($data) && isset($data['PeerId']))
75 | $this->PeerId = $data['PeerId'];
76 | }
77 | $this->set_data($data);
78 |
79 | $this->parent = $parent;
80 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
81 | $this->tns = null;
82 | }
83 |
84 | public function get() {
85 | $data = parent::_get($this->get_id());
86 | $this->set_data($data['SipPeer']);
87 | }
88 |
89 | public function totaltns() {
90 | $url = sprintf('%s/%s', $this->get_id(), "totaltns");
91 | $data = parent::_get($url);
92 | return $data['SipPeerTelephoneNumbersCounts']['SipPeerTelephoneNumbersCount'];
93 | }
94 |
95 | public function save() {
96 | $header = parent::post(null, "SipPeer", $this->to_array());
97 | $splitted = explode("/", $header['Location']);
98 | $this->PeerId = end($splitted);
99 | }
100 |
101 | public function update() {
102 | parent::put($this->get_id(), "SipPeer", $this->to_array());
103 | }
104 |
105 | public function delete() {
106 | parent::_delete($this->get_id());
107 | }
108 |
109 | public function movetns($data) {
110 | $data = new \Iris\Phones($data);
111 | $url = sprintf("%s/%s", $this->get_id(), "movetns");
112 | parent::post($url, "SipPeerTelephoneNumbers", $data);
113 | }
114 |
115 | public function tns() {
116 | if(is_null($this->tns))
117 | $this->tns = new Tns($this);
118 | return $this->tns;
119 | }
120 |
121 | private function get_id() {
122 | if(!isset($this->PeerId))
123 | throw new \Exception('Id should be provided');
124 | return $this->PeerId;
125 | }
126 |
127 |
128 | public function get_appendix() {
129 | return '/'.$this->get_id();
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/src/Sites.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
19 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
20 | }
21 |
22 | public function getList($filters = Array()) {
23 | $sites = [];
24 |
25 | $data = parent::_get('sites');
26 |
27 | if(isset($data["Sites"]) && isset($data["Sites"]["Site"])) {
28 | $items = $data["Sites"]["Site"];
29 |
30 | if(is_array($items) && $this->is_assoc($items))
31 | $items = [ $items ];
32 |
33 | foreach($items as $site) {
34 | $sites[] = new Site($this, $site);
35 | }
36 | }
37 |
38 | return $sites;
39 | }
40 |
41 | public function site($id) {
42 | $site = new Site($this, array("Id" => $id));
43 | $site->get();
44 | return $site;
45 | }
46 |
47 | public function get_appendix() {
48 | return '/sites';
49 | }
50 |
51 | public function create($data, $save = true) {
52 | $site = new Site($this, $data);
53 | if($save)
54 | $site->save();
55 | return $site;
56 | }
57 | }
58 |
59 |
60 | #[AllowDynamicProperties]
61 | class Site extends RestEntry {
62 | use BaseModel;
63 |
64 | protected $fields = array(
65 | "Id" => array(
66 | "type" => "string"
67 | ),
68 | "Name" => array(
69 | "type" => "string"
70 | ),
71 | "Description" => array(
72 | "type" => "string"
73 | ),
74 | "Address" => array(
75 | "type" => "\Iris\Address"
76 | ),
77 | "CustomerProvidedID" => array(
78 | "type" => "string"
79 | ),
80 | "CustomerName" => array(
81 | "type" => "string"
82 | )
83 | );
84 |
85 | public function __construct($sites, $data) {
86 | $this->set_data($data);
87 | $this->parent = $sites;
88 | parent::_init($sites->get_rest_client(), $sites->get_relative_namespace());
89 | }
90 |
91 | public function get() {
92 | $data = parent::_get($this->get_id());
93 | $this->set_data($data['Site']);
94 | }
95 | public function delete() {
96 | parent::_delete($this->get_id());
97 | }
98 |
99 | public function save() {
100 | $header = parent::post(null, "Site", $this->to_array());
101 | $splitted = explode("/", $header['Location']);
102 | $this->Id = end($splitted);
103 | }
104 |
105 | public function update() {
106 | parent::put($this->get_id(), "Site", $this->to_array());
107 | }
108 |
109 | public function totaltns() {
110 | $url = sprintf('%s/%s', $this->get_id(), "totaltns");
111 | $data = parent::_get($url);
112 | return $data['SiteTNs']['TotalCount'];
113 | }
114 |
115 | public function sippeers() {
116 | if(!isset($this->sippeers))
117 | $this->sippeers = new Sippeers($this);
118 | return $this->sippeers;
119 | }
120 |
121 | public function portins() {
122 | if(!isset($this->portins))
123 | $this->portins = new Portins($this);
124 | return $this->portins;
125 | }
126 |
127 | public function orders() {
128 | if(!isset($this->orders))
129 | $this->orders = new Orders($this);
130 | return $this->orders;
131 | }
132 |
133 | public function get_id() {
134 | if(!isset($this->Id))
135 | throw new \Exception('Id should be provided');
136 | return $this->Id;
137 | }
138 |
139 | public function get_appendix() {
140 | return '/'.$this->get_id();
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/SubscriptionsModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array()) {
27 |
28 | $subscriptions = [];
29 |
30 | $data = parent::_get('subscriptions', $filters);
31 |
32 | if($data['Subscriptions'] && $data['Subscriptions']['Subscription']) {
33 | $items = $data['Subscriptions']['Subscription'];
34 |
35 | if($this->is_assoc($items))
36 | $items = [ $items ];
37 |
38 | foreach($items as $subscription) {
39 | $subscriptions[] = new Subscription($this, $subscription);
40 | }
41 | }
42 |
43 | return $subscriptions;
44 | }
45 |
46 | public function subscription($id) {
47 | $sbc = new Subscription($this, array("SubscriptionId" => $id));
48 | $sbc->get();
49 | return $sbc;
50 | }
51 |
52 | public function get_appendix() {
53 | return '/subscriptions';
54 | }
55 |
56 | public function create($data, $save = true) {
57 | $sbc = new Subscription($this, $data);
58 | if($save)
59 | $sbc->save();
60 | return $sbc;
61 | }
62 | }
63 |
64 |
65 | #[AllowDynamicProperties]
66 | final class Subscription extends RestEntry{
67 | use BaseModel;
68 |
69 | protected $fields = array(
70 | "SubscriptionId" => array("type" => "string"),
71 | "OrderType" => array("type" => "string"),
72 | "OrderId" => array("type" => "string"),
73 | "EmailSubscription" => array("type" => "\Iris\EmailSubscription"),
74 | "CallbackSubscription" => array("type" => "\Iris\CallbackSubscription"),
75 | "CallbackCredentials" => array("type" => "\Iris\CallbackCredentials"),
76 | "PublicKey" => array("type" => "string")
77 | );
78 |
79 |
80 | public function __construct($subscriptions, $data)
81 | {
82 | $this->set_data($data);
83 | $this->parent = $subscriptions;
84 | parent::_init($subscriptions->get_rest_client(), $subscriptions->get_relative_namespace());
85 | }
86 |
87 | public function get() {
88 | $data = parent::_get($this->get_id());
89 | $this->set_data($data['Subscriptions']['Subscription']);
90 | }
91 | public function delete() {
92 | parent::_delete($this->get_id());
93 | }
94 |
95 | public function save() {
96 | $header = parent::post(null, "Subscription", $this->to_array());
97 | $splitted = explode("/", $header['Location']);
98 | $this->SubscriptionId = end($splitted);
99 | }
100 |
101 | public function update() {
102 | parent::put($this->get_id(), "Subscription", $this->to_array());
103 | }
104 |
105 | public function get_id() {
106 | if(!isset($this->SubscriptionId))
107 | throw new \Exception('Id should be provided');
108 | return $this->SubscriptionId;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/Suggestions.php:
--------------------------------------------------------------------------------
1 | client = $client;
12 | }
13 |
14 | /**
15 | * Get suggestions by query
16 | *
17 | * @return string
18 | */
19 | public function get($query)
20 | {
21 | return $this->client->get('suggestions', ['query' => ['q' => $query]]);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/TnOptionModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function getList($filters = Array()) {
27 |
28 | $list = [];
29 |
30 | $data = parent::_get('tnoptions');
31 |
32 | if($data['TnOptionOrderSummary'] && $data['TotalCount'] > 0) {
33 | $items = $data['TnOptionOrderSummary'];
34 |
35 | if($this->is_assoc($items))
36 | $items = [ $items ];
37 |
38 | foreach($items as $item) {
39 | $list[] = new TnOption($this, $item);
40 | }
41 | }
42 |
43 | return $list;
44 | }
45 |
46 | public function tnoption($id) {
47 | $item = new TnOption($this, array("OrderId" => $id));
48 | $item->get();
49 | return $item;
50 | }
51 |
52 | public function get_appendix() {
53 | return '/tnoptions';
54 | }
55 |
56 | public function create($data, $save = true) {
57 | $item = new TnOption($this, $data);
58 | if($save)
59 | return $item->save();
60 | return $item;
61 | }
62 | }
63 |
64 | #[AllowDynamicProperties]
65 | final class TnOption extends RestEntry{
66 | use BaseModel;
67 |
68 | protected $fields = array(
69 | "OrderId" => array("type" => "string"),
70 | "AccountId" => array("type" => "string"),
71 | "accountId" => array("type" => "string"),
72 | "CountOfTNs" => array("type" => "string"),
73 | "userId" => array("type" => "string"),
74 | "LastModifiedDate" => array("type" => "string"),
75 | "lastModifiedDate" => array("type" => "string"),
76 | "OrderType" => array("type" => "string"),
77 | "OrderDate" => array("type" => "string"),
78 | "OrderStatus" => array("type" => "string"),
79 | "OrderCreateDate" => array("type" => "string"),
80 | "ProcessingStatus" => array("type" => "string"),
81 | "CreatedByUser" => array("type" => "string"),
82 | "ErrorList" => array("type" => "\Iris\ErrorList"),
83 | "TnOptionGroups" => array("type" => "\Iris\TnOptionGroups"),
84 | "PortOutPasscode" => array("type" => "string")
85 | );
86 |
87 |
88 | public function __construct($parent, $data)
89 | {
90 | $this->set_data($data);
91 | $this->parent = $parent;
92 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
93 | }
94 |
95 | public function get_id() {
96 | if(!isset($this->OrderId) && !isset($this->orderId))
97 | throw new \Exception('Id should be provided');
98 | return isset($this->OrderId) ? $this->OrderId: $this->orderId;
99 | }
100 |
101 | public function get() {
102 | $data = parent::_get($this->get_id());
103 | $this->set_data($data);
104 | }
105 |
106 | public function save() {
107 | $data = parent::post(null, "TnOptionOrder", $this->to_array());
108 | return new TnOption($this->parent, $data['TnOptionOrder']);
109 | }
110 |
111 | public function history() {
112 | $url = sprintf("%s/%s", $this->get_id(), "history");
113 | $data = parent::_get($url);
114 | return new History($data);
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/src/Tns.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
15 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
16 | }
17 | else {
18 | parent::_init($client, $namespace="");
19 | }
20 | }
21 |
22 | public function get_from_sippeer() {
23 | $tns = [];
24 | $data = parent::_get('tns');
25 |
26 | if($data['SipPeerTelephoneNumbers'] && $data['SipPeerTelephoneNumbers']["SipPeerTelephoneNumber"]) {
27 | $items = $data['SipPeerTelephoneNumbers']["SipPeerTelephoneNumber"];
28 |
29 | if($this->is_assoc($items))
30 | $items = [ $items ];
31 |
32 | foreach($items as $tn) {
33 | $tns[] = new Tn($this, $tn);
34 | }
35 | }
36 | return $tns;
37 | }
38 |
39 | public function getList($filters = Array()) {
40 | if(isset($this->parent) && $this->parent instanceof \Iris\Sippeer) {
41 | return $this->get_from_sippeer();
42 | }
43 | $tns = [];
44 | $data = parent::_get('tns', $filters, Array("page"=> 1, "size" => 30), Array("page", "size"));
45 |
46 | if (isset($data['TelephoneNumberCount']))
47 | {
48 | $this->totalsTns = (int) $data['TelephoneNumberCount'];
49 | }
50 |
51 | if(isset($data['TelephoneNumbers']) && isset($data['TelephoneNumbers']["TelephoneNumber"])) {
52 | $items = $data['TelephoneNumbers']["TelephoneNumber"];
53 |
54 | if($this->is_assoc($items))
55 | $items = [ $items ];
56 |
57 | foreach($items as $tn) {
58 | $tns[] = new Tn($this, $tn);
59 | }
60 | }
61 | return $tns;
62 | }
63 |
64 | public function totalTns()
65 | {
66 | if (is_null($this->totalsTns))
67 | {
68 | $this->getList(array('size' => 1));
69 | }
70 |
71 | return $this->totalsTns;
72 | }
73 |
74 | public function create($data) {
75 | $tn = new Tn($this, $data);
76 | return $tn;
77 | }
78 |
79 | public function tn($id) {
80 | $tn = new Tn($this, array("FullNumber" => $id));
81 | $tn->get();
82 | return $tn;
83 | }
84 |
85 | public function get_rest_client() {
86 | if(isset($this->parent)) {
87 | return $this->parent->client;
88 | } else {
89 | return $this->client;
90 | }
91 | }
92 |
93 | public function get_relative_namespace() {
94 | return (isset($this->parent) ? $this->parent->get_relative_namespace() : '').'/tns';
95 | }
96 | }
97 |
98 |
99 | #[AllowDynamicProperties]
100 | final class Tn extends RestEntry{
101 | use BaseModel;
102 |
103 | protected $fields = array(
104 | "City" => array(
105 | "type" => "string"
106 | ),
107 | "Lata" => array(
108 | "type" => "string"
109 | ),
110 | "State" => array(
111 | "type" => "string"
112 | ),
113 | "FullNumber" => array(
114 | "type" => "string"
115 | ),
116 | "Tier" => array(
117 | "type" => "string"
118 | ),
119 | "VendorId" => array(
120 | "type" => "string"
121 | ),
122 | "VendorName" => array(
123 | "type" => "string"
124 | ),
125 | "RateCenter" => array(
126 | "type" => "string"
127 | ),
128 | "Status" => array(
129 | "type" => "string"
130 | ),
131 | "AccountId" => array(
132 | "type" => "string"
133 | ),
134 | "LastModified" => array(
135 | "type" => "string"
136 | ),
137 | "OrderCreateDate" => array("type" => "string"),
138 | "OrderId" => array("type" => "string"),
139 | "OrderType" => array("type" => "string"),
140 | "SiteId" => array("type" => "string"),
141 | "Site" => array("type" => "string"),
142 | "SipPeer" => array("type" => "string"),
143 | "AccountId" => array("type" => "string"),
144 | "Features" => array("type" => "\Iris\Features"),
145 | "TnAttributes" => array("type" => "\Iris\TnAttributes"),
146 | "MessagingSettings" => array("type" => "\Iris\MessageSettings"),
147 | "TnOptions" => array("type" => "\Iris\TnOptionGroup")
148 | );
149 |
150 | public function __construct($tns, $data) {
151 | $this->set_data($data);
152 | $this->parent = $tns;
153 | parent::_init($tns->get_rest_client(), $tns->get_relative_namespace());
154 | }
155 |
156 | public function get() {
157 | $data = parent::_get($this->get_id());
158 | if(isset($data["SipPeerTelephoneNumber"]))
159 | $data = $data['SipPeerTelephoneNumber'];
160 | $this->set_data($data);
161 | }
162 |
163 | public function tndetails() {
164 | $url = sprintf("%s/%s", $this->get_id(), "tndetails");
165 | $data = parent::_get($url);
166 | if (isset($data['TelephoneNumberDetails']))
167 | {
168 | $this->set_data($data['TelephoneNumberDetails']);
169 | }
170 | }
171 |
172 | public function site() {
173 | if(!isset($this->AccountId))
174 | $this->get();
175 |
176 | $url = sprintf("%s/%s", $this->get_id(), "sites");
177 | $data = parent::_get($url);
178 | $account = new Account($this->AccountId, $this->parent->get_rest_client());
179 | return $account->sites()->create($data, false);
180 | }
181 |
182 | public function sippeer() {
183 | if(!isset($this->AccountId) || !isset($this->SiteId))
184 | $this->get();
185 |
186 | $url = sprintf("%s/%s", $this->get_id(), "sippeers");
187 | $data = parent::_get($url);
188 | $account = new Account($this->AccountId, $this->parent->get_rest_client());
189 | return $account->sites()->create(["Id" => $this->SiteId], false)->sippeers()->create(["PeerId" => $data["Id"], "PeerName" => $data["Name"]], false);
190 | }
191 |
192 | public function tnreservation() {
193 | if(!isset($this->AccountId) || !isset($this->SiteId))
194 | $this->get();
195 |
196 | $url = sprintf("%s/%s", $this->get_id(), "tnreservation");
197 | $account = new Account($this->AccountId, $this->parent->get_rest_client());
198 | $data = parent::_get($url);
199 | return $account->tnsreservations()->create($data, false);
200 | }
201 |
202 | public function set_tn_options($data) {
203 | $data = new \Iris\SipPeerTelephoneNumber($data);
204 |
205 | if(!($this->parent->parent instanceof Sippeer))
206 | throw new \Exception("You should get TN from sippeer");
207 | parent::put($this->get_id(), "SipPeerTelephoneNumber", $data->to_array());
208 | }
209 |
210 | public function ratecenter() {
211 | $url = sprintf("%s/%s", $this->get_id(), "ratecenter");
212 | $data = parent::_get($url);
213 | if($data['TelephoneNumberDetails']) {
214 | return new TelephoneNumberDetail($data['TelephoneNumberDetails']);
215 | }
216 | return null;
217 | }
218 | public function lata() {
219 | $url = sprintf("%s/%s", $this->get_id(), "lata");
220 | $data = parent::_get($url);
221 | if($data['TelephoneNumberDetails']) {
222 | return new TelephoneNumberDetail($data['TelephoneNumberDetails']);
223 | }
224 | return null;
225 | }
226 |
227 | public function lca() {
228 | $url = sprintf("%s/%s", $this->get_id(), "lca");
229 | $data = parent::_get($url);
230 | return new LcaSearch($data);
231 | }
232 |
233 |
234 | public function get_id() {
235 | if(!isset($this->FullNumber))
236 | throw new \Exception("You should set FullNumber");
237 | return $this->FullNumber;
238 | }
239 |
240 | public function get_appendix() {
241 | return '/'.$this->get_id();
242 | }
243 |
244 | }
245 |
--------------------------------------------------------------------------------
/src/TnsReservationModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
23 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
24 | }
25 |
26 | public function create($data, $save = true) {
27 | $tns_res = new TnsReservation($this, $data);
28 | if($save)
29 | $tns_res->save();
30 | return $tns_res;
31 | }
32 |
33 | public function tnsreservation($id) {
34 | $r = new TnsReservation($this, ["ReservationId" => $id]);
35 | return $r->get();
36 | }
37 |
38 | public function get_appendix() {
39 | return '/tnreservation';
40 | }
41 | }
42 |
43 |
44 | #[AllowDynamicProperties]
45 | final class TnsReservation extends RestEntry{
46 | use BaseModel;
47 |
48 | protected $fields = array(
49 | "ReservedTn" => array("type" => "string"),
50 | "ReservationId" => array("type" => "string"),
51 | "ReservationExpires" => array("type" => "string"),
52 | "AccountId" => array("type" => "string")
53 | );
54 |
55 | public function __construct($parent, $data)
56 | {
57 | $this->set_data($data);
58 | $this->parent = $parent;
59 | parent::_init($parent->get_rest_client(), $parent->get_relative_namespace());
60 | }
61 |
62 | public function save() {
63 | $header = parent::post(null, "Reservation", $this->to_array());
64 | $splitted = explode("/", $header['Location']);
65 | $this->ReservationId = end($splitted);
66 | }
67 |
68 | public function get() {
69 | $data = parent::_get($this->get_id());
70 | $this->set_data($data['Reservation']);
71 | return $this;
72 | }
73 |
74 | public function delete() {
75 | parent::_delete($this->get_id());
76 | }
77 |
78 | public function get_id() {
79 | if(!isset($this->ReservationId))
80 | throw new \Exception('ReservationId should be provided');
81 | return $this->ReservationId;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/UserModel.php:
--------------------------------------------------------------------------------
1 | parent = $parent;
13 | parent::_init($this->parent->get_rest_client(), $this->parent->get_relative_namespace());
14 | }
15 | else {
16 | parent::_init($client, $namespace="");
17 | }
18 | }
19 |
20 | public function getList()
21 | {
22 | $out = [];
23 | $url = sprintf('%s', 'users');
24 | $data = parent::_get($url);
25 |
26 | if(isset($data['Users']) && isset($data['Users']['User'])) {
27 | $items = $data['Users']['User'];
28 |
29 | if($this->is_assoc($items)) {
30 | $items = [ $items ];
31 | }
32 |
33 | foreach($items as $item) {
34 | $out[] = new User($this->parent->get_rest_client(), $item);
35 | }
36 | }
37 |
38 | return $out;
39 | }
40 | }
41 |
42 | #[AllowDynamicProperties]
43 | final class User extends RestEntry {
44 | use BaseModel;
45 |
46 | protected $fields = [
47 | "Username" => ["type" => "string"],
48 | "FirstName" => ["type" => "string"],
49 | "LastName" => ["type" => "string"],
50 | "EmailAddress" => ["type" => "string"],
51 | "TelephoneNumber" => ["type" => "string"],
52 | "Roles" => ["type" => "\Iris\Roles"],
53 | ];
54 |
55 | public function __construct($client=null, $data=[])
56 | {
57 | $this->set_data($data);
58 | parent::_init($client, "users");
59 | }
60 | public function password($password)
61 | {
62 | $url = sprintf('%s/%s', $this->get_id(), 'password');
63 | parent::put($url, 'Password', htmlspecialchars($password));
64 | }
65 |
66 | public function get_id() {
67 | if(!isset($this->Username))
68 | throw new \Exception("You should set Username");
69 | return $this->Username;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/ValidateException.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "CampaignId" => array("type" => "string"),
14 | "Action" => array("type" => "string"),
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/ActivationStatus.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "ActivatedTelephoneNumbersList" => array("type" => "Iris\Phones"),
14 | "NotYetActivatedTelephoneNumbersList" => array("type" => "Iris\Phones")
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/AvailableNpaNxx.php:
--------------------------------------------------------------------------------
1 | ["type" => "string"],
13 | "Npa" => ["type" => "string"],
14 | "Nxx" => ["type" => "string"],
15 | "Quantity" => ["type" => "string"],
16 | "State" => ["type" => "string"],
17 | ];
18 | public function __construct($data) {
19 | $this->set_data($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/BasicAuthentication.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Password" => array("type" => "string"),
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/Bdr.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "EndDate" => array("type" => "string"),
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/BdrCreationResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Location" => array("type" => "string"),
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/CallbackCredentials.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\BasicAuthentication"),
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/simpleModels/CallbackSubscription.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Expiry" => array("type" => "string"),
14 | "Status" => array("type" => "string"),
15 | "CallbackCredentials" => array("type" => "string"),
16 | );
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/Cities.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "RcAbbreviation" => array("type" => "string"),
14 | "Name" => array("type" => "string"),
15 | "Abbreviation" => array("type" => "string"),
16 | );
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/Csr.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "WorkingOrBillingTelephoneNumber" => array("type" => "string"),
14 | "AccountNumber" => array("type" => "string"),
15 | "AccountTelephoneNumber" => array("type" => "string"),
16 | "EndUserName" => array("type" => "string"),
17 | "AuthorizingUserName" => array("type" => "string"),
18 | "CustomerCode" => array("type" => "string"),
19 | "EndUserPIN" => array("type" => "string"),
20 | "EndUserPassword" => array("type" => "string"),
21 | "AddressLine1" => array("type" => "string"),
22 | "City" => array("type" => "string"),
23 | "State" => array("type" => "string"),
24 | "ZIPCode" => array("type" => "string"),
25 | "TypeOfService" => array("type" => "string"),
26 | "Status" => array("type" => "string")
27 | );
28 |
29 | public function __construct($data) {
30 | $this->set_data($data);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/simpleModels/CsrData.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "AccountNumber" => array("type" => "string"),
14 | "CustomerName" => array("type" => "string"),
15 | "ServiceAddress" => array("type" => "\Iris\ServiceAddress"),
16 | "WorkingTelephoneNumbersOnAccount" => array("type" => "\Iris\TelephoneNumbers")
17 | );
18 |
19 | public function __construct($data) {
20 | $this->set_data($data);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/simpleModels/CsrNote.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "UserId" => array("type" => "string"),
14 | "Description" => array("type" => "string"),
15 | "LastDateModifier" => array("type" => "string")
16 | );
17 |
18 | public function __construct($data) {
19 | $this->set_data($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/CsrNotesList.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\CsrNote")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/simpleModels/CsrResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Status" => array("type" => "string"),
14 | "AccountNumber" => array("type" => "string"),
15 | "AccountTelephoneNumber" => array("type" => "string"),
16 | "EndUserName" => array("type" => "string"),
17 | "AuthorizingUserName" => array("type" => "string"),
18 | "CustomerCode" => array("type" => "string"),
19 | "EndUserPIN" => array("type" => "string"),
20 | "EndUserPassword" => array("type" => "string"),
21 | "AddressLine1" => array("type" => "string"),
22 | "City" => array("type" => "string"),
23 | "State" => array("type" => "string"),
24 | "ZIPCode" => array("type" => "string"),
25 | "TypeOfService" => array("type" => "string"),
26 | "Errors" => array("type" => "\Iris\ErrorList"),
27 | "CustomerOrderId" => array("type" => "string"),
28 | "LastModifiedBy" => array("type" => "string"),
29 | "OrderCreateDate" => array("type" => "string"),
30 | "AccountId" => array("type" => "string"),
31 | "LastModifiedDate" => array("type" => "string"),
32 | "AccountNumber" => array("type" => "string"),
33 | "AccountTelephoneNumber" => array("type" => "string"),
34 | "EndUserName" => array("type" => "string"),
35 | "AuthorizingUserName" => array("type" => "string"),
36 | "CustomerCode" => array("type" => "string"),
37 | "EndUserPIN" => array("type" => "string"),
38 | "EndUserPassword" => array("type" => "string"),
39 | "AddressLine1" => array("type" => "string"),
40 | "City" => array("type" => "string"),
41 | "State" => array("type" => "string"),
42 | "ZIPCode" => array("type" => "string"),
43 | "TypeOfService" => array("type" => "string"),
44 | "CsrData" => array("type" => "\Iris\CsrData")
45 | );
46 |
47 | public function __construct($data) {
48 | $this->set_data($data);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/simpleModels/DateRange.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "EndDate" => array("type" => "string"),
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/DldaOrder.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\DldaTnGroup")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 |
20 | #[AllowDynamicProperties]
21 | class DldaTnGroup {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "TelephoneNumbers" => array("type" => "\Iris\Phones"),
26 | "SubscriberType" => array("type" => "string"),
27 | "ListingType" => array("type" => "string"),
28 | "ListAddress" => array("type" => "string"),
29 | "ListingName" => array("type" => "\Iris\ListingName"),
30 | "Address" => array("type" => "\Iris\ServiceAddress"),
31 | );
32 | public function __construct($data) {
33 | $this->set_data($data);
34 | }
35 | }
36 |
37 |
38 | #[AllowDynamicProperties]
39 | class ListingName {
40 | use BaseModel;
41 |
42 | protected $fields = array(
43 | "FirstName" => array("type" => "string"),
44 | "FirstName2" => array("type" => "string"),
45 | "LastName" => array("type" => "string"),
46 | "Designation" => array("type" => "string"),
47 | "TitleOfLineage" => array("type" => "string"),
48 | "TitleOfAddress" => array("type" => "string"),
49 | "TitleOfAddress2" => array("type" => "string"),
50 | "TitleOfLineageName2" => array("type" => "string"),
51 | "TitleOfAddressName2" => array("type" => "string"),
52 | "TitleOfAddress2Name2" => array("type" => "string"),
53 | "PlaceListingAs" => array("type" => "string"),
54 |
55 | );
56 | public function __construct($data) {
57 | $this->set_data($data);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/simpleModels/EmailSubscription.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "DigestRequested" => array("type" => "string"),
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/Error.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Error")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 |
20 | #[AllowDynamicProperties]
21 | class Error {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "TelephoneNumber" => array("type" => "string"),
26 | "ErrorCode" => array("type" => "string"),
27 | "Code" => array("type" => "string"),
28 | "Description" => array("type" => "string")
29 | );
30 |
31 | public function __construct($data) {
32 | $this->set_data($data);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/simpleModels/Features.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Feature"),
13 | "Lidb" => array("type" => "\Iris\Feature"),
14 | "Dlda" => array("type" => "\Iris\Feature"),
15 | );
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
21 |
22 | #[AllowDynamicProperties]
23 | class Feature {
24 | use BaseModel;
25 |
26 | protected $fields = array(
27 | "Status" => array("type" => "string"),
28 | "CallerName" => array("type" => "string"),
29 | "SubscriberType" => array("type" => "string"),
30 | "SubscriberInformation" => array("type" => "string"),
31 | "UseType" => array("type" => "string"),
32 | "Visibility" => array("type" => "string"),
33 | "ListingType" => array("type" => "string"),
34 | "ListingName" => array("type" => "\Iris\ListingName"),
35 | "ListAddress" => array("type" => "string"),
36 | "Address" => array("type" => "\Iris\ServiceAddress"),
37 |
38 | );
39 | public function __construct($data) {
40 | $this->set_data($data);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/simpleModels/FileListResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "integer"),
13 | "fileNames" => array("type" => "string"),
14 | "resultCode" => array("type" => "integer"),
15 | "resultMessage" => array("type" => "string")
16 | );
17 |
18 | public function __construct($data) {
19 | $this->set_data($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/FileMetaData.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "DocumentType" => array(
14 | "type" => "string",
15 | "validate" => array(
16 | "type" => "in_array",
17 | "value" => array(
18 | "LOA",
19 | "INVOICE",
20 | "CSR",
21 | "OTHER"
22 | )
23 | ))
24 | );
25 |
26 | public function __construct($data) {
27 | $this->set_data($data);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/simpleModels/History.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\OrderHistory")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 |
20 | #[AllowDynamicProperties]
21 | class OrderHistory {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "OrderDate" => array("type" => "string"),
26 | "Note" => array("type" => "string"),
27 | "Author" => array("type" => "string"),
28 | "Status" => array("type" => "string"),
29 | "Difference" => array("type" => "string"),
30 | );
31 | public function __construct($data) {
32 | $this->set_data($data);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnCheckerPayload.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Phones"),
13 | "ImportTnErrors" => array("type" => "\Iris\ImportTnErrors")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data, true);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnCheckerResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\ImportTnCheckerPayload"),
13 | "Errors" => array("type" => "\Iris\Error")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnError.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Phones"),
13 | "Code" => array("type" => "string"),
14 | "Description" => array("type" => "string")
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data, true);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnErrors.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\ImportTnError")
13 | );
14 |
15 | public function __construct($data) {
16 | $this->set_data($data, true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnOrder.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "OrderCreateDate" => array("type" => "string"),
14 | "AccountId" => array("type" => "string"),
15 | "CreatedByUser" => array("type" => "string"),
16 | "OrderId" => array("type" => "string"),
17 | "LastModifiedDate" => array("type" => "string"),
18 | "SiteId" => array("type" => "string"),
19 | "SipPeerId" => array("type" => "string"),
20 | "Subscriber" => array("type" => "\Iris\Subscriber"),
21 | "LoaAuthorizingPerson" => array("type" => "string"),
22 | "ProcessingStatus" => array("type" => "string"),
23 | "Errors" => array("type" => "\Iris\Error"),
24 | "TelephoneNumbers" => array("type" => "\Iris\Phones")
25 | );
26 |
27 | public function __construct($data) {
28 | $this->set_data($data);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/simpleModels/ImportTnOrderResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "integer"),
13 | "ImportTnOrder" => array("type" => "\Iris\ImportTnOrder"),
14 | "ImportTnOrderSummary" => array("type" => "\Iris\ImportTnOrder"),
15 | "Location" => array("type" => "string")
16 | );
17 |
18 | public function __construct($data) {
19 | $this->set_data($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/InserviceTns.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "TelephoneNumbers" => array("type" => "\Iris\Phones"),
14 | "Links" => array("type" => "\Iris\Links")
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data, true);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/LcaSearch.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\NPANXX"),
13 | "Location" => array("type" => "\Iris\Location"),
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
20 | #[AllowDynamicProperties]
21 | class NPANXX {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "NPANXX" => array("type" => "string"),
26 | );
27 | public function __construct($data) {
28 | $this->set_data($data);
29 | }
30 | }
31 |
32 | #[AllowDynamicProperties]
33 | class Location {
34 | use BaseModel;
35 |
36 | protected $fields = array(
37 | "RateCenters" => array("type" => "\Iris\LcaRateCenters"),
38 | );
39 | public function __construct($data) {
40 | $this->set_data($data);
41 | }
42 | }
43 |
44 | #[AllowDynamicProperties]
45 | class LcaRateCenters {
46 | use BaseModel;
47 |
48 | protected $fields = array(
49 | "State" => array("type" => "string"),
50 | "RCs" => array("type" => "string"),
51 | );
52 | public function __construct($data) {
53 | $this->set_data($data);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/simpleModels/LidbTnGroups.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\LidbTnGroups")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 |
20 | #[AllowDynamicProperties]
21 | class LidbTnGroups {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "LidbTnGroup" => array("type" => "\Iris\LidbTnGroup")
26 | );
27 | public function __construct($data) {
28 | $this->set_data($data);
29 | }
30 | }
31 |
32 |
33 | #[AllowDynamicProperties]
34 | class LidbTnGroup {
35 | use BaseModel;
36 |
37 | protected $fields = array(
38 | "TelephoneNumbers" => array("type" => "\Iris\Phones"),
39 | "SubscriberInformation" => array("type" => "string"),
40 | "UseType" => array("type" => "string"),
41 | "Visibility" => array("type" => "string"),
42 | "FullNumber" => array("type" => "string"),
43 |
44 | );
45 | public function __construct($data) {
46 | $this->set_data($data);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/simpleModels/LineOptionOrders.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\TnLineOption")
13 | );
14 |
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
20 | #[AllowDynamicProperties]
21 | class TnLineOption {
22 | use BaseModel;
23 |
24 | protected $fields = array(
25 | "TelephoneNumber" => array("type" => "string"),
26 | "CallingNameDisplay" => array("type" => "string")
27 | );
28 |
29 | public function __construct($data) {
30 | $this->set_data($data);
31 | }
32 | }
33 |
34 |
35 | #[AllowDynamicProperties]
36 | class TnLineOptionOrderResponse {
37 | use BaseModel;
38 |
39 | protected $fields = array(
40 | "LineOptions" => array("type" => "\Iris\LineOption")
41 | );
42 |
43 | public function __construct($data) {
44 | $this->set_data($data);
45 | }
46 | }
47 |
48 | #[AllowDynamicProperties]
49 | class LineOption {
50 | use BaseModel;
51 |
52 | protected $fields = array(
53 | "CompletedNumbers" => array("type" => "\Iris\TelephoneNumbers"),
54 | "Errors" => array("type" => "\Iris\Error")
55 | );
56 |
57 | public function __construct($data) {
58 | $this->set_data($data);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/simpleModels/Links.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "next" => array("type" => "string"),
14 | "last" => array("type" => "string")
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data, true);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/MessageSettings.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "CampaignFullyProvisioned" => array("type" => "string")
14 | );
15 | public function __construct($data) {
16 | $this->set_data($data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/NpaNxxXs.php:
--------------------------------------------------------------------------------
1 | array("type" => "string")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/simpleModels/NumberPortabilityRequest.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\TnList"),
13 | );
14 |
15 | public function __construct($data) {
16 | $this->set_data($data, true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/NumberPortabilityResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "PortableNumbers" => array("type" => "\Iris\TnList"),
14 | "SupportedRateCenters" => array("type" => "string"),
15 | "SupportedTollFreeNumbers" => array("type" => "string"),
16 | "UnsupportedRateCenters" => array("type" => "\Iris\RateCentersS"),
17 | "PartnerSupportedRateCenters" => array("type" => "\Iris\RateCentersS"),
18 | "SupportedLosingCarriers" => array("type" => "\Iris\SupportedLosingCarriers")
19 | );
20 |
21 | public function __construct($data) {
22 | $this->set_data($data, true);
23 | }
24 | }
25 |
26 |
27 | #[AllowDynamicProperties]
28 | class RateCentersS {
29 | use BaseModel;
30 |
31 | protected $fields = array(
32 | "RateCenterGroup" => array("type" => "\Iris\RateCenterGroup"),
33 | );
34 |
35 | public function __construct($data) {
36 | $this->set_data($data, true);
37 | }
38 | }
39 |
40 |
41 | #[AllowDynamicProperties]
42 | class RateCenterGroup {
43 | use BaseModel;
44 |
45 | protected $fields = array(
46 | "RateCenter" => array("type" => "string"),
47 | "City" => array("type" => "string"),
48 | "State" => array("type" => "string"),
49 | "LATA" => array("type" => "string"),
50 | "TnList" => array("type" => "\Iris\TnList"),
51 | "Tiers" => array("type" => "\Iris\Tiers")
52 | );
53 |
54 | public function __construct($data) {
55 | $this->set_data($data, true);
56 | }
57 | }
58 |
59 |
60 | #[AllowDynamicProperties]
61 | class SupportedLosingCarriers {
62 | use BaseModel;
63 |
64 | protected $fields = array(
65 | "LosingCarrierTnList" => array("type" => "\Iris\LosingCarrierTnList"),
66 | );
67 |
68 | public function __construct($data) {
69 | $this->set_data($data, true);
70 | }
71 | }
72 |
73 |
74 | #[AllowDynamicProperties]
75 | class LosingCarrierTnList {
76 | use BaseModel;
77 |
78 | protected $fields = array(
79 | "LosingCarrierSPID" => array("type" => "string"),
80 | "LosingCarrierName" => array("type" => "string"),
81 | "LosingCarrierIsWireless" => array("type" => "string"),
82 | "LosingCarrierAccountNumberRequired" => array("type" => "string"),
83 | "LosingCarrierMinimumPortingInterval" => array("type" => "string"),
84 | "TnList" => array("type" => "\Iris\TnList"),
85 | );
86 |
87 | public function __construct($data) {
88 | $this->set_data($data, true);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/simpleModels/OrderHistoryResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\OrderHistory"),
13 | );
14 |
15 | public function __construct($data) {
16 | $this->set_data($data, true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/OrderRequest.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\OrderRequest"),
13 | "OrderStatus" => array("type" => "string")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data, true);
18 | }
19 | }
20 |
21 |
22 | #[AllowDynamicProperties]
23 | class OrderRequest {
24 | use BaseModel;
25 |
26 | protected $fields = array(
27 | "CustomerOrderId" => array("type" => "string"),
28 | "OrderCreateDate" => array("type" => "string"),
29 | "id" => array("type" => "string"),
30 | "DisconnectTelephoneNumberOrderType" => array("type" => "string"),
31 | );
32 |
33 | public function __construct($data) {
34 | $this->set_data($data, true);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/simpleModels/OrderResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "CreatedByUser" => array("type" => "string"),
14 | "ErrorList" => array("type" => "\Iris\ErrorList"),
15 | "FailedNumbers" => array("type" => "\Iris\Phones"),
16 | "LastModifiedDate" => array("type" => "string"),
17 | "OrderCompleteDate" => array("type" => "string"),
18 | "OrderStatus" => array("type" => "string"),
19 | "CompletedNumbers" => array("type" => "\Iris\Phones"),
20 | "FailedQuantity" => array("type" => "string")
21 | );
22 |
23 | public function __construct($data) {
24 | $this->set_data($data, true);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/simpleModels/OriginationRoutePlan.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Route" => array("type" => "\Iris\Route"),
14 | "Action" => array("type" => "string"),
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/Phones.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "TelephoneNumber" => array("type" => "string"),
14 | "FullNumber" => array("type" => "string"),
15 | "Count" => array("type" => "string")
16 | );
17 |
18 | public function __construct($data) {
19 | $this->set_data($data, true);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/RemoveImportedTnOrder.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "OrderCreateDate" => array("type" => "string"),
14 | "AccountId" => array("type" => "string"),
15 | "CreatedByUser" => array("type" => "string"),
16 | "OrderId" => array("type" => "string"),
17 | "LastModifiedDate" => array("type" => "string"),
18 | "ProcessingStatus" => array("type" => "string"),
19 | "Errors" => array("type" => "\Iris\Error"),
20 | "TelephoneNumbers" => array("type" => "\Iris\Phones")
21 | );
22 |
23 | public function __construct($data) {
24 | $this->set_data($data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/simpleModels/RemoveImportedTnOrderResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\RemoveImportedTnOrder"),
13 | "Location" => array("type" => "string")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/RemoveImportedTnOrderSummary.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "CountOfTNs" => array("type" => "integer"),
14 | "CustomerOrderId" => array("type" => "string"),
15 | "userId" => array("type" => "string"),
16 | "lastModifiedDate" => array("type" => "string"),
17 | "OrderDate" => array("type" => "string"),
18 | "OrderType" => array("type" => "string"),
19 | "OrderStatus" => array("type" => "string"),
20 | "OrderId" => array("type" => "string")
21 | );
22 |
23 | public function __construct($data) {
24 | $this->set_data($data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/simpleModels/RemoveImportedTnOrderSummaryResponse.php:
--------------------------------------------------------------------------------
1 | array("type" => "integer"),
13 | "RemoveImportedTnOrderSummary" => array("type" => "\Iris\RemoveImportedTnOrderSummary")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/Roles.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\Role"),
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 | #[AllowDynamicProperties]
20 | class Role {
21 | use BaseModel;
22 |
23 | protected $fields = array(
24 | "RoleName" => array("type" => "string"),
25 | "Permissions" => array("type" => "\Iris\Permissions"),
26 | );
27 | public function __construct($data) {
28 | $this->set_data($data);
29 | }
30 | }
31 |
32 | #[AllowDynamicProperties]
33 | class Permissions {
34 | use BaseModel;
35 |
36 | protected $fields = array(
37 | "Permission" => array("type" => "\Iris\Permission"),
38 | );
39 | public function __construct($data) {
40 | $this->set_data($data);
41 | }
42 | }
43 |
44 | #[AllowDynamicProperties]
45 | class Permission {
46 | use BaseModel;
47 |
48 | protected $fields = array(
49 | "PermissionName" => array("type" => "string"),
50 | );
51 | public function __construct($data) {
52 | $this->set_data($data);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/simpleModels/Route.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Priority" => array("type" => "int"),
14 | "Weight" => array("type" => "int"),
15 | "EndpointType" => array("type" => "string"),
16 | );
17 |
18 | public function __construct($data) {
19 | $this->set_data($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/simpleModels/SearchOrderType.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "EnableTNDetail" => array("type" => "string"),
14 | "EnableLCA" => array("type" => "string"),
15 | "RateCenter" => array("type" => "string"),
16 | "State" => array("type" => "string"),
17 | "City" => array("type" => "string"),
18 | "AreaCode" => array("type" => "string"),
19 | "TollFreeVanity" => array("type" => "string"),
20 | "Quantity" => array("type" => "string"),
21 | "TollFreeWildCardPattern" => array("type" => "string"),
22 | "Zip" => array("type" => "string"),
23 | "Lata" => array("type" => "string"),
24 | );
25 | public function __construct($data) {
26 | $this->set_data($data);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/simpleModels/ServiceAddress.php:
--------------------------------------------------------------------------------
1 | array("type" => "string", "required" => true),
13 | "HouseNumber" => array("type" => "string", "required" => true),
14 | "StreetName" => array("type" => "string", "required" => true),
15 | "StateCode" => array("type" => "string", "required" => true),
16 | "State" => array("type" => "string"),
17 | "Zip" => array("type" => "string"),
18 | "Country" => array("type" => "string"),
19 | "County" => array("type" => "string"),
20 | "HousePrefix" => array("type" => "string"),
21 | "HouseSuffix" => array("type" => "string"),
22 | "PreDirectional" => array("type" => "string"),
23 | "StreetSuffix" => array("type" => "string"),
24 | "PostDirectional" => array("type" => "string"),
25 | "AddressLine2" => array("type" => "string"),
26 | "PlusFour" => array("type" => "string"),
27 | "AddressType" => array("type" => "string"),
28 | // Note that UnparsedAddress is Read-Only. Additionally, UnparsedAddress cannot be used to automatically populate the ServiceAddress fields with the correct information.
29 | "UnparsedAddress" => array("type" => "string")
30 | );
31 |
32 | public function __construct($data) {
33 | $this->set_data($data);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/simpleModels/SipPeerTelephoneNumber.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "CallForward" => array("type" => "string"),
14 | "NumberFormat" => array("type" => "string"),
15 | "RPIDFormat" => array("type" => "string"),
16 | "RewriteUser" => array("type" => "string"),
17 | "MessagingSettings" => array("type" => "\Iris\MessageSettings")
18 | );
19 |
20 | public function __construct($data) {
21 | $this->set_data($data, true);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/simpleModels/Status.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "Description" => array("type" => "string"),
14 | "Status" => array("type" => "string"),
15 | );
16 |
17 | public function __construct($data) {
18 | $this->set_data($data);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/simpleModels/Subscriber.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "BusinessName" => array("type" => "string"),
14 | "ServiceAddress" => array("type" => "\Iris\ServiceAddress"),
15 | "FirstName" => array("type" => "string"),
16 | "LastName" => array("type" => "string"),
17 | "MiddleInitial" => array("type" => "string"),
18 | "Name" => array("type" => "string")
19 | );
20 |
21 | public function __construct($data) {
22 | $this->set_data($data);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/simpleModels/TelephoneNumberDetail.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "LATA" => array("type" => "string"),
14 | "Lata" => array("type" => "string"),
15 | "RateCenter" => array("type" => "string"),
16 | "State" => array("type" => "string"),
17 | "FullNumber" =>array("type" => "string"),
18 | "Tier" =>array("type" => "string"),
19 | "VendorId" =>array("type" => "string"),
20 | "VendorName" =>array("type" => "string"),
21 | "Status" =>array("type" => "string"),
22 | "AccountId" =>array("type" => "string"),
23 | "LastModified" =>array("type" => "string"),
24 | );
25 |
26 | public function __construct($data) {
27 | $this->set_data($data, true);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/simpleModels/TelephoneNumberList.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\TelephoneNumbers"),
"ReservationIdList" => array("type" => "\Iris\ReservationId"),
"DisconnectMode" => array("type" => "string"),
);
public function __construct($data) {
$this->set_data($data, true);
}
}
#[AllowDynamicProperties]
class TelephoneNumbers {
use BaseModel;
protected $fields = array(
"TelephoneNumber" => array("type" => "string")
);
public function __construct($data) {
$this->set_data($data, true);
}
}
#[AllowDynamicProperties]
class ReservationId {
use BaseModel;
protected $fields = array(
"ReservationId" => array("type" => "string")
);
public function __construct($data) {
$this->set_data($data, true);
}
}
--------------------------------------------------------------------------------
/src/simpleModels/Tiers.php:
--------------------------------------------------------------------------------
1 | array("type" => "string")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/simpleModels/TnAttributes.php:
--------------------------------------------------------------------------------
1 | array("type" => "string")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/simpleModels/TnList.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | );
14 |
15 | public function __construct($data) {
16 | $this->set_data($data, true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/simpleModels/TnOptionGroups.php:
--------------------------------------------------------------------------------
1 | array("type" => "\Iris\TnOptionGroup")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
19 | #[AllowDynamicProperties]
20 | class TnOptionGroup {
21 | use BaseModel;
22 |
23 | protected $fields = array(
24 | "TelephoneNumbers" => array("type" => "\Iris\Phones"),
25 | "NumberFormat" => array("type" => "string"),
26 | "RPIDFormat" => array("type" => "string"),
27 | "RewriteUser" => array("type" => "string"),
28 | "CallForward" => array("type" => "string"),
29 | "CallingNameDisplay" => array("type" => "string"),
30 | "Protected" => array("type" => "string"),
31 | "Sms" => array("type" => "string"),
32 | "FinalDestinationURI " => array("type" => "string"),
33 | "PortOutPasscode" => array("type" => "string"),
34 | "NNID" => array("type" => "string"),
35 | "ESPID" => array("type" => "string"),
36 | "A2pSettings" => array("type" => "\Iris\A2pSettings"),
37 | "OriginationRoutePlan" => array("type" => "\Iris\OriginationRoutePlan"),
38 | "PindropEnabled" => array("type" => "string")
39 | );
40 | public function __construct($data) {
41 | $this->set_data($data);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/simpleModels/WirelessInfo.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
13 | "PinNumber" => array("type" => "string")
14 | );
15 |
16 | public function __construct($data) {
17 | $this->set_data($data);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/simpleModels/ZipCodes.php:
--------------------------------------------------------------------------------
1 | array("type" => "string")
13 | );
14 | public function __construct($data) {
15 | $this->set_data($data);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/BadCredsTest.php:
--------------------------------------------------------------------------------
1 | push($history);
23 |
24 | self::$client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
25 | }
26 |
27 | /**
28 | * @expectedException Iris\ResponseException
29 | * @expectedExceptionMessageRegExp #^.*resulted in a.*$#
30 | * @expectedExceptionCode 401
31 | */
32 | public function testAuthFail() {
33 | $this->expectException(Iris\ResponseException::class);
34 | $c = new \Iris\Cities(self::$client);
35 | try {
36 | $cities = $c->getList(["state" => "NC"]);
37 | } catch (ClientException $e) {
38 | $this->assertTrue(!empty($e->getMessage()));
39 | throw $e;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/tests/BaseModelTest.php:
--------------------------------------------------------------------------------
1 | array("type" => "string"),
"Status" => array("type" => "\Iris\Status")
);
public function __construct($data) {
$this->set_data($data);
}
}
#[AllowDynamicProperties]
class ArrModel {
use \Iris\BaseModel;
protected $fields = array(
"Item" => array("type" => "ItemModel")
);
public function __construct($data) {
$this->set_data($data);
}
}
#[AllowDynamicProperties]
class ItemModel {
use \Iris\BaseModel;
protected $fields = array(
"Phone" => array("type" => "string")
);
public function __construct($data) {
$this->set_data($data);
}
}
#[AllowDynamicProperties]
class BaseModelTest extends TestCase {
public function setUp(): void {
}
public function testContent() {
$this->model = new Model(array("Id" => "123", "Status" => array("Code" => "0", "Description" => "Empty")));
$this->assertEquals("123", $this->model->Id);
$this->assertEquals("0", $this->model->Status->Code);
$this->model->set_data(array("Id" => "222", "Status" => array("Code" => "200", "Description" => "Hello")));
$this->assertEquals("222", $this->model->Id);
$this->assertEquals("200", $this->model->Status->Code);
}
public function testArray() {
$this->arrModel = new ArrModel(["Item" => [ ["Phone" => "1"], ["Phone" => "2"] ]]);
$this->assertEquals("1", $this->arrModel->Item[0]->Phone);
$arr = $this->arrModel->to_array();
$this->assertEquals("1", $arr["Item"][0]["Phone"]);
}
}
--------------------------------------------------------------------------------
/tests/CoveredRateCentersTest.php:
--------------------------------------------------------------------------------
1 | 18 Link=<https://dashboard.bandwidth.com/api/coveredRateCenters?npa=310&size=10&e mbed=Cities&embed=ZipCodes&embed=NpaNxxX&page=1>;rel=\"first\";Link=<https://dashboard.bandwidth.com/api/coveredRateCenters?npa=310&size=10&e mbed=Cities&embed=ZipCodes&embed=NpaNxxX& page=5>;rel=\"next\"; AVALONAVALON CA730 1 90731 SAN PEDRO 0 3105100 3105101 3109498 3109499 42422601 BEVERLY HILLS BEVERLYHLS CA73025 90013 90014 900159150491505 BEVERLY HILLS BURBANK GARDENA LOS ANGELES SHERMAN OAKS SUN VALLEY VAN NUYS 0 3102010310201131020124247777 4247778 42477793 "),
17 | new Response(200, [], " AVALONAVALON CA730 1 90731 SAN PEDRO 0 3105100 3105101 3109498 3109499 42422601 "),
18 | ]);
19 |
20 | self::$container = [];
21 | $history = Middleware::history(self::$container);
22 | $handler = HandlerStack::create($mock);
23 | $handler->push($history);
24 |
25 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
26 | self::$rcs = new Iris\CoveredRateCenters($client);
27 | }
28 |
29 | public function testTnsGet() {
30 | $rcs = self::$rcs->getList(["page" => 1, "size" => 10 ]);
31 |
32 | $this->assertEquals(2, count($rcs));
33 |
34 | $json = '{"Name":"AVALON","Abbreviation":"AVALON","State":"CA","Lata":"730","AvailableNumberCount":"1","ZipCodes":{"ZipCode":"90731"},"Cities":{"City":"SAN PEDRO"},"Tiers":{"Tier":"0"},"NpaNxxXs":{"NpaNxxX":["3105100","3105101","3109498","3109499","4242260"]},"Id":"1"}';
35 | $this->assertEquals($json, json_encode($rcs[0]->to_array()));
36 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
37 | $this->assertEquals("https://api.test.inetwork.com/v1.0/coveredRateCenters?page=1&size=10", self::$container[self::$index]['request']->getUri());
38 | self::$index++;
39 | }
40 | public function testTnGet() {
41 | $rc = self::$rcs->covered_rate_center("1");
42 |
43 | $json = '{"Name":"AVALON","Abbreviation":"AVALON","State":"CA","Lata":"730","AvailableNumberCount":"1","ZipCodes":{"ZipCode":"90731"},"Cities":{"City":"SAN PEDRO"},"Tiers":{"Tier":"0"},"NpaNxxXs":{"NpaNxxX":["3105100","3105101","3109498","3109499","4242260"]},"Id":"1"}';
44 | $this->assertEquals($json, json_encode($rc->to_array()));
45 |
46 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
47 | $this->assertEquals("https://api.test.inetwork.com/v1.0/coveredRateCenters/1", self::$container[self::$index]['request']->getUri());
48 | self::$index++;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/tests/DisconnectsTest.php:
--------------------------------------------------------------------------------
1 | Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal RECEIVED"),
new Response(200, [], "71smckinnon2014-01-10T17-34-15Z6d7da966-e071-4741-b31c-1d8932f4b8dadisconnect2014-01-10T17-34-15.797ZCOMPLETE 1jbm2013-12-04T21-59-32Z4ffe9262-1965-4479-a1d5-b8584440667ddisconnect2013-12-04T21-59-32.243ZCOMPLETE"),
new Response(200, [], " 5006
Telephone number could not be disconnected since it is not associated with your account 9192755703 5006
Telephone number could not be disconnected since it is not associated with your account 9192755378 Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal FAILED"),
]);
self::$container = [];
$history = Middleware::history(self::$container);
$handler = HandlerStack::create($mock);
$handler->push($history);
$client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
$account = new Iris\Account(9500249, $client);
self::$disconnects = $account->disconnects();
}
public function testDisconnectCreate() {
$disconnect = self::$disconnects->create(array(
"name" => "test disconnect order 4",
"CustomerOrderId" => "Disconnect1234",
"DisconnectTelephoneNumberOrderType" => array(
"TelephoneNumberList" => array(
"TelephoneNumber" => array("9192755378", "9192755703")
)
)
));
$json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","OrderStatus":{"orderRequest":{"CustomerOrderId":"Disconnect1234","OrderCreateDate":"2015-06-17T18:14:08.683Z","id":"b902dee1-0585-4258-becd-5c7e51ccf5e1","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"}},"OrderStatus":"RECEIVED"},"name":"test disconnect order 4","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}';
$this->assertEquals($json, json_encode($disconnect->to_array()));
$this->assertEquals("RECEIVED", $disconnect->OrderStatus->OrderStatus);
$this->assertEquals("b902dee1-0585-4258-becd-5c7e51ccf5e1", $disconnect->OrderId);
$this->assertEquals("POST", self::$container[self::$index]['request']->getMethod());
$this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects", self::$container[self::$index]['request']->getUri());
self::$index++;
}
public function testDisconnectsGet() {
$disconnects = self::$disconnects->getList();
$json = '{"CountOfTNs":"1","userId":"smckinnon","lastModifiedDate":"2014-01-10T17-34-15Z","OrderId":"6d7da966-e071-4741-b31c-1d8932f4b8da","OrderType":"disconnect","OrderDate":"2014-01-10T17-34-15.797Z","OrderStatus":"COMPLETE"}';
$this->assertEquals(2, count($disconnects));
$this->assertEquals($json, json_encode($disconnects[0]->to_array()));
$this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
$this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects?page=1&size=30", self::$container[self::$index]['request']->getUri());
self::$index++;
}
public function testDisconnectGet() {
$disconnect = self::$disconnects->create(["OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"], false);
$response = $disconnect->get(true);
$json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}';
$this->assertEquals($json, json_encode($disconnect->to_array()));
$json1 = '{"ErrorList":{"Error":[{"TelephoneNumber":"9192755703","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"},{"TelephoneNumber":"9192755378","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"}]},"OrderStatus":"FAILED"}';
$this->assertEquals($json1, json_encode($response->to_array()));
$this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
$this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1?tndetail=true", self::$container[self::$index]['request']->getUri());
self::$index++;
}
}
--------------------------------------------------------------------------------
/tests/LidbsTest.php:
--------------------------------------------------------------------------------
1 | 2122999999902014-02-25T16:02:43.195Zlidb2014-02-25T16:02:43.195Zabe36738-6929-4c6f-926c-88e534e2d46fFAILEDteam_ua999999902014-02-25T16:02:39.021Zlidb2014-02-25T16:02:39.021Zba5b6297-139b-4430-aab0-9ff02c4362f4FAILEDteam_ua"),
17 | new Response(200, [], "testCustomerOrderId255bda29-fc57-44e8-a6c2-59b45388c6d0 2014-05-28T14:46:21.724ZRECEIVEDjbm2014-02-20T19:33:17.600Z2014-02-20T19:33:17.600Z40822133118042105618FredBUSINESSPRIVATE408221285040822133108042105760FredRESIDENTIALPUBLIC"),
18 | new Response(200, [], " 2015-06-21T04:52:33.191Z 9500249 byo_dev 7802373f-4f52-4387-bdd1-c5b74833d6e2 2015-06-21T04:52:33.191Z 11014
Number does not belong to this account 4352154856 11014
Number does not belong to this account 4352154855 FAILED 4352154856 Steve RESIDENTIAL PUBLIC 4352154855 Steve RESIDENTIAL PUBLIC "),
19 | ]);
20 |
21 | self::$container = [];
22 | $history = Middleware::history(self::$container);
23 | $handler = HandlerStack::create($mock);
24 | $handler->push($history);
25 |
26 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
27 | $account = new Iris\Account(9500249, $client);
28 | self::$lidbs = $account->lidbs();
29 | }
30 |
31 | public function testLidbsGet() {
32 | $lidbs = self::$lidbs->getList(["lastModifiedAfter" => "yy-mm-dd", "telephoneNumber"=> "888"]);
33 |
34 | $json = '{"orderId":"abe36738-6929-4c6f-926c-88e534e2d46f","accountId":"9999999","CountOfTNs":"0","userId":"team_ua","lastModifiedDate":"2014-02-25T16:02:43.195Z","OrderType":"lidb","OrderDate":"2014-02-25T16:02:43.195Z","OrderStatus":"FAILED"}';
35 | $this->assertEquals($json, json_encode($lidbs[0]->to_array()));
36 |
37 | $this->assertEquals("abe36738-6929-4c6f-926c-88e534e2d46f", $lidbs[0]->get_id());
38 | $this->assertEquals("2", count($lidbs));
39 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
40 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/lidbs?lastModifiedAfter=yy-mm-dd&telephoneNumber=888", self::$container[self::$index]['request']->getUri());
41 | self::$index++;
42 | }
43 |
44 | public function testLidbsPost() {
45 | $order_data = [
46 | "LidbTnGroups" => [
47 | "LidbTnGroup" => [
48 | [
49 | "TelephoneNumbers" => [
50 | "TelephoneNumber" => "4352154856"
51 | ],
52 | "SubscriberInformation" => "Steve",
53 | "UseType" => "RESIDENTIAL",
54 | "Visibility" => "PUBLIC"
55 | ],
56 | [
57 | "TelephoneNumbers" => [
58 | "TelephoneNumber" => "4352154855"
59 | ],
60 | "SubscriberInformation" => "Steve",
61 | "UseType" => "RESIDENTIAL",
62 | "Visibility" => "PUBLIC"
63 | ]
64 | ]
65 | ]
66 | ];
67 |
68 | $lidb = self::$lidbs->create($order_data, false);
69 | $json = '{"LidbTnGroups":{"LidbTnGroup":[{"TelephoneNumbers":{"TelephoneNumber":"4352154856"},"SubscriberInformation":"Steve","UseType":"RESIDENTIAL","Visibility":"PUBLIC"},{"TelephoneNumbers":{"TelephoneNumber":"4352154855"},"SubscriberInformation":"Steve","UseType":"RESIDENTIAL","Visibility":"PUBLIC"}]}}';
70 | $this->assertEquals($json, json_encode($lidb->to_array()));
71 |
72 |
73 | $lidb = self::$lidbs->create($order_data);
74 |
75 | $json = '{"CustomerOrderId":"testCustomerOrderId","orderId":"255bda29-fc57-44e8-a6c2-59b45388c6d0","LastModifiedDate":"2014-02-20T19:33:17.600Z","OrderCreateDate":"2014-05-28T14:46:21.724Z","ProcessingStatus":"RECEIVED","CreatedByUser":"jbm","OrderCompleteDate":"2014-02-20T19:33:17.600Z","LidbTnGroups":{"LidbTnGroup":[{"TelephoneNumbers":{"TelephoneNumber":"4082213311"},"SubscriberInformation":"Fred","UseType":"BUSINESS","Visibility":"PRIVATE","FullNumber":"8042105618"},{"TelephoneNumbers":{"TelephoneNumber":["4082212850","4082213310"]},"SubscriberInformation":"Fred","UseType":"RESIDENTIAL","Visibility":"PUBLIC","FullNumber":"8042105760"}]}}';
76 | $this->assertEquals($json, json_encode($lidb->to_array()));
77 |
78 | $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod());
79 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/lidbs", self::$container[self::$index]['request']->getUri());
80 | self::$index++;
81 | }
82 |
83 | public function testLidbGet() {
84 | $lidb = self::$lidbs->lidb("7802373f-4f52-4387-bdd1-c5b74833d6e2");
85 |
86 | $json = '{"orderId":"7802373f-4f52-4387-bdd1-c5b74833d6e2","AccountId":"9500249","LastModifiedDate":"2015-06-21T04:52:33.191Z","OrderCreateDate":"2015-06-21T04:52:33.191Z","ProcessingStatus":"FAILED","CreatedByUser":"byo_dev","ErrorList":{"Error":[{"TelephoneNumber":"4352154856","Code":"11014","Description":"Number does not belong to this account"},{"TelephoneNumber":"4352154855","Code":"11014","Description":"Number does not belong to this account"}]},"LidbTnGroups":{"LidbTnGroup":[{"TelephoneNumbers":{"TelephoneNumber":"4352154856"},"SubscriberInformation":"Steve","UseType":"RESIDENTIAL","Visibility":"PUBLIC"},{"TelephoneNumbers":{"TelephoneNumber":"4352154855"},"SubscriberInformation":"Steve","UseType":"RESIDENTIAL","Visibility":"PUBLIC"}]}}';
87 | $this->assertEquals($json, json_encode($lidb->to_array()));
88 |
89 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
90 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/lidbs/7802373f-4f52-4387-bdd1-c5b74833d6e2", self::$container[self::$index]['request']->getUri());
91 | self::$index++;
92 | }
93 |
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/tests/NotesReferencesTest.php:
--------------------------------------------------------------------------------
1 | 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "),
18 | new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "),
19 | new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "),
20 | new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "),
21 | ]);
22 |
23 | self::$container = [];
24 | $history = Middleware::history(self::$container);
25 | $handler = HandlerStack::create($mock);
26 | $handler->push($history);
27 |
28 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
29 | self::$account = new Iris\Account(9500249, $client);
30 | }
31 |
32 | public function testNotesDisconnects() {
33 | self::$account->disconnects()->create(array("OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"), false)->notes()->getList();
34 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
35 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
36 | self::$index++;
37 | }
38 |
39 | public function testNotesOrders() {
40 | self::$account->orders()->create(array("orderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"), false)->notes()->getList();
41 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
42 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/orders/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
43 | self::$index++;
44 | }
45 |
46 | public function testNotesPortins() {
47 | self::$account->portins()->create(array("OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"), false)->notes()->getList();
48 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
49 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/portins/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
50 | self::$index++;
51 | }
52 | public function testNotesPortouts() {
53 | self::$account->portouts()->create(array("OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"), false)->notes()->getList();
54 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
55 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/portouts/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
56 | self::$index++;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/tests/NotesTest.php:
--------------------------------------------------------------------------------
1 | 'https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes/123']),
18 | new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "),
19 | new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z ")
20 | ]);
21 |
22 | self::$container = [];
23 | $history = Middleware::history(self::$container);
24 | $handler = HandlerStack::create($mock);
25 | $handler->push($history);
26 |
27 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
28 | $account = new Iris\Account(9500249, $client);
29 | self::$notes = $account->disconnects()->create(array("OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"), false)->notes();
30 | }
31 |
32 | public function testNoteCreate() {
33 | $note = self::$notes->create(array(
34 | "UserId" => "byo_dev",
35 | "Description" => "Test Note"
36 | ));
37 |
38 | $this->assertEquals("123", $note->Id);
39 | $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod());
40 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
41 | self::$index++;
42 | }
43 |
44 | public function testNotesGet() {
45 | $notes = self::$notes->getList();
46 |
47 | $this->assertEquals(1, count($notes));
48 | $this->assertEquals("11425", $notes[0]->Id);
49 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
50 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes", self::$container[self::$index]['request']->getUri());
51 | self::$index++;
52 | }
53 |
54 | public function testNotesGetTwoItems() {
55 | $notes = self::$notes->getList();
56 |
57 | $this->assertEquals(2, count($notes));
58 | $this->assertEquals("11425", $notes[0]->Id);
59 | self::$index++;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/tests/OtherTest.php:
--------------------------------------------------------------------------------
1 | 618 PINEHURST ABERDEEN JULIAN ADVANCE "),
17 | new Response(200, [], " 652 AGOURA AGOURA ALAMITOS ALAMITOS "),
18 | ]);
19 |
20 | self::$container = [];
21 | $history = Middleware::history(self::$container);
22 | $handler = HandlerStack::create($mock);
23 | $handler->push($history);
24 |
25 | self::$client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
26 | }
27 |
28 | public function testCitiesGet() {
29 | $c = new \Iris\Cities(self::$client);
30 | $cities = $c->getList(["state" => "NC"]);
31 |
32 | $json = '{"RcAbbreviation":"PINEHURST","Name":"ABERDEEN"}';
33 | $this->assertEquals($json, json_encode($cities[0]->to_array()));
34 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
35 | $this->assertEquals("https://api.test.inetwork.com/v1.0/cities?state=NC", self::$container[self::$index]['request']->getUri());
36 | self::$index++;
37 | }
38 |
39 | public function testRC() {
40 | $c = new \Iris\RateCenter(self::$client);
41 | $cities = $c->getList(["state" => "CA"]);
42 |
43 | $json = '{"Name":"AGOURA","Abbreviation":"AGOURA"}';
44 | $this->assertEquals($json, json_encode($cities[0]->to_array()));
45 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
46 | $this->assertEquals("https://api.test.inetwork.com/v1.0/rateCenters?state=CA", self::$container[self::$index]['request']->getUri());
47 | self::$index++;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/tests/PortoutsTest.php:
--------------------------------------------------------------------------------
1 | push($history);
23 | //
24 | // $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
25 | // $account = new Iris\Account(9500249, $client);
26 | // self::$portouts = $account->portouts();
27 | // }
28 | // public function testPortoutsGet() {
29 | // $portouts = self::$portouts->get(["status" => "x" ]);
30 | //
31 | // $this->assertEquals(2, count($portouts));
32 | // $json = '{"CountOfTNs":"1","lastModifiedDate":"2015-06-03T15:06:36.234Z","OrderDate":"2015-06-03T15:06:35.533Z","OrderType":"port_in","LNPLosingCarrierId":"1537","LNPLosingCarrierName":"Test Losing Carrier L3","RequestedFOCDate":"2015-06-03T15:30:00.000Z","VendorId":"49","VendorName":"Bandwidth CLEC","PON":"BWC1433343996123","OrderId":"535ba91e-5363-474e-8c97-c374a4aa6a02","ProcessingStatus":"SUBMITTED","userId":"System","BillingTelephoneNumber":"9193491234"}';
33 | // $this->assertEquals($json, json_encode($portouts[0]->to_array()));
34 | // $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
35 | // $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/portouts?status=x&page=1&size=30", self::$container[self::$index]['request']->getUri());
36 | // self::$index++;
37 | // }
38 | // }
39 |
--------------------------------------------------------------------------------
/tests/ReportsTest.php:
--------------------------------------------------------------------------------
1 | Sample Report 1100020Sample Report 1 DescriptionSample Report 2100021Sample Report 2 Description'),
19 | //GET report by id
20 | new Response(200, [], '123Sample Report 1Report Parameter 1EnumfalseValue1Value1Display Value1Report Parameter 1 DescriptiontrueReport Parameter 1 Help TextReport Parameter 2'),
21 | //GET instances for report
22 | new Response(200, [], '100090100020Sample Reportpdfjbm2015-05-18 14:03:04AccountId2Expired100090100020Sample Reportpdfjbm2015-05-18 14:03:04AccountId1Expired'),
23 |
24 | //POST update report instance
25 | new Response(200, [], ''),
26 | ]);
27 |
28 | self::$container = [];
29 | $history = Middleware::history(self::$container);
30 | $handler = HandlerStack::create($mock);
31 | $handler->push($history);
32 |
33 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
34 | $account = new Iris\Account(9500249, $client);
35 | self::$reports = $account->reports();
36 | }
37 |
38 | public function testReportsGet() {
39 | $report = self::$reports->getList()[0];
40 | $this->assertEquals("Sample Report 1 Description", $report->Description);
41 | $this->assertEquals("Sample Report 1", $report->Name);
42 | $this->assertEquals("100020", $report->Id);
43 | }
44 |
45 | public function testReportsGetIdAndInstances() {
46 | $report = self::$reports->get_by_id("123");
47 | $this->assertEquals("123", $report->Id);
48 | $this->assertEquals("Sample Report 1", $report->Name);
49 | $this->assertEquals("Report Parameter 1", $report->Parameters->Parameter[0]->Name);
50 |
51 | $instance = $report->instances()[0];
52 | $this->assertEquals("100090", $instance->Id);
53 | $this->assertEquals("Sample Report", $instance->ReportName);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/tests/SubscriptionsNew.php:
--------------------------------------------------------------------------------
1 | 'https://test.com'));
12 | $account = new Iris\Account(9500249, $client);
13 | self::$subscriptions = $account->subscriptions();
14 | }
15 |
16 | public function testSubsCreate() {
17 | $subscription = self::$subscriptions->create([
18 | "OrderType" => "portins",
19 | "OrderId" => "98939562-90b0-40e9-8335-5526432d9741",
20 | "EmailSubscription" => [
21 | "Email" => "test@test.com",
22 | "DigestRequested" => "DAILY"
23 | ],
24 | "CallbackCredentials" => [
25 | "BasicAuthentication" => [
26 | "Username" => "username",
27 | "Password" => "password"
28 | ]
29 | ],
30 | "PublicKey" => "testkey"
31 | ], false);
32 |
33 | $json = '{"OrderType":"portins","OrderId":"98939562-90b0-40e9-8335-5526432d9741","EmailSubscription":{"Email":"test@test.com","DigestRequested":"DAILY"},"CallbackCredentials":{"BasicAuthentication":{"Username":"username","Password":"password"}},"PublicKey":"testkey"}';
34 | $this->assertEquals($json, json_encode($subscription->to_array()));
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/tests/SubscriptionsTest.php:
--------------------------------------------------------------------------------
1 | 'https://api.test.inetwork.com:443/v1.0/accounts/9500249/sunscriptions/2489']),
17 | new Response(200, [], "1orders8684b1c8-7d41-4877-bfc2-6bd8ea4dc89ftest@testNONE"),
18 | new Response(200, [], " 1c59e661-8c90-4cb5-aab1-00547ea45ecb portins 98939562-90b0-40e9-8335-5526432d9741 test@test.com DAILY "),
19 | new Response(200),
20 | new Response(200),
21 | ]);
22 |
23 | self::$container = [];
24 | $history = Middleware::history(self::$container);
25 | $handler = HandlerStack::create($mock);
26 | $handler->push($history);
27 |
28 | $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
29 | $account = new Iris\Account(9500249, $client);
30 | self::$subscriptions = $account->subscriptions();
31 | }
32 |
33 | public function testSubsCreate() {
34 | $subscription = self::$subscriptions->create([
35 | "OrderType" => "portins",
36 | "OrderId" => "98939562-90b0-40e9-8335-5526432d9741",
37 | "EmailSubscription" => [
38 | "Email" => "test@test.com",
39 | "DigestRequested" => "DAILY"
40 | ]
41 | ], false);
42 |
43 | $json = '{"OrderType":"portins","OrderId":"98939562-90b0-40e9-8335-5526432d9741","EmailSubscription":{"Email":"test@test.com","DigestRequested":"DAILY"}}';
44 | $this->assertEquals($json, json_encode($subscription->to_array()));
45 |
46 | $subscription = self::$subscriptions->create([
47 | "OrderType" => "portins",
48 | "OrderId" => "98939562-90b0-40e9-8335-5526432d9741",
49 | "EmailSubscription" => [
50 | "Email" => "test@test.com",
51 | "DigestRequested" => "DAILY"
52 | ]
53 | ]);
54 |
55 | $this->assertEquals("2489", $subscription->get_id());
56 | $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod());
57 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/subscriptions", self::$container[self::$index]['request']->getUri());
58 | self::$index++;
59 | }
60 |
61 | public function testSubsGet() {
62 | $subscriptions = self::$subscriptions->getList(["orderType" => "portins"]);
63 |
64 | $this->assertEquals(1, count($subscriptions));
65 | $this->assertEquals(1, $subscriptions[0]->get_id());
66 | $this->assertEquals("8684b1c8-7d41-4877-bfc2-6bd8ea4dc89f", $subscriptions[0]->OrderId);
67 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
68 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/subscriptions?orderType=portins", self::$container[self::$index]['request']->getUri());
69 | self::$index++;
70 | }
71 |
72 | public function testSubGet() {
73 | $subscriptions = self::$subscriptions->subscription("1");
74 |
75 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
76 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/subscriptions/1", self::$container[self::$index]['request']->getUri());
77 | self::$index++;
78 | }
79 |
80 | public function testSubPut() {
81 | $subscription = self::$subscriptions->create([
82 | "SubscriptionId" => "1c59e661-8c90-4cb5-aab1-00547ea45ecb",
83 | "OrderType" => "portins",
84 | "OrderId" => "98939562-90b0-40e9-8335-5526432d9741",
85 | "EmailSubscription" => [
86 | "Email" => "test@test.com",
87 | "DigestRequested" => "DAILY"
88 | ]
89 | ], false);
90 |
91 | $json = '{"SubscriptionId":"1c59e661-8c90-4cb5-aab1-00547ea45ecb","OrderType":"portins","OrderId":"98939562-90b0-40e9-8335-5526432d9741","EmailSubscription":{"Email":"test@test.com","DigestRequested":"DAILY"}}';
92 | $this->assertEquals($json, json_encode($subscription->to_array()));
93 |
94 | $subscription->update();
95 |
96 | $this->assertEquals("PUT", self::$container[self::$index]['request']->getMethod());
97 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/subscriptions/1c59e661-8c90-4cb5-aab1-00547ea45ecb", self::$container[self::$index]['request']->getUri());
98 | self::$index++;
99 |
100 | }
101 | public function testSubDelete() {
102 | $subscription = self::$subscriptions->create([
103 | "SubscriptionId" => "1c59e661-8c90-4cb5-aab1-00547ea45ecb"
104 | ], false);
105 |
106 | $subscription->delete();
107 |
108 | $this->assertEquals("DELETE", self::$container[self::$index]['request']->getMethod());
109 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/subscriptions/1c59e661-8c90-4cb5-aab1-00547ea45ecb", self::$container[self::$index]['request']->getUri());
110 | self::$index++;
111 |
112 | }
113 |
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/tests/UsersTest.php:
--------------------------------------------------------------------------------
1 | byo_devtesttestjsommerset@bandwidth.com5413637598ROLE_USERUPDATEVIEWROLE_BDRUPDATEVIEWROLE_API_HISTORYUPDATEVIEWROLE_API_SITEUPDATEVIEWROLE_API_SEARCHVIEWROLE_API_ORDERINGUPDATEVIEWROLE_API_PROFILEUPDATEVIEWROLE_API_LNPUPDATEVIEWROLE_API_ACCOUNTVIEWROLE_API_DLDAUPDATEVIEWROLE_API_CNAMLIDBUPDATEVIEW"),
18 | new Response(200, [], ""),
19 | ]);
20 |
21 | self::$container = [];
22 | $history = Middleware::history(self::$container);
23 | $handler = HandlerStack::create($mock);
24 | $handler->push($history);
25 |
26 | self::$client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler));
27 | self::$account = new \Iris\Account(9500249, self::$client);
28 | }
29 |
30 | public function testUsersGet() {
31 | $users = self::$account->users()->getList();
32 |
33 | $json = '{"Username":"byo_dev","FirstName":"test","LastName":"test","EmailAddress":"jsommerset@bandwidth.com","TelephoneNumber":"5413637598","Roles":{"Role":[{"RoleName":"ROLE_USER","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_BDR","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_HISTORY","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_SITE","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_SEARCH","Permissions":{"Permission":{"PermissionName":"VIEW"}}},{"RoleName":"ROLE_API_ORDERING","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_PROFILE","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_LNP","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_ACCOUNT","Permissions":{"Permission":{"PermissionName":"VIEW"}}},{"RoleName":"ROLE_API_DLDA","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}},{"RoleName":"ROLE_API_CNAMLIDB","Permissions":{"Permission":[{"PermissionName":"UPDATE"},{"PermissionName":"VIEW"}]}}]}}';
34 | $this->assertEquals($json, json_encode($users[0]->to_array()));
35 | $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod());
36 | $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/users", self::$container[self::$index]['request']->getUri());
37 | self::$index++;
38 | }
39 |
40 | public function testUserPassword() {
41 | $user = new \Iris\User(self::$client, ["Username" => "byo_dev"]);
42 | $user->password("123");
43 |
44 | $this->assertEquals("PUT", self::$container[self::$index]['request']->getMethod());
45 | $this->assertEquals("https://api.test.inetwork.com/v1.0/users/byo_dev/password", self::$container[self::$index]['request']->getUri());
46 | self::$index++;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/tests/fixtures/loa_test.txt:
--------------------------------------------------------------------------------
1 | This is a test fixture
2 |
--------------------------------------------------------------------------------
/tests/lib/CheckBody.php:
--------------------------------------------------------------------------------
1 | curl_opts = array();
6 | $this->response = null;
7 | }
8 | public function setStringResponse($response) {
9 | $this->response = $response;
10 | }
11 | public function get($url, $options = array()) {
12 | $this->url = $url;
13 | $this->options = $options;
14 | return simplexml_load_string($this->response);
15 | }
16 | }
17 |
18 | class TestClient extends Iris\PestClient
19 | {
20 | public function __construct($login, $password, $options=Null)
21 | {
22 | parent::__construct($login, $password, $options);
23 | $this->pest = new TestPestXML();
24 | }
25 |
26 | public function setStringResponse($string)
27 | {
28 | $this->pest->setStringResponse($string);
29 | }
30 | public function getUrl() {
31 | return $this->pest->url;
32 | }
33 | public function getOptions() {
34 | return $this->pest->options;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------