SevenShores\Hubspot\Resources\Companies::update PHP Method

update() public method

Updates a company
See also: http://developers.hubspot.com/docs/methods/companies/update_company
public update ( integer $id, array $properties ) : Response
$id integer The company id.
$properties array The company properties to update.
return SevenShores\Hubspot\Http\Response
    function update($id, $properties)
    {
        $endpoint = "https://api.hubapi.com/companies/v2/companies/{$id}";
        $options['json'] = ['properties' => $properties];
        return $this->client->request('put', $endpoint, $options);
    }

Usage Example

Example #1
0
 /** @test */
 public function update()
 {
     $newCompanyResponse = $this->createCompany();
     $id = $newCompanyResponse['companyId'];
     $companyDescription = 'A far better description than before';
     $properties = ['name' => 'description', 'value' => $companyDescription];
     $response = $this->companies->update($id, $properties);
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertEquals($id, $response['companyId']);
     $this->assertEquals($companyDescription, $response['properties']['description']['value']);
 }