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 #9 from methylbro/master
Browse files Browse the repository at this point in the history
Create Complete HTML Campaign through Broadcast API Endpoints
  • Loading branch information
methylbro authored Dec 6, 2016
2 parents 4e5a327 + b726ced commit 5339765
Show file tree
Hide file tree
Showing 28 changed files with 1,506 additions and 179 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@

require './vendor/autoload.php';

use Mediapart\Selligent\Configuration;
use Mediapart\Selligent\Connection;
use Mediapart\Selligent\Transport;
use Mediapart\Selligent\Properties;

/* before define your API credentials in config/YOUR_CONFIG.yml*/
$configFile = file_get_contents(
__DIR__.'/config/individual_default_config.yaml'
);
$cfg = new \Mediapart\Selligent\Configuration();


/* connect you to your Selligent API server */
$connection = new Connection();
$client = $connection->open($cfg->loadConfig($configFile));
$client = $connection->open([
'login' => '*****',
'password' => '*****',
'wsdl' => 'http://emsecure/individual?wsdl',
]);

/*
Example : Trigger the TESTGATE campaign to an user.
Expand Down Expand Up @@ -81,13 +78,21 @@ With the `real` testsuite, you could execute a serie of test who will be applied

- soap_login
- soap_password
- soap_wsdl
- soap_wsdl_individual
- soap_wsdl_broadcast
- selligent_list
- selligent_gate
- selligent_folderid
- selligent_maildomainid
- selligent_listid
- selligent_segmentid
- selligent_queueid
- selligent_macategory


## Read More

- Illustrated [Reference](doc/Reference/Readme.md) of all available API endpoints.
- Little use case [Example](doc/Example.md) from connection to triggering campaign
- You could use PSR3 to [log informations from this library](doc/Logging.md).
- You could [broadcast campaign based on complete HTML](doc/Broadcast.md) from the API.
7 changes: 7 additions & 0 deletions config/broadcast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
login: ~
password: ~
namespace: "http://tempuri.org/"
wsdl: ~
options:
classmap:
CreateCampaignResponse: "Mediapart\\Selligent\\Response\\CreateCampaignResponse"
8 changes: 0 additions & 8 deletions config/broadcast_default_config.yaml

This file was deleted.

38 changes: 38 additions & 0 deletions config/individual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
login: ~
password: ~
namespace: "http://tempuri.org/"
wsdl: ~
list:
options:
classmap:
ArrayOfListInfo: "Mediapart\\Selligent\\ArrayOfListInfo"
ListInfo: "Mediapart\\Selligent\\ListInfo"
Property: "Mediapart\\Selligent\\Property"
ArrayOfProperty: "Mediapart\\Selligent\\Properties"
# System info
GetSystemStatusResponse: "Mediapart\\Selligent\\Response\\GetSystemStatusResponse"
# Manage Lists
GetListsResponse: "Mediapart\\Selligent\\Response\\GetListsResponse"
GetListIDResponse: "Mediapart\\Selligent\\Response\\GetListIDResponse"
# Manage Segments
CreateSegmentResponse: "Mediapart\\Selligent\\Response\\CreateSegmentResponse"
AddToSegmentResponse: "Mediapart\\Selligent\\Response\\AddToSegmentResponse"
GetSegmentsResponse: "Mediapart\\Selligent\\Response\\GetSegmentsResponse"
GetSegmentRecordCountResponse: "Mediapart\\Selligent\\Response\\GetSegmentRecordCountResponse"
# Manage Users
CreateUserResponse: "Mediapart\\Selligent\\Response\\CreateUserResponse"
UpdateUserResponse: "Mediapart\\Selligent\\Response\\UpdateUserResponse"
UpdateUsersResponse: "Mediapart\\Selligent\\Response\\UpdateUsersResponse"
GetUserByIDResponse: "Mediapart\\Selligent\\Response\\GetUserByIDResponse"
RetrieveHashForUserResponse: "Mediapart\\Selligent\\Response\\RetrieveHashForUserResponse"
CountUsersByConstraintResponse: "Mediapart\\Selligent\\Response\\CountUsersByConstraintResponse"
GetUsersByConstraintResponse: "Mediapart\\Selligent\\Response\\GetUsersByConstraintResponse"
GetUserByConstraintResponse: "Mediapart\\Selligent\\Response\\GetUserByConstraintResponse"
CountUsersByFilterResponse: "Mediapart\\Selligent\\Response\\CountUsersByFilterResponse"
GetUsersByFilterResponse: "Mediapart\\Selligent\\Response\\GetUsersByFilterResponse"
GetUserByFilterResponse: "Mediapart\\Selligent\\Response\\GetUserByFilterResponse"
# Manage Campaign
TriggerCampaignResponse: "Mediapart\\Selligent\\Response\\TriggerCampaignResponse"
TriggerCampaignWithResultResponse: "Mediapart\\Selligent\\Response\\TriggerCampaignWithResultResponse"
TriggerCampaignForUserResponse: "Mediapart\\Selligent\\Response\\TriggerCampaignForUserResponse"
TriggerCampaignForUserWithResultResponse: "Mediapart\\Selligent\\Response\\TriggerCampaignForUserWithResultResponse"
39 changes: 0 additions & 39 deletions config/individual_default_config.yaml

This file was deleted.

45 changes: 45 additions & 0 deletions doc/Broadcast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Broadcast Complete HTML Campaign

```php
<?php

namespace Mediapart\Selligent;

/*
Open a connection to Selligent.
*/
$connection = new Connection();
$client = $connection->open(
[
'login' => '*****',
'password' => '*****',
'wsdl' => 'http://emsecure/broadcast?wsdl',
],
Connection::API_BROADCAST
);

/*
Create your campaign.
For complete options, see directly the Selligent API reference and
our implementation in /src/Broadcast/ classes.
*/
$campaign = new Campaign();
$campaign
->setName('Campaign Test')
->setState(Campaign::ACTIVE)
->setStartDate(new DateTime('tomorrow'))
->setDescription('Some campaign test scheduled for tomorrow.')
;
// ...

$writer = new XMLWriter();
$request = new CreateCampaign($writer);
$xml = $request->basedOn($campaign);
$response = $this->client->CreateCampaign(['Xml' => $xml]);

if ($response==Response::SUCCESSFUL) {
print 'Your campaign has been created';
}

```
11 changes: 5 additions & 6 deletions doc/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@

namespace Mediapart\Selligent;

$configFile = file_get_contents(
__DIR__.'/config/individual_default_config.yaml'
);
$cfg = new \Mediapart\Selligent\Configuration();

/*
Open a connection to Selligent.
*/
$connection = new Connection();
$client = $connection->open($cfg->loadConfig($configFile));
$client = $connection->open([
'login' => '*****',
'password' => '*****',
'wsdl' => 'http://emsecure/individual?wsdl',
]);

/*
Output lists infos.
Expand Down
6 changes: 4 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<testsuites>
<testsuite name="default">
<directory>./tests</directory>
<exclude>./tests/RealTest.php</exclude>
<exclude>./tests/IndividualTest.php</exclude>
<exclude>./tests/BroadcastTest.php</exclude>
</testsuite>
<testsuite name="real">
<file>./tests/RealTest.php</file>
<file>./tests/IndividualTest.php</file>
<file>./tests/BroadcastTest.php</file>
</testsuite>
</testsuites>

Expand Down
Loading

0 comments on commit 5339765

Please sign in to comment.