Skip to content

Commit b178f70

Browse files
authored
Merge branch 'master' into correct-docblock-param-type-for-json
2 parents 8daf165 + f782957 commit b178f70

File tree

6 files changed

+68
-12
lines changed

6 files changed

+68
-12
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#### Why?
2+
Why are you making this change?
3+
4+
#### How?
5+
Technical details on your change

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
[![Code
3-
Climate](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/badges/2aa25d4736f09f40282e/gpa.svg)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Build
4-
Status](https://travis-ci.org/intercom/intercom-php.svg?branch=master)](https://travis-ci.org/intercom/intercom-php)
3+
Climate](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/badges/2aa25d4736f09f40282e/gpa.svg)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Circle CI](https://circleci.com/gh/intercom/intercom-php.png?style=badge)](https://circleci.com/gh/intercom/intercom-php)
54

65
## intercom-php
76

@@ -225,8 +224,10 @@ $client->segments->getSegments();
225224

226225
/** View a segment */
227226
$client->segments->getSegment("58a707924f6651b07b94376c");
228-
```
229227

228+
/** View a segment with count */
229+
$client->segments->getSegment("59c124f770e00fd819b9ce81", ["include_count"=>"true"]);
230+
```
230231
## Events
231232

232233
```php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "intercom/intercom-php",
33
"description": "Intercom API client built on top of Guzzle 6",
44
"keywords": ["intercom", "intercom.io", "api", "guzzle"],
5-
"license": "Apache Version 2",
5+
"license": "Apache-2.0",
66
"authors": [
77
{
88
"name": "Intercom Platform Team",

src/IntercomUsers.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,47 @@ public function scrollUsers($options = [])
9090
/**
9191
* Deletes a single User based on the Intercom ID.
9292
*
93-
* @see https://developers.intercom.com/reference#delete-a-user
93+
* @see https://developers.intercom.com/reference#archive-a-user
9494
* @param string $id
9595
* @param array $options
9696
* @return mixed
9797
* @throws \GuzzleHttp\Exception\GuzzleException
9898
*/
99-
public function deleteUser($id, $options = [])
99+
public function archiveUser($id, $options = [])
100100
{
101101
$path = $this->userPath($id);
102102
return $this->client->delete($path, $options);
103103
}
104104

105+
/**
106+
* Deletes a single User based on the Intercom ID.
107+
*
108+
* @see https://developers.intercom.com/reference#archive-a-user
109+
* @param string $id
110+
* @param array $options
111+
* @return mixed
112+
* @throws \GuzzleHttp\Exception\GuzzleException
113+
*/
114+
public function deleteUser($id, $options = [])
115+
{
116+
return $this->archiveUser($id, $options);
117+
}
118+
119+
/**
120+
* Permanently deletes a single User based on the Intercom ID.
121+
*
122+
* @see https://developers.intercom.com/reference#delete-users
123+
* @param string $id
124+
* @return mixed
125+
* @throws \GuzzleHttp\Exception\GuzzleException
126+
*/
127+
public function permanentlyDeleteUser($id)
128+
{
129+
return $this->client->post('user_delete_requests', [
130+
'intercom_user_id' => $id
131+
]);
132+
}
133+
105134
/**
106135
* @param string $id
107136
* @return string

test/IntercomUsersTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,31 @@ public function testUserGet()
3636
$users = new IntercomUsers($stub);
3737
$this->assertEquals('foo', $users->getUsers([]));
3838
}
39+
40+
public function testArchiveUser()
41+
{
42+
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
43+
$stub->method('delete')->willReturn('foo');
44+
45+
$users = new IntercomUsers($stub);
46+
$this->assertEquals('foo', $users->archiveUser(''));
47+
}
48+
49+
public function testDeleteUser()
50+
{
51+
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
52+
$stub->method('delete')->willReturn('foo');
53+
54+
$users = new IntercomUsers($stub);
55+
$this->assertEquals('foo', $users->deleteUser(''));
56+
}
57+
58+
public function testPermanentlyDeleteUser()
59+
{
60+
$stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
61+
$stub->method('post')->willReturn('foo');
62+
63+
$users = new IntercomUsers($stub);
64+
$this->assertEquals('foo', $users->permanentlyDeleteUser(''));
65+
}
3966
}

0 commit comments

Comments
 (0)