Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ksvirkou-hubspot authored Oct 23, 2020
2 parents a590b6d + 69bc16c commit 88e9a69
Show file tree
Hide file tree
Showing 22 changed files with 155 additions and 158 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ sudo: false

jobs:
include:
- php: 7.0
env: PHPUNIT_SUITE=All
- php: 7.1
env: PHPUNIT_SUITE=Unit
- php: 7.2
env: PHPUNIT_SUITE=Unit
env: PHPUNIT_SUITE=All
- php: 7.3
env: PHPUNIT_SUITE=Unit
- php: 7.4
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased](https://github.com/HubSpot/hubspot-php/compare/v2.0.5...HEAD)
## [Unreleased](https://github.com/HubSpot/hubspot-php/compare/v3.0.0...HEAD)

## [3.0.0]

### Changed
- Comments to BlogComments
- Deal create + update change params
- BlogPosts::clonePost => BlogPosts::clone
- BlogTopics::create remove name
- contactsProperties getGroups => getAllGroups
- CrmPipelines move object type to __construct
- Up Guzzle version to 7
- Up php version to 7.2

## [2.0.5]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ If you see something not planned, that you want, make an [issue](https://github.
- [ ] Conversations Live Chat Widget API (Front End)
- [x] CMS Blog API (Blogs) :upadated:
- [x] CMS Blog Authors API (BlogAuthors) :upadated:
- [ ] CMS Blog Comments API (Comments)
- [x] CMS Blog Comments API (BlogComments)
- [x] CMS Blog Post API (BlogPosts)
- [x] CMS Blog Topics API (BlogTopics)
- [ ] CMS Domains API
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=7.0",
"php": ">=7.2",
"ext-json": "*",
"guzzlehttp/guzzle": "~6.0 | ^7.0"
},
Expand Down
1 change: 0 additions & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public function __construct(array $config = [], Client $client = null, array $cl
/**
* Return an instance of a Resource based on the method called.
*
* @param array $arguments
* @param mixed $args
*/
public function __call(string $name, $args): Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SevenShores\Hubspot\Resources;

class Comments extends Resource
class BlogComments extends Resource
{
/**
* Get all comments.
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/BlogPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function delete($id)
*
* @return \SevenShores\Hubspot\Http\Response
*/
public function clonePost($id, string $name)
public function clone($id, string $name)
{
$endpoint = "https://api.hubapi.com/content/api/v2/blog-posts/{$id}/clone";

Expand Down
9 changes: 3 additions & 6 deletions src/Resources/BlogTopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,17 @@ public function getById($id, array $params = [])
/**
* Create a new blog topic.
*
* @param string $name Name of the topic
* @param array $prorerties Blog topic's fields
* @param array $params Optional parametrs
* @param array $prorerties Blog topic's fields
* @param array $params Optional parametrs
*
* @see https://developers.hubspot.com/docs/methods/blog/v3/create-blog-topic
*
* @return \SevenShores\Hubspot\Http\Response
*/
public function create($name, array $prorerties = [], $params = [])
public function create(array $prorerties, $params = [])
{
$endpoint = 'https://api.hubapi.com/blogs/v3/topics';

$prorerties['name'] = $name;

return $this->client->request(
'post',
$endpoint,
Expand Down
6 changes: 2 additions & 4 deletions src/Resources/ContactProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ public function delete(string $name)
}

/**
* Get contact property groups.
*
* Returns all of the contact property groups for a given portal.
*
* @param bool $includeProperties if true returns all of the properties for each company property group
Expand All @@ -108,7 +106,7 @@ public function delete(string $name)
*
* @return \SevenShores\Hubspot\Http\Response
*/
public function getGroups(bool $includeProperties = false)
public function getAllGroups(bool $includeProperties = false)
{
$endpoint = 'https://api.hubapi.com/contacts/v2/groups';

Expand Down Expand Up @@ -176,7 +174,7 @@ public function updateGroup(string $groupName, array $properties)
{
$endpoint = "https://api.hubapi.com/contacts/v2/groups/named/{$groupName}";

$group['name'] = $groupName;
$properties['name'] = $groupName;

return $this->client->request('put', $endpoint, ['json' => $properties]);
}
Expand Down
31 changes: 21 additions & 10 deletions src/Resources/CrmPipelines.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,33 @@
*/
class CrmPipelines extends Resource
{
/**
* @var string
*/
protected $objectType;

public function __construct($client, string $objectType)
{
parent::__construct($client);

$this->objectType = $objectType;
}

/**
* Get all of the pipelines for the specified object type.
* This currently supports pipelines for deals and tickets.
*
* @param string $objectType | Currently supports tickets or deals only
* @param array $params | Array of optional parameter ['includeInactive' => 'EXCLUDE_DELETED' (default) | 'INCLUDE_DELETED']
* @param array $params | Array of optional parameter ['includeInactive' => 'EXCLUDE_DELETED' (default) | 'INCLUDE_DELETED']
*
* @throws \SevenShores\Hubspot\Exceptions\BadRequest
*
* @see https://developers.hubspot.com/docs/methods/pipelines/get_pipelines_for_object_type
*
* @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
*/
public function all(string $objectType, array $params = [])
public function all(array $params = [])
{
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$objectType}";
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$this->objectType}";

return $this->client->request(
'get',
Expand All @@ -43,9 +54,9 @@ public function all(string $objectType, array $params = [])
*
* @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
*/
public function create(string $objectType, array $properties)
public function create(array $properties)
{
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$objectType}";
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$this->objectType}";

return $this->client->request('post', $endpoint, ['json' => $properties]);
}
Expand All @@ -59,9 +70,9 @@ public function create(string $objectType, array $properties)
*
* @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
*/
public function update(string $objectType, string $id, array $properties)
public function update(string $id, array $properties)
{
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$objectType}/{$id}";
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$this->objectType}/{$id}";

return $this->client->request('put', $endpoint, ['json' => $properties]);
}
Expand All @@ -75,9 +86,9 @@ public function update(string $objectType, string $id, array $properties)
*
* @return \Psr\Http\Message\ResponseInterface|\SevenShores\Hubspot\Http\Response
*/
public function delete(string $objectType, string $id)
public function delete(string $id)
{
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$objectType}/{$id}";
$endpoint = "https://api.hubapi.com/crm-pipelines/v1/pipelines/{$this->objectType}/{$id}";

return $this->client->request('delete', $endpoint);
}
Expand Down
23 changes: 19 additions & 4 deletions src/Resources/Deals.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,28 @@ class Deals extends Resource
/**
* Create a deal.
*
* @param array $properties array of deal properties
* @param array $properties array of deal properties
* @param array $associations array of IDs for records that the new deal should be associated with
*
* @see https://developers.hubspot.com/docs/methods/deals/create_deal
*
* @return \SevenShores\Hubspot\Http\Response
*/
public function create(array $properties)
public function create(array $properties, array $associations = [])
{
$endpoint = 'https://api.hubapi.com/deals/v1/deal';

return $this->client->request('post', $endpoint, ['json' => $properties]);
$data = ['properties' => $properties];

if (!empty($associations)) {
$data['associations'] = $associations;
}

return $this->client->request(
'post',
$endpoint,
['json' => $data]
);
}

/**
Expand All @@ -37,7 +48,11 @@ public function update($id, array $properties)
{
$endpoint = "https://api.hubapi.com/deals/v1/deal/{$id}";

return $this->client->request('put', $endpoint, ['json' => $properties]);
return $this->client->request(
'put',
$endpoint,
['json' => ['properties' => $properties]]
);
}

/**
Expand Down
Loading

0 comments on commit 88e9a69

Please sign in to comment.