|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SevenShores\Hubspot\Resources; |
|
4
|
|
|
|
|
5
|
|
|
class DealProperties extends Resource |
|
6
|
|
|
{ |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Get a Deal Property. |
|
10
|
|
|
* |
|
11
|
|
|
* Returns a JSON object representing the definition for a given deal property. |
|
12
|
|
|
* |
|
13
|
|
|
* @see http://developers.hubspot.com/docs/methods/deals/get_deal_property |
|
14
|
|
|
* |
|
15
|
|
|
* @param string $name The name of the property. |
|
16
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
17
|
|
|
*/ |
|
18
|
|
|
function get($name) |
|
|
|
|
|
|
19
|
|
|
{ |
|
20
|
|
|
$endpoint = "https://api.hubapi.com/deals/v1/properties/named/{$name}"; |
|
21
|
|
|
|
|
22
|
|
|
return $this->client->request('get', $endpoint); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Create a deal property. |
|
27
|
|
|
* |
|
28
|
|
|
* Create a property on every deal object to store a specific piece of data. In the example below, |
|
29
|
|
|
* we want to store an invoice number on a separate field on deals. |
|
30
|
|
|
* |
|
31
|
|
|
* @see https://developers.hubspot.com/docs/methods/deals/create_deal_property |
|
32
|
|
|
* |
|
33
|
|
|
* @param array $property |
|
34
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
35
|
|
|
*/ |
|
36
|
|
|
function create($property) |
|
|
|
|
|
|
37
|
|
|
{ |
|
38
|
|
|
$endpoint = "https://api.hubapi.com/properties/v1/deals/properties/"; |
|
39
|
|
|
|
|
40
|
|
|
$options['json'] = $property; |
|
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
return $this->client->request('post', $endpoint, $options); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Update a deal property. |
|
47
|
|
|
* |
|
48
|
|
|
* Update a specified deal property. |
|
49
|
|
|
* |
|
50
|
|
|
* @see http://developers.hubspot.com/docs/methods/deals/update_deal_property |
|
51
|
|
|
* |
|
52
|
|
|
* @param string $name |
|
53
|
|
|
* @param array $property |
|
54
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
55
|
|
|
*/ |
|
56
|
|
View Code Duplication |
function update($name, $property) |
|
|
|
|
|
|
57
|
|
|
{ |
|
58
|
|
|
$endpoint = "https://api.hubapi.com/deals/v1/properties/named/{$name}"; |
|
59
|
|
|
|
|
60
|
|
|
$property['name'] = $name; |
|
61
|
|
|
$options['json'] = $property; |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
return $this->client->request('put', $endpoint, $options); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.