Skip to content

Commit

Permalink
Merge 5322b35 into 3249226
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Jul 24, 2020
2 parents 3249226 + 5322b35 commit d072f5c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Response/IdeResponse.php
Expand Up @@ -12,6 +12,7 @@ class IdeResponse
public $uuid;
public $label;
public $links;
public $owner;

/**
* IdeResponse constructor.
Expand All @@ -23,5 +24,6 @@ public function __construct($ide)
$this->uuid = $ide->uuid;
$this->label = $ide->label;
$this->links = $ide->_links;
$this->owner = new MemberResponse($ide->_embedded->owner);
}
}
8 changes: 7 additions & 1 deletion src/Response/MemberResponse.php
Expand Up @@ -28,7 +28,13 @@ public function __construct($member)
$this->uuid = $member->uuid;
$this->first_name = $member->first_name;
$this->last_name = $member->last_name;
$this->mail = $member->mail;

if (property_exists($member, 'mail')) {
$this->mail = $member->mail;
}
elseif (property_exists($member, 'email')) {
$this->mail = $member->email;
}
$this->picture_url = $member->picture_url;
$this->username = $member->username;

Expand Down
3 changes: 2 additions & 1 deletion tests/Endpoints/IdesTest.php
Expand Up @@ -11,7 +11,8 @@ class IdesTest extends CloudApiTestCase
public $properties = [
'uuid',
'label',
'links'
'links',
'owner',
];

public function testGetAllIdes()
Expand Down
14 changes: 13 additions & 1 deletion tests/Fixtures/Endpoints/Ides/getAllIdes.json
Expand Up @@ -29,8 +29,20 @@
"ide": {
"href": "https://215824ff-272a-4a8c-9027-df32ed1d68a9.ides.acquia.com"
}
},
"_embedded": {
"owner": {
"uuid": "10be1d3e-f2b4-4d34-855d-321df3938ffd",
"first_name": "First",
"last_name": "Last",
"last_login_at": "2019-01-31T10:53:11-05:00",
"created_at": "2016-08-14T17:38:59-04:00",
"email": "user.name@example.com",
"picture_url": "https://accounts.acquia.com/path/to/image.png",
"username": "user.name"
}
}
}
]
}
}
}
14 changes: 13 additions & 1 deletion tests/Fixtures/Endpoints/Ides/getIde.json
Expand Up @@ -16,6 +16,18 @@
},
"ide": {
"href": "https://215824ff-272a-4a8c-9027-df32ed1d68a9.ides.acquia.com"
},
"_embedded": {
"owner": {
"uuid": "10be1d3e-f2b4-4d34-855d-321df3938ffd",
"first_name": "First",
"last_name": "Last",
"last_login_at": "2019-01-31T10:53:11-05:00",
"created_at": "2016-08-14T17:38:59-04:00",
"email": "user.name@example.com",
"picture_url": "https://accounts.acquia.com/path/to/image.png",
"username": "user.name"
}
}
}
}
}

0 comments on commit d072f5c

Please sign in to comment.