Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from methylbro/documentation
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
methylbro authored Nov 7, 2016
2 parents 089a649 + 4db99a2 commit 8414830
Show file tree
Hide file tree
Showing 53 changed files with 1,873 additions and 547 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Selligent Soap API Client

[![Build Status](https://secure.travis-ci.org/mediapart/selligent.svg?branch=master)](http://travis-ci.org/mediapart/selligent) [![Code Coverage](https://scrutinizer-ci.com/g/mediapart/selligent/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mediapart/selligent) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/mediapart/selligent/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mediapart/selligent) [![Total Downloads](https://poser.pugx.org/mediapart/selligent/downloads.png)](https://packagist.org/packages/mediapart/selligent) [![Latest Stable Version](https://poser.pugx.org/mediapart/selligent/v/stable.png)](https://packagist.org/packages/mediapart/selligent)
[![Build Status](https://secure.travis-ci.org/mediapart/selligent.svg?branch=master)](http://travis-ci.org/mediapart/selligent) [![Code Coverage](https://codecov.io/gh/mediapart/selligent/branch/master/graph/badge.svg)](https://scrutinizer-ci.com/g/mediapart/selligent) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/mediapart/selligent/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mediapart/selligent) [![Total Downloads](https://poser.pugx.org/mediapart/selligent/downloads.png)](https://packagist.org/packages/mediapart/selligent) [![Latest Stable Version](https://poser.pugx.org/mediapart/selligent/v/stable.png)](https://packagist.org/packages/mediapart/selligent)

## Installation

```bash
composer require mediapart/selligent
```
## Usage

```php
<?php
<?php # example.php

require './vendor/autoload.php';

use Mediapart\Selligent\Connection;
use Mediapart\Selligent\Transport;
Expand Down Expand Up @@ -63,6 +62,16 @@ try {
}
```


## Installation

Simply install this package with [Composer](http://getcomposer.org/).

```bash
composer require mediapart/selligent
```


## Test

Executing `default` test suite :
Expand All @@ -78,10 +87,11 @@ With the `real` testsuite, you could execute a serie of test who will be applied
- soap_login
- soap_password
- soap_wsdl
- selligent_listid
- selligent_list
- selligent_gate


## Read More

- Illustrated [Reference](doc/Reference.md) of all available API endpoints.
- Illustrated [Reference](doc/Reference/Readme.md) of all available API endpoints.
- Little use case [Example](doc/Example.md) from connection to triggering campaign
77 changes: 58 additions & 19 deletions doc/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
```php
<?php

use Mediapart\Selligent\Connection;
use Mediapart\Selligent\Response;
use Mediapart\Selligent\List;
use Mediapart\Selligent\Property;
use Mediapart\Selligent\ArrayOfProperty;
namespace Mediapart\Selligent;


/*
Open a connection to Selligent.
*/
$connection = new Connection();
$client = $connection->open($login, $password, $wsdl);


/* output lists infos */
/*
Output lists infos.
*/
$response = $client->GetLists();

if (Response::SUCCESSFUL === $response->getCode()) {
Expand All @@ -29,34 +30,72 @@ if (Response::SUCCESSFUL === $response->getCode()) {
}


/* register a new user */
/*
Register a new user.
*/
$user = new Properties();
$user[] = new Property('NAME', 'Thomas Gasc');
$user[] = new Property('MAIL', '[email protected]');
$user['NAME'] = 'Foo Bar';
$user['MAIL'] = '[email protected]';

$response = $client->CreateUser([
'List' => $list->getId(),
'Changes' => $user,
]);

if (Response::SUCCESSFUL === $response->getCode()) {
$user_id = $response->ID;
printf("saved with id=%d\n", $user_id);
$idUser = $response->getUserId();
printf("saved with id=%d\n", $idUser);
}


/* update user info */
$updatedUser = new ArrayOfProperty();
$updatedUser[] = new Property('NAME', 'Thomas Gasc Test');
$updatedUser[] = new Property('MAIL', '[email protected]');
/*
Update user info.
*/
$changes = new Properties();
$changes['NAME'] = 'Foo Bar';
$changes['MAIL'] = '[email protected]';

$response = $client->UpdateUser([
'List' => $list->getId(),
'UserID' => $user_id,
'Changes' => $updatedUser,
'UserID' => $idUser,
'Changes' => $changes,
]);

if (Response::SUCCESSFUL === $response->getCode()) {
printf("%d updated\n", $user_id);
printf("%d updated\n", $idUser);
}
```


/*
Trigger a campaign TESTGATE to $idUser with a
custom var MESSAGE.
*/
$nameGate = 'TESTGATE';
$nameList = 'TESTLIST';

$response = $this->client->GetListID([
'name' => $nameList,
]);

if (Response::SUCCESSFUL === $response->getCode()) {

$idList = $response->getId();

$inputData = new Properties();
$inputData['MESSAGE'] = 'Lorem ipsum dolor sit amet.';

$response = $client->TriggerCampaignForUserWithResult([
'List' => $idList,
'UserID' => $idUser,
'GateName' => $nameGate,
'InputData' => $inputData,
]);

if (Response::SUCCESSFUL === $response->getCode()) {
printf("The message has been sent to user #%d.", $idUser);
}

} else {
printf("Error with the '%s' list.", $nameList);
}
```
Loading

0 comments on commit 8414830

Please sign in to comment.