Skip to content

Commit

Permalink
Merge pull request #26 from andresrivas1506/master
Browse files Browse the repository at this point in the history
send campaign method
  • Loading branch information
JacobBennett committed Mar 10, 2016
2 parents da76729 + 0899be3 commit cc43cad
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/SendyPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,40 @@ public function subcount($list = "")
);
}

public function createCampaign(array $values)
{
$type = 'api/campaigns/create.php';

//Global options
$global_options = array(
'api_key' => $this->api_key
);

//Merge the passed in values with the global options
$values = array_merge($global_options, $values);

//Send request for campaign
$result = $this->buildAndSend($type, $values);

//Handle the results
switch ($result) {
case 'Campaign created':
case 'Campaign created and now sending':
return array(
'status' => true,
'message' => $result
);
break;

default:
return array(
'status' => false,
'message' => $result
);
break;
}
}

private function buildAndSend($type, array $values)
{
//error checking
Expand Down

0 comments on commit cc43cad

Please sign in to comment.