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

update() public method

Update the specified company-level property. This does not update the value on a specified company, but instead changes the definition of the company property.
See also: http://developers.hubspot.com/docs/methods/companies/update_company_property
public update ( string $propertyName, array $property ) : Response
$propertyName string
$property array
return SevenShores\Hubspot\Http\Response
    function update($propertyName, $property)
    {
        $endpoint = "https://api.hubapi.com/companies/v2/properties/named/{$propertyName}";
        $property['name'] = $propertyName;
        $options['json'] = $property;
        return $this->client->request('put', $endpoint, $options);
    }

Usage Example

 /** @test */
 public function update()
 {
     $createdPropertyResponse = $this->createCompanyProperty();
     $property = ["label" => "Custom property Changed", "description" => "An Awesome Custom property that changed", "groupName" => "companyinformation", "type" => "string", "fieldType" => "text", "formField" => true, "displayOrder" => 6, "options" => []];
     $response = $this->companyProperties->update($createdPropertyResponse->name, $property);
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertEquals('Custom property Changed', $response->label);
 }