Skip to content

Commit

Permalink
DID description be null, refs #55
Browse files Browse the repository at this point in the history
  • Loading branch information
gigorok committed Feb 16, 2023
1 parent b62410a commit f5511e6
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"require": {
"php": ">=7.4",
"swisnl/json-api-client": "1.3.2",
"swisnl/json-api-client": "^2.2.0",
"illuminate/support": "*",
"guzzlehttp/guzzle": "^7.0",
"phpseclib/phpseclib": "^3.0.7",
"ext-openssl": "*",
Expand Down Expand Up @@ -43,5 +44,10 @@
"test": "XDEBUG_MODE=coverage phpunit",
"check-style": "php-cs-fixer fix --dry-run -v",
"fix-style": "php-cs-fixer fix"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
2 changes: 2 additions & 0 deletions src/Item/Configuration/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function getAttributes()
public function fill(array $attributes)
{
$this->attributes = $attributes;

return $this;
}

private static $didPlaceHolder = '{DID}';
Expand Down
2 changes: 1 addition & 1 deletion src/Item/Did.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setDescription(string $desc)
$this->attributes['description'] = $desc;
}

public function getDescription(): string
public function getDescription(): ?string
{
return $this->attributes['description'];
}
Expand Down
3 changes: 2 additions & 1 deletion src/Item/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public function fill(array $attributes)
$this->fillItems($attributes['items']);
unset($attributes['items']);
}
parent::fill($attributes);

return parent::fill($attributes);
}

private function fillItems($items)
Expand Down
2 changes: 2 additions & 0 deletions src/Item/OrderItem/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public function fill(array $attributes)
unset($attributes['monthly_price']);
unset($attributes['setup_price']);
$this->attributes = $attributes;

return $this;
}

public function getNrc(): float
Expand Down
3 changes: 2 additions & 1 deletion src/Item/VoiceInTrunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public function fill(array $attributes)
$this->fillConfiguration($attributes['configuration']);
unset($attributes['configuration']);
}
parent::fill($attributes);

return parent::fill($attributes);
}

private function fillConfiguration($configuration)
Expand Down
1 change: 1 addition & 0 deletions tests/DidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public function testBooleans()

$did->setBillingCyclesCount(0);
$did->setTerminated(true);
$did->setDescription('something');
$didDocument = $did->save();

$this->assertEquals($did->toJsonApiArray(), [
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/dids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
Access-Control-Allow-Headers: 'Origin, X-Requested-With, Content-Type, Accept, x-api-key, api-key, x-api-token, Cache-Control'
Access-Control-Allow-Methods: 'GET, POST, DELETE, PUT, PATCH, OPTIONS'
Access-Control-Allow-Credentials: 'true'
body: '{"data":{"id":"9df99644-f1a5-4a3c-99a4-559d758eb96b","type":"dids","attributes":{"blocked":false,"capacity_limit":2,"description":"something","terminated":false,"awaiting_registration":false,"created_at":"2018-12-27T09:59:55.015Z","number":"16091609123456797","expires_at":"2019-11-27T10:00:04.755Z","channels_included_count":0,"billing_cycles_count":null,"dedicated_channels_count":0},"relationships":{"did_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/did_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/did_group"}},"order":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/order","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/order"}},"voice_in_trunk":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk"}},"voice_in_trunk_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk_group"}},"capacity_pool":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/capacity_pool","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/capacity_pool"}},"shared_capacity_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/shared_capacity_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/shared_capacity_group"}}}}}'
body: '{"data":{"id":"9df99644-f1a5-4a3c-99a4-559d758eb96b","type":"dids","attributes":{"blocked":false,"capacity_limit":2,"description":null,"terminated":false,"awaiting_registration":false,"created_at":"2018-12-27T09:59:55.015Z","number":"16091609123456797","expires_at":"2019-11-27T10:00:04.755Z","channels_included_count":0,"billing_cycles_count":null,"dedicated_channels_count":0},"relationships":{"did_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/did_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/did_group"}},"order":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/order","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/order"}},"voice_in_trunk":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk"}},"voice_in_trunk_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk_group"}},"capacity_pool":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/capacity_pool","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/capacity_pool"}},"shared_capacity_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/shared_capacity_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/shared_capacity_group"}}}}}'
-
request:
method: PATCH
Expand Down

0 comments on commit f5511e6

Please sign in to comment.