Skip to content

Commit

Permalink
option to send autoresponders true/false
Browse files Browse the repository at this point in the history
  • Loading branch information
medutis committed Apr 19, 2016
1 parent c8bc570 commit b52a04c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/MailerLite/Subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

class Subscribers extends Base\Rest {

public $autoresponders = null;

public function __construct($apiKey)
{
$this->name = 'subscribers';
Expand All @@ -13,13 +15,27 @@ public function __construct($apiKey)
public function add($subscriber = null, $resubscribe = 0)
{
$subscriber['resubscribe'] = $resubscribe;

if (is_null($this->autoresponders)) {
$this->autoresponders = true;
}

$subscriber['autoresponders'] = $this->autoresponders;

return $this->execute('POST', $subscriber);
}

function addAll($subscribers, $resubscribe = 0)
{
$data['resubscribe'] = $resubscribe;
$data['subscribers'] = $subscribers;

if (is_null($this->autoresponders)) {
$this->autoresponders = false;
}

$data['autoresponders'] = $this->autoresponders;

$this->path .= 'import/';
return $this->execute('POST', $data);
}
Expand Down Expand Up @@ -55,4 +71,10 @@ public function unsubscribe($email)
return $result;
}

public function setAutoresponders($autoresponders = true)
{
$this->autoresponders = $autoresponders;

return $this;
}
}

0 comments on commit b52a04c

Please sign in to comment.