CRM V2

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
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.
getQuestions()  : Customer
Get all segmentation questions
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()

public __construct([string $endpoint = null ][, string $bearerToken = null ][, string $bearerPwd = null ]) : mixed
Parameters
$endpoint : string = null
$bearerToken : string = null
$bearerPwd : string = 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
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

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
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
Customer —

getQuestions()

Get all segmentation questions

public getQuestions(string $identification) : Customer
Parameters
$identification : string

The customer hashcode or email

Tags
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
Customer —

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
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
bool —

ping()

Use this the ping the crm and know its current status

public ping() : bool
Tags
throws
CrmException

if an error occurs on server side or on getting response

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
throws
ApiErrorException

ApiError::singleOptinCustomerExists If single optin already exists

throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
bool —

true if succeeded

Search results