Skip to content

Commit

Permalink
Merge pull request DigitalOceanPHP#134 from yassirh/master
Browse files Browse the repository at this point in the history
Added support for listing volumes of a droplet
  • Loading branch information
yassirh authored Jul 14, 2016
2 parents d945a30 + 54a2028 commit 8de90a9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
19 changes: 16 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@ CONTRIBUTING

Contributions are **welcome** and be fully **credited** <3

Before submitting any pull request please make sure that the coding standards are respected and that all the specification tests are passing.

Coding Standard
---------------
This library will use the [Symfony2 Coding Standard](http://symfony.com/doc/current/contributing/code/standards.html).

These conventions are enforced using the [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) tool. PHP-CS-Fixer is installed as a dev dependency and will therefore be available after running `composer install` or `composer update`.

Usage
-----

``` bash
$ cd /path/to/DigitalOceanV2
$ ./vendor/bin/php-cs-fixer fix
```


Specification tests
-------------------

Install [PHPSpec](http://www.phpspec.net/) [globally](https://getcomposer.org/doc/00-intro.md#globally)
with composer and run it in the project.

```bash
$ composer global require phpspec/phpspec:@stable
$ phpspec run -fpretty
```

**Happy coding** !
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,17 +466,6 @@ $volume->delete('506f78a4-e098-11e5-ad9f-000f53306ae1');
$volume->delete('example', 'nyc1');
```

Specification tests
-------------------

Install [PHPSpec](http://www.phpspec.net/) [globally](https://getcomposer.org/doc/00-intro.md#globally)
with composer and run it in the project.

```bash
$ composer global require phpspec/phpspec:@stable
$ phpspec run -fpretty
```

Contributing
------------

Expand Down
6 changes: 6 additions & 0 deletions spec/DigitalOceanV2/Api/DropletSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ function it_returns_a_droplet_entity_get_by_its_id($adapter)
"snapshot_ids": [
119192841
],
"volume_ids": [
"123321123",
"789987789"
],
"next_backup_window": {
"start": "2015-02-16T19:00:00Z",
"end": "2015-02-17T18:00:00Z"
Expand All @@ -170,6 +174,8 @@ function it_returns_a_droplet_entity_get_by_its_id($adapter)
$droplet->kernel->shouldReturnAnInstanceOf('DigitalOceanV2\Entity\Kernel');
$droplet->region->shouldReturnAnInstanceOf('DigitalOceanV2\Entity\Region');
$droplet->image->shouldReturnAnInstanceOf('DigitalOceanV2\Entity\Image');
$droplet->volumeIds[0]->shouldBe("123321123");
$droplet->volumeIds[1]->shouldBe("789987789");
$this->getMeta()->shouldBeNull();
$droplet->sizeSlug->shouldBe('512mb');
$droplet->backupsEnabled->shouldBe(true);
Expand Down
5 changes: 5 additions & 0 deletions src/Entity/Droplet.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ final class Droplet extends AbstractEntity
*/
public $backupIds = [];

/**
* @var string[]
*/
public $volumeIds = [];

/**
* @var int[]
*/
Expand Down

0 comments on commit 8de90a9

Please sign in to comment.