File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,11 @@ $client->companies->create([
163163 "name" => "foocorp", "company_id" => "3"
164164]);
165165
166+ // Update a company (Note: This method is an alias to the create method. In practice you can use create to update companies if you wish)
167+ $client->companies->update([
168+ "name" => "foocorp", "id" => "3"
169+ ]);
170+
166171// List Companies
167172$client->companies->getCompanies([]);
168173```
Original file line number Diff line number Diff line change @@ -28,6 +28,17 @@ public function create($options)
2828 return $ this ->client ->post ("companies " , $ options );
2929 }
3030
31+ /**
32+ * Updates a Company.
33+ * @see https://developers.intercom.io/reference#create-or-update-company
34+ * @param array $options
35+ * @return mixed
36+ * @throws \GuzzleHttp\Exception\GuzzleException
37+ */
38+ public function update ($ options ) {
39+ return $ this ->create ($ options );
40+ }
41+
3142 /**
3243 * Returns list of Companies.
3344 * @see https://developers.intercom.io/reference#list-companies
Original file line number Diff line number Diff line change 99use GuzzleHttp \Middleware ;
1010
1111class IntercomCompaniesTest extends PHPUnit_Framework_TestCase {
12- public function testUserCreate ()
12+ public function testCompanyCreate ()
1313 {
1414 $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
1515 $ stub ->method ('post ' )->willReturn ('foo ' );
@@ -18,7 +18,16 @@ public function testUserCreate()
1818 $ this ->assertEquals ('foo ' , $ companies ->create ([]));
1919 }
2020
21- public function testUserGet ()
21+ public function testCompanyUpdate ()
22+ {
23+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
24+ $ stub ->method ('post ' )->willReturn ('foo ' );
25+
26+ $ companies = new IntercomCompanies ($ stub );
27+ $ this ->assertEquals ('foo ' , $ companies ->update ([]));
28+ }
29+
30+ public function testCompanyGet ()
2231 {
2332 $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
2433 $ stub ->method ('get ' )->willReturn ('foo ' );
You can’t perform that action at this time.
0 commit comments