Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from flavazelli/remvove-user-id
Browse files Browse the repository at this point in the history
solves issue #28
  • Loading branch information
eristemena authored Jun 15, 2019
2 parents e800d05 + 4f5bb54 commit b9a3b0d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
17 changes: 1 addition & 16 deletions src/Action/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

class User
{
/** @var string */
protected $id;

/** @var null|Dialogflow\Action\User\Name */
protected $name;

Expand All @@ -21,8 +18,6 @@ class User
*/
public function __construct($data)
{
$this->id = $data['userId'];

if (isset($data['profile'])) {
$this->name = new Name($data['profile']);
}
Expand All @@ -31,17 +26,7 @@ public function __construct($data)
$this->lastSeen = new Carbon($data['lastSeen']);
}
}

/**
* Random string ID for Google user.
*
* @return string
*/
public function getId()
{
return $this->id;
}


/**
* User's permissioned name info.
*
Expand Down
2 changes: 0 additions & 2 deletions tests/Action/ConversationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,13 @@ public function testGetUser()

$user = $conv->getUser();

$this->assertEquals('ABwppHEW9NgaT5S1NmZYR42yhs0FW1hawZHSjC_xW8FwkoZU1GMoIRAWWoThwUcA7VNX22Jzj8-KqA', $user->getId());
$this->assertEquals(null, $user->getName());

$agent = $this->getAgent('googleuserfull');
$conv = $agent->getActionConversation();

$user = $conv->getUser();

$this->assertEquals('ABwppHHRq4M6ZiJzBoAwy8WalWejgJDTZpHSj61TlzGgC1yJkQqA6OKsel7bvB-agBZiw', $user->getId());
$this->assertInstanceOf('\Dialogflow\Action\User\Name', $user->getName());
$this->assertEquals('Eris Ristemena', $user->getName()->getDisplay());
$this->assertEquals('Eris', $user->getName()->getGiven());
Expand Down
3 changes: 1 addition & 2 deletions tests/stubs/request-v2-google-userfull.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@
"givenName":"Eris",
"familyName":"Ristemena"
},
"locale":"en-US",
"userId":"ABwppHHRq4M6ZiJzBoAwy8WalWejgJDTZpHSj61TlzGgC1yJkQqA6OKsel7bvB-agBZiw"
"locale":"en-US"
},
"device":{
"location":{
Expand Down
3 changes: 1 addition & 2 deletions tests/stubs/request-v2-google.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@
"user":{
"userStorage":"{\"data\":{}}",
"lastSeen":"2018-05-06T02:54:10Z",
"locale":"id-ID",
"userId":"ABwppHEW9NgaT5S1NmZYR42yhs0FW1hawZHSjC_xW8FwkoZU1GMoIRAWWoThwUcA7VNX22Jzj8-KqA"
"locale":"id-ID"
},
"conversation":{
"conversationId":"1525587949165",
Expand Down

0 comments on commit b9a3b0d

Please sign in to comment.