+ CrmApiV2
+
+
+
+ in package
+
+
+
+
+
+
+
+
+ This is the main class to interact with the CRM
+ + + + + + + + + ++ Table of Contents + +
+ +-
+
- + $apiInterface + + : ApiInterface + +
- The Api object that will handle requests and responses + +
- + __construct() + + : mixed + +
- CrmApiV2 + +
- + getCustomer() + + : Customer|null + +
- Get a customer from its hashcode or email +If it does not exists a new instance +will be returned. You would have +to call its save method later on. + +
- + getCustomerOrNew() + + : Customer + +
- Get a customer from its hashcode or email +If it does not exists a new instance +will be returned. You would have +to call its save method later on. + +
- + login() + + : bool + +
- Test a customer credentials to see if it can login + +
- + ping() + + : bool + +
- Use this the ping the crm and know its current status + +
- + setStatus() + + : bool + +
- Set the single optin status for an email + +
+ Properties + +
++ $apiInterface + + + +
+ + +The Api object that will handle requests and responses
+ +
+ private
+ static ApiInterface
+ $apiInterface
+
+
+
+
+
+
++ Methods + +
++ __construct() + +
+ + +CrmApiV2
+ +
+ public
+ __construct([string|null $endpoint = null ][, string|null $bearerToken = null ][, string|null $bearerPwd = null ]) : mixed
+
+
+ Parameters
+-
+
- + $endpoint + : string|null + = null +
- + + +
- + $bearerToken + : string|null + = null +
- + + +
- + $bearerPwd + : string|null + = null +
- + + +
Return values
+ mixed + — + + ++ getCustomer() + +
+ + +Get a customer from its hashcode or email +If it does not exists a new instance +will be returned. You would have +to call its save method later on.
+ +
+ public
+ getCustomer(string $identification) : Customer|null
+
+
+ Parameters
+-
+
- + $identification + : string + +
-
+
+ +The customer hashcode or email.
+
+
+ Tags + +
+ + +Return values
+ Customer|null + — +Return null if the customer was not found
++ getCustomerOrNew() + +
+ + +Get a customer from its hashcode or email +If it does not exists a new instance +will be returned. You would have +to call its save method later on.
+ +
+ public
+ getCustomerOrNew(string $identification) : Customer
+
+
+ Parameters
+-
+
- + $identification + : string + +
-
+
+ +The customer hashcode or email.
+
+
+ Tags + +
+ + +Return values
+ Customer + — +A client Customer model.
++ login() + +
+ + +Test a customer credentials to see if it can login
+ +
+ public
+ static login(string $email, string $password) : bool
+
+
+ Parameters
+-
+
- + $email + : string + +
- + + +
- + $password + : string + +
- + + +
+ Tags + +
+ + +Return values
+ bool + — + + ++ ping() + +
+ + +Use this the ping the crm and know its current status
+ +
+ public
+ ping() : bool
+
+
+
+
+ + Tags + +
+ + +Return values
+ bool + — + + ++ setStatus() + +
+ + +Set the single optin status for an email
+ +
+ public
+ static setStatus(string $email, bool $opt_in) : bool
+
+
+ Parameters
+-
+
- + $email + : string + +
- + + +
- + $opt_in + : bool + +
- + + +
+ Tags + +
+ + +Return values
+ bool + — +true if succeeded
+