Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/Benhawker/Pipedrive/Library/OrganizationFields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php namespace Benhawker\Pipedrive\Library;

use Benhawker\Pipedrive\Exceptions\PipedriveMissingFieldError;

/**
* Pipedrive OrganizationFields Methods
*
* OrganizationFields represent the near-complete schema for an Organization in the context of the company of the authorized user.
* Each company can have a different schema for their Organizations, with various custom fields. In the context of using
* OrganizationFiels as a schema for defining the data fields of an Organization, it must be kept in mind that some types of
* custom fields can have additional data fields which are not separate OrganizationFields per se. Such is the case with monetary,
* daterange and timerange fields – each of these fields will have one additional data field in addition to the one presented in
* the context of OrganizationFields. For example, if there is a monetary field with the key 'ffk9s9' stored on the account, 'ffk9s9'
* would hold the numeric value of the field, and 'ffk9s9_currency' would hold the ISO currency code that goes along with the numeric
* value. To find out which data fields are available, fetch one Organization and list its keys.
*
*/
class OrganizationFields
{
/**
* Hold the pipedrive cURL session
* @var \Benhawker\Pipedrive\Library\Curl Curl Object
*/
protected $curl;

/**
* Initialise the object load master class
*/
public function __construct(\Benhawker\Pipedrive\Pipedrive $master)
{
//associate curl class
$this->curl = $master->curl();
}

/**
* Returns all organization fields
*
* @return array returns all organizationFields
*/
public function getAll()
{
return $this->curl->get('organizationFields');
}

/**
* Returns a organization field
*
* @param int $id pipedrive organizationField id
* @return array returns details of a organizationField
*/
public function getById($id)
{
return $this->curl->get('organizationFields/' . $id);
}

}
16 changes: 16 additions & 0 deletions src/Benhawker/Pipedrive/Pipedrive.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class Pipedrive
* @var Organizations Object
*/
protected $organizations;
/**
* Placeholder attritube for the pipedrive organizationFields class
* @var \Benhawker\Pipedrive\Library\OrganizationFields OrganizationFields Object
*/
protected $organizationFields;
/**
* Placeholder attritube for the pipedrive products class
* @var Products Object
Expand Down Expand Up @@ -122,6 +127,7 @@ public function __construct($apiKey = '', $protocol = 'https', $host = 'api.pipe
$this->notes = new Library\Notes($this);
$this->dealFields = new Library\DealFields($this);
$this->organizations = new Library\Organizations($this);
$this->organizationFields = new Library\OrganizationFields($this);
$this->products = new Library\Products($this);
}

Expand Down Expand Up @@ -194,6 +200,16 @@ public function organizations()
{
return $this->organizations;
}

/**
* Returns the Pipedrive OrganizationFields Object
*
* @return \Benhawker\Pipedrive\Library\OrganizationFields
*/
public function organizationFields()
{
return $this->organizationFields;
}

/**
* Returns the Pipedrive Products Object
Expand Down