loopline-systems / closeio-api-wrapper Goto Github PK
View Code? Open in Web Editor NEWPHP Wrapper to use the Close.io API
License: MIT License
PHP Wrapper to use the Close.io API
License: MIT License
There is a console application used for testing only purpose, remove it
bring phpstan, phpunit and coveralls to the latest available version.
Hi, I'm going to finalise 0.7 in the next few days; I'll like any effort on review the changes in the planned release and have information from users that use this library to know if there are some change that can break the library usage.
This release should be completely full back compatible but in case of issue let me know and I'll try to fix it before the release.
cc/ @kasparsj @wridgers @wodka @DaneEveritt @mickadoo @null9beta @nickpersico @philfreo @dlimars @filchakov @CKaller @MarcoKollosche @raizalc @SarahPAV @it-slave @closeio @yearbook @Muffeen @igor-kamil @filchakov
Actually is not possible to unset a custom field on close.io Lead using API, allow to send null values in order to unset it.
Currently we are excluding custom field with null values from Lead API call, this make impossible to unset a value on lead custom field.
as of the last two weeks
an error has popped up i redownloaded the package to get any updates you might have added
$response = $leadsApi->addLead($lead);
$responsedata = $response->getData();
using getData() is throwing an undefined method error.....even tho i see the function in the CloseIoRequest.php
SSIA
array_merge
doesn't check if both arrays exist on
Notice: Undefined index: errors in /closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/CloseIoResponse.php on line 112
Can be reproduced by sending an incorrectly formatted phone number to close.io (which returns a response containing only 'field_errors' but not 'errors'.
HTTP 429 responses return a structured message -as opposed to a string- that breaks the CloseIoResponseException
constructor, as it's always expecting a string.
When installing via composer, the following error appears.
- Installation request for loopline-systems/closeio-api-wrapper ^0.7.1 -> satisfiable by loopline-systems/closeio-api-wrapper[v0.7.1].
- Conclusion: remove doctrine/inflector 2.0.3
- Conclusion: don't install doctrine/inflector 2.0.3
- loopline-systems/closeio-api-wrapper v0.7.1 requires doctrine/inflector ^1.0 -> satisfiable by doctrine/inflector[1.0.x-dev, 1.1.x-dev, 1.2.x-dev, 1.3.1, 1.3.x-dev, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.x-dev, v1.0, v1.0.1, v1.1.0, v1.2.0, v1.3.0].
- Can only install one of: doctrine/inflector[1.1.x-dev, 2.0.3].
- Can only install one of: doctrine/inflector[1.2.x-dev, 2.0.3].
- Can only install one of: doctrine/inflector[1.3.1, 2.0.3].
- Can only install one of: doctrine/inflector[1.3.x-dev, 2.0.3].
- Can only install one of: doctrine/inflector[1.4.0, 2.0.3].
- Can only install one of: doctrine/inflector[1.4.1, 2.0.3].
- Can only install one of: doctrine/inflector[1.4.2, 2.0.3].
- Can only install one of: doctrine/inflector[1.4.3, 2.0.3].
- Can only install one of: doctrine/inflector[1.4.x-dev, 2.0.3].
- Can only install one of: doctrine/inflector[v1.1.0, 2.0.3].
- Can only install one of: doctrine/inflector[v1.2.0, 2.0.3].
- Can only install one of: doctrine/inflector[v1.3.0, 2.0.3].
- Can only install one of: doctrine/inflector[1.0.x-dev, 2.0.3].
- Can only install one of: doctrine/inflector[v1.0, 2.0.3].
- Can only install one of: doctrine/inflector[v1.0.1, 2.0.3].
- Installation request for doctrine/inflector (locked at 2.0.3) -> satisfiable by doctrine/inflector[2.0.3].
Instead, it throws a BadApiRequestException
.
Define roadmap and next step for 0.8 (open for discussion)
Add CI step to ensure coding standard, some CS we should evaluate:
I'll add on version 0.8 since most of them do not support php 5.6 as we do on 0.7
after installing with composer and try to run the code i get the following error
In src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php
we include use Zend\Filter\Word\UnderscoreToCamelCase;
that is not used and is not included in our dependency, this will break package that use this lib without including also zend core package.
hey whatsup
its been awhile....but i was curious....do you have any plans to implement the sms feature on closeio?
i really want to create a system
When trying to update an existing contact on a lead, instead of overriding the existing contact object a new one is being created.
This is due to the clearing of the id attribute on the contact before sending the request within the ContactApi::updateContact(Contact $contact) function. (Line 93 - $contact->setId(null);)
Could you please remove this line.
Url validation doesn't work when the url in question includes an umlaut.
$lead = new Lead();
$lead->setUrl("https://www.this-is-ä-test.com");
Urls should be url-encoded before being validated
It's great that this project is still going, I think I was probably the first thing I did when I joined Loopline nearly 8 years ago! Thanks to everyone who has contributed to it recently.
I haven't really been involved in this project for the last while, and although we looked for some new maintainers in #37 it's probably not getting the attention it deserves. A while back @mavimo did loads of work fixing open issues, and more recently @omissis did a lot to update the dependencies and fix some open issues. There are also a few other open PRs that I haven't had time to look at, and even merging the latest PR from @omissis I know it's not much use without releasing a new version.
@marczahn was originally involved and suggested that we might archive this repo. It seems like it does get a bit of use, so I was thinking that maybe someone (I'm thinking maybe @mavimo @danbarker or @omissis) would like to continue with it using their own fork. That way they'd be able to manage it as they see fit without needing to come to myself or Marc to make any changes or draft new releases. We can abandon it on Packagist so anyone using it would get a prompt to switch to the fork, I think it'd be better for the end users that way.
If nobody is interested in maintaining a fork we'll probably archive it anyway, just so people know that it's not being actively maintained, but if anyone is interested just drop a comment below, thanks!
Unicode emails are not supported
Email::setEmail()
when email is test@müller.com
SSIA
This repo was created a few years ago and some of us have moved on or are not using close.io as much. It's great to see some PRs from the community, but sometimes they're left open for a long time. It seems to be reasonably popular (10,000 downloads although about 3,000 of those were probably me during early development) and instead of having individual forks by people who get fed up waiting I think it might be better to give some people merge rights on it.
It's not a huge responsibility, there aren't a whole lot of new PRs, but for someone who's using close.io through a PHP application right now it could be a good chance to step up your with this repo.
Pinging a few people who have contributed in the past:
@mavimo @danbarker @kasparsj @wodka @wridgers @filchakov @dlimars @EnoahNetzach
Just leave a comment here if you're interested
first of all, as there seems to be no feature anymore that allows me to send messages to collaborators and members i am just using an issue for that :)
soon the service integrations setup for this repo (travis, packagist and code climate) will stop working, please see this article, it contains the deadlines.
https://developer.github.com/v3/guides/replacing-github-services/
I already added the travis github app, because i needed it for one of our open source repos.
Travis also changed the .tld, .org is used for the old services, .com is used for the github app.
services: https://travis-ci.org/profile/loopline-systems
github app: https://travis-ci.com/profile/loopline-systems
your github logins should just work fine on the .com travis platform.
I saw that there is a migration feature to get all the builds migrated from the services platform into the github app platform, but it`s not showing so far. So i need to investigate on that.
about the other to service, codeclimate and packgist, i will start checking about migrating to github apps soon, and let you know about the staus here
Actually we are using Doctrine inflector for string singularisation, and Zend filter for convert close.io parameter name to class name. Since the Doctrine inflector have the same feature (method classify) I like to reduce dependency by using only Doctrine inflector.
<?php
use Zend\Filter\Word\UnderscoreToCamelCase;
use Doctrine\Common\Inflector\Inflector;
class DemoTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider dataProvider
*/
public function testDifference($string)
{
$this->assertEquals((new UnderscoreToCamelCase)->filter($string), Inflector::classify($string));
}
public function dataProvider()
{
return [
["date_updated"],
["html_url"],
["created_by"],
["organization_id"],
["url"],
["opportunities"],
["updated_by"],
["date_created"],
["id"],
["description"],
["id"],
["first_name"],
["last_name"],
["date_created"],
["date_updated"],
["email"],
["image"],
["phone"],
["last_used_timezone"],
];
}
}
Update doctrine/inflector
from v1.0 to v2.0 and update its deprecated usages.
any close.io lead with a task pulls this error back in php
Fatal error: Uncaught exception 'LooplineSystems\CloseIoApiWrapper\Library\Exception\UndefinedMethodException' with message 'Method: setType does not exist' in /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php:47
Stack trace:
#0 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Model/Task.php(100): LooplineSystems\CloseIoApiWrapper\Model\Task->hydrate(Array, Array, Array)
#1 [internal function]: LooplineSystems\CloseIoApiWrapper\Model\Task->__construct(Array)
#2 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php(63): ReflectionClass->newInstanceArgs(Array)
#3 /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/Cl in /htdocs/wp-content/themes/twentyfifteen/extensions/closeio/vendor/loopline-systems/closeio-api-wrapper/src/LooplineSystems/CloseIoApiWrapper/Library/ObjectHydrateHelperTrait.php on line 47
so i cant call that lead until i trash the task on it
Try:
$opportunity = new Opportunity();
$opportunity->setConfidence("50");
$lead->setOpportunities(array($opportunity));
$response = $leadsApi->addLead($lead);
Nothing happens :(
When using the LeadApi to send a Lead object to Close, if you don't internationalise the phone number, it will sometimes return the following error:
{"field-errors":{"phones":[{"phone":"Phone number is not valid.
Please use the international format like +16505551234"}]}}
(Sometimes it will just automatically add +1, as it guesses that you're trying to put a US phone number).
The closeio-api-wrapper throws a BadApiRequestException in this case (from Curl->getResponse method). BadApiRequestException is passed a multi-level array for the error, that is created by json_decode on the json response sent by the API. BadApiRequestException then attempts to turn the multi-level array of errors it is sent into a single string ($output):
public function __construct(array $allErrors)
{
$output = '';
foreach ($allErrors as $type => $errorsByType){
if (! empty ($errorsByType)) {
if (is_array($errorsByType)) {
$output .= $type . ' : ' .PHP_EOL;
foreach ($errorsByType as $key => $error){
$output .= $key . ' => ' . $error . PHP_EOL;
}
} else {
$output .= $type . ' : ' . $errorsByType;
}
}
}
parent::__construct('Api request returned errors. ' . PHP_EOL . $output);
}
However, the code above only supports being passed a 2-deep array. The error given above is 3-deep, so the line
$output .= $key . ' => ' . $error . PHP_EOL;
causes a PHP exception to be thrown, as $error is an array and we are trying to concatenate it to the $output string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.