| 1 | package Sailthru::Client; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | |||||||||||||||||||
| 6 | 5 | ▶ | use Carp; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | 5 | ▶ | use JSON::XS; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 8 | 5 | ▶ | use LWP::UserAgent; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | 5 | ▶ | use Digest::MD5 qw( md5_hex ); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 10 | 5 | ▶ | use Params::Validate qw( :all ); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 11 | 5 | ▶ | use Readonly; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 12 | 5 | ▶ | use URI; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | 5 | our $VERSION = '2.002'; | |||||||||||||||||
| 15 | 5 | Readonly my $API_URI => 'https://api.sailthru.com/'; | |||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | # | ||||||||||||||||||
| 18 | # public api | ||||||||||||||||||
| 19 | # | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | # args: | ||||||||||||||||||
| 22 | # | ||||||||||||||||||
| 23 | # * api_key - scalar | ||||||||||||||||||
| 24 | # * secret - scalar | ||||||||||||||||||
| 25 | # * timeout - scalar (optional) | ||||||||||||||||||
| 26 | sub new { | ||||||||||||||||||
| 27 | 5 | ▶ | my ( $class, $api_key, $secret, $timeout ) = @_; | ||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||
| 28 | 5 | my $self = { | |||||||||||||||||
| 29 | api_key => $api_key, | ||||||||||||||||||
| 30 | secret => $secret, | ||||||||||||||||||
| 31 | ua => LWP::UserAgent->new, | ||||||||||||||||||
| 32 | }; | ||||||||||||||||||
| 33 | 5 | ▶ | $self->{ua}->timeout($timeout) if $timeout; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 34 | 5 | $self->{ua}->default_header( 'User-Agent' => "Sailthru API Perl Client $VERSION" ); | |||||||||||||||||
| 35 | 5 | return bless $self, $class; | |||||||||||||||||
| 36 | } | ||||||||||||||||||
| 37 | |||||||||||||||||||
| 38 | # args: | ||||||||||||||||||
| 39 | # | ||||||||||||||||||
| 40 | # * template_name - scalar | ||||||||||||||||||
| 41 | # * email - scalar | ||||||||||||||||||
| 42 | # * vars - hashref (optional) | ||||||||||||||||||
| 43 | # * options - hashref (optional) | ||||||||||||||||||
| 44 | # * schedule_time - scalar (optional) | ||||||||||||||||||
| 45 | sub send { | ||||||||||||||||||
| 46 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
send: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||
| 47 | 2 | my @params = validate_pos( | |||||||||||||||||
| 48 | @_, | ||||||||||||||||||
| 49 | { type => SCALAR }, | ||||||||||||||||||
| 50 | { type => SCALAR }, | ||||||||||||||||||
| 51 | { type => HASHREF, default => {} }, | ||||||||||||||||||
| 52 | { type => HASHREF, default => {} }, | ||||||||||||||||||
| 53 | { type => SCALAR, default => undef } | ||||||||||||||||||
| 54 | ); | ||||||||||||||||||
| 55 | 2 | my ( $template_name, $email, $vars, $options, $schedule_time ) = @params; | |||||||||||||||||
| 56 | 2 | my $data = {}; | |||||||||||||||||
| 57 | 2 | $data->{template} = $template_name; | |||||||||||||||||
| 58 | 2 | $data->{email} = $email; | |||||||||||||||||
| 59 | 2 | ▶ | $data->{vars} = $vars if keys %{$vars}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 60 | 2 | ▶ | $data->{options} = $options if keys %{$options}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 61 | 2 | ▶ | $data->{schedule_time} = $schedule_time if $schedule_time; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 62 | 2 | return $self->api_post( 'send', $data ); | |||||||||||||||||
| 63 | } | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | # args: | ||||||||||||||||||
| 66 | # * send_id - scalar | ||||||||||||||||||
| 67 | sub get_send { | ||||||||||||||||||
| 68 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
get_send: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 69 | 2 | my @params = validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||
| 70 | 2 | my ($send_id) = @params; | |||||||||||||||||
| 71 | 2 | return $self->api_get( 'send', { send_id => $send_id } ); | |||||||||||||||||
| 72 | } | ||||||||||||||||||
| 73 | |||||||||||||||||||
| 74 | # args: | ||||||||||||||||||
| 75 | # * email - scalar | ||||||||||||||||||
| 76 | sub get_email { | ||||||||||||||||||
| 77 | 3 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
get_email: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 78 | 3 | my @params = validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||
| 79 | 3 | my ($email) = @params; | |||||||||||||||||
| 80 | 3 | return $self->api_get( 'email', { email => $email } ); | |||||||||||||||||
| 81 | } | ||||||||||||||||||
| 82 | |||||||||||||||||||
| 83 | # args: | ||||||||||||||||||
| 84 | # * email - scalar | ||||||||||||||||||
| 85 | # * vars - hashref (optional) | ||||||||||||||||||
| 86 | # * lists - hashref (optional) | ||||||||||||||||||
| 87 | # * templates - hashref (optional) | ||||||||||||||||||
| 88 | sub set_email { | ||||||||||||||||||
| 89 | 3 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
set_email: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||
| 90 | 3 | my @params = validate_pos( | |||||||||||||||||
| 91 | @_, | ||||||||||||||||||
| 92 | { type => SCALAR }, | ||||||||||||||||||
| 93 | { type => HASHREF, default => {} }, | ||||||||||||||||||
| 94 | { type => HASHREF, default => {} }, | ||||||||||||||||||
| 95 | { type => HASHREF, default => {} } | ||||||||||||||||||
| 96 | ); | ||||||||||||||||||
| 97 | 3 | my ( $email, $vars, $lists, $templates ) = @params; | |||||||||||||||||
| 98 | 3 | my $data = {}; | |||||||||||||||||
| 99 | 3 | $data->{email} = $email; | |||||||||||||||||
| 100 | 3 | ▶ | $data->{vars} = $vars if keys %{$vars}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 101 | 3 | ▶ | $data->{lists} = $lists if keys %{$lists}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 102 | 3 | ▶ | $data->{templates} = $templates if keys %{$templates}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 103 | 3 | return $self->api_post( 'email', $data ); | |||||||||||||||||
| 104 | } | ||||||||||||||||||
| 105 | |||||||||||||||||||
| 106 | # args: | ||||||||||||||||||
| 107 | # * name - scalar | ||||||||||||||||||
| 108 | # * list - scalar | ||||||||||||||||||
| 109 | # * schedule_time - scalar | ||||||||||||||||||
| 110 | # * from_name - scalar | ||||||||||||||||||
| 111 | # * from_email - scalar | ||||||||||||||||||
| 112 | # * subject - scalar | ||||||||||||||||||
| 113 | # * content_html - scalar | ||||||||||||||||||
| 114 | # * content_text - scalar | ||||||||||||||||||
| 115 | # * options - hashref (optional) | ||||||||||||||||||
| 116 | sub schedule_blast { | ||||||||||||||||||
| 117 | 3 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
schedule_blast: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 118 | 3 | my @params = validate_pos( | |||||||||||||||||
| 119 | @_, | ||||||||||||||||||
| 120 | { type => SCALAR }, | ||||||||||||||||||
| 121 | { type => SCALAR }, | ||||||||||||||||||
| 122 | { type => SCALAR }, | ||||||||||||||||||
| 123 | { type => SCALAR }, | ||||||||||||||||||
| 124 | { type => SCALAR }, | ||||||||||||||||||
| 125 | { type => SCALAR }, | ||||||||||||||||||
| 126 | { type => SCALAR }, | ||||||||||||||||||
| 127 | { type => SCALAR }, | ||||||||||||||||||
| 128 | { type => HASHREF, default => {} } | ||||||||||||||||||
| 129 | ); | ||||||||||||||||||
| 130 | 3 | my ( $name, $list, $schedule_time, $from_name, $from_email, $subject, $content_html, $content_text, $options ) = | |||||||||||||||||
| 131 | @params; | ||||||||||||||||||
| 132 | # initialize our data hash by copying the contents of the options hash | ||||||||||||||||||
| 133 | 3 | my $data = { %{$options} }; | |||||||||||||||||
| 134 | 3 | $data->{name} = $name; | |||||||||||||||||
| 135 | 3 | $data->{list} = $list; | |||||||||||||||||
| 136 | 3 | $data->{schedule_time} = $schedule_time; | |||||||||||||||||
| 137 | 3 | $data->{from_name} = $from_name; | |||||||||||||||||
| 138 | 3 | $data->{from_email} = $from_email; | |||||||||||||||||
| 139 | 3 | $data->{subject} = $subject; | |||||||||||||||||
| 140 | 3 | $data->{content_html} = $content_html; | |||||||||||||||||
| 141 | 3 | $data->{content_text} = $content_text; | |||||||||||||||||
| 142 | 3 | return $self->api_post( 'blast', $data ); | |||||||||||||||||
| 143 | } | ||||||||||||||||||
| 144 | |||||||||||||||||||
| 145 | # args: | ||||||||||||||||||
| 146 | # * template_name - scalar | ||||||||||||||||||
| 147 | # * list - scalar | ||||||||||||||||||
| 148 | # * schedule_time - scalar | ||||||||||||||||||
| 149 | # * options - hashref (optional) | ||||||||||||||||||
| 150 | sub schedule_blast_from_template { | ||||||||||||||||||
| 151 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
schedule_blast_from_template: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 152 | 2 | my @params = validate_pos( | |||||||||||||||||
| 153 | @_, | ||||||||||||||||||
| 154 | { type => SCALAR }, | ||||||||||||||||||
| 155 | { type => SCALAR }, | ||||||||||||||||||
| 156 | { type => SCALAR }, | ||||||||||||||||||
| 157 | { type => HASHREF, default => {} }, | ||||||||||||||||||
| 158 | ); | ||||||||||||||||||
| 159 | 2 | my ( $template_name, $list, $schedule_time, $options ) = @params; | |||||||||||||||||
| 160 | # initialize our data hash by copying the contents of the options hash | ||||||||||||||||||
| 161 | 2 | my $data = { %{$options} }; | |||||||||||||||||
| 162 | 2 | $data->{copy_template} = $template_name; | |||||||||||||||||
| 163 | 2 | $data->{list} = $list; | |||||||||||||||||
| 164 | 2 | $data->{schedule_time} = $schedule_time; | |||||||||||||||||
| 165 | 2 | return $self->api_post( 'blast', $data ); | |||||||||||||||||
| 166 | |||||||||||||||||||
| 167 | } | ||||||||||||||||||
| 168 | |||||||||||||||||||
| 169 | # args: | ||||||||||||||||||
| 170 | # * blast_id - scalar | ||||||||||||||||||
| 171 | sub get_blast { | ||||||||||||||||||
| 172 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
get_blast: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 173 | 2 | my @params = validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||
| 174 | 2 | my ($blast_id) = @params; | |||||||||||||||||
| 175 | 2 | return $self->api_get( 'blast', { blast_id => $blast_id } ); | |||||||||||||||||
| 176 | } | ||||||||||||||||||
| 177 | |||||||||||||||||||
| 178 | # args: | ||||||||||||||||||
| 179 | # * template_name - scalar | ||||||||||||||||||
| 180 | sub get_template { | ||||||||||||||||||
| 181 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
get_template: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 182 | 2 | my @params = validate_pos( @_, { type => SCALAR } ); | |||||||||||||||||
| 183 | 2 | my ($template_name) = @params; | |||||||||||||||||
| 184 | 2 | return $self->api_get( 'template', { template => $template_name } ); | |||||||||||||||||
| 185 | } | ||||||||||||||||||
| 186 | |||||||||||||||||||
| 187 | # args: | ||||||||||||||||||
| 188 | # * action - scalar | ||||||||||||||||||
| 189 | # * data - hashref | ||||||||||||||||||
| 190 | sub api_get { | ||||||||||||||||||
| 191 | 10 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
api_get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 192 | 10 | my @params = validate_pos( @_, { type => SCALAR }, { type => HASHREF } ); | |||||||||||||||||
| 193 | 10 | my ( $action, $data ) = @params; | |||||||||||||||||
| 194 | 10 | return $self->_api_request( $action, $data, 'GET' ); | |||||||||||||||||
| 195 | } | ||||||||||||||||||
| 196 | |||||||||||||||||||
| 197 | # args: | ||||||||||||||||||
| 198 | # * action - scalar | ||||||||||||||||||
| 199 | # * data - hashref | ||||||||||||||||||
| 200 | # * TODO: optional binary_key arg | ||||||||||||||||||
| 201 | sub api_post { | ||||||||||||||||||
| 202 | 15 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
api_post: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 203 | 15 | my @params = validate_pos( @_, { type => SCALAR }, { type => HASHREF } ); | |||||||||||||||||
| 204 | 15 | my ( $action, $data ) = @params; | |||||||||||||||||
| 205 | 15 | return $self->_api_request( $action, $data, 'POST' ); | |||||||||||||||||
| 206 | } | ||||||||||||||||||
| 207 | |||||||||||||||||||
| 208 | # args: | ||||||||||||||||||
| 209 | # * action - scalar | ||||||||||||||||||
| 210 | # * data - hashref | ||||||||||||||||||
| 211 | sub api_delete { | ||||||||||||||||||
| 212 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
api_delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||
| 213 | 1 | my @params = validate_pos( @_, { type => SCALAR }, { type => HASHREF } ); | |||||||||||||||||
| 214 | 1 | my ( $action, $data ) = @params; | |||||||||||||||||
| 215 | 1 | return $self->_api_request( $action, $data, 'DELETE' ); | |||||||||||||||||
| 216 | } | ||||||||||||||||||
| 217 | |||||||||||||||||||
| 218 | # | ||||||||||||||||||
| 219 | # private helper methods | ||||||||||||||||||
| 220 | # | ||||||||||||||||||
| 221 | |||||||||||||||||||
| 222 | # args: | ||||||||||||||||||
| 223 | # * action - scalar | ||||||||||||||||||
| 224 | # * data - hashref | ||||||||||||||||||
| 225 | # * request_type - scalar | ||||||||||||||||||
| 226 | sub _api_request { | ||||||||||||||||||
| 227 | 4 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
_api_request: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 228 | 4 | my @params = validate_pos( @_, { type => SCALAR }, { type => HASHREF }, { type => SCALAR } ); | |||||||||||||||||
| 229 | 4 | my ( $action, $data, $request_type ) = @params; | |||||||||||||||||
| 230 | 4 | my $payload = $self->_prepare_json_payload($data); | |||||||||||||||||
| 231 | 4 | my $action_uri = $API_URI . $action; | |||||||||||||||||
| 232 | 4 | my $response = $self->_http_request( $action_uri, $payload, $request_type ); | |||||||||||||||||
| 233 | 4 | return decode_json( $response->content ); | |||||||||||||||||
| 234 | } | ||||||||||||||||||
| 235 | |||||||||||||||||||
| 236 | # args: | ||||||||||||||||||
| 237 | # * uri - scalar | ||||||||||||||||||
| 238 | # * data - hashref | ||||||||||||||||||
| 239 | # * method - scalar | ||||||||||||||||||
| 240 | sub _http_request { | ||||||||||||||||||
| 241 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
_http_request: called CC=4 SCAR=17.4
| |||||||||||||||||||
| 242 | 1 | my @params = validate_pos( @_, { type => SCALAR }, { type => HASHREF }, { type => SCALAR } ); | |||||||||||||||||
| 243 | 1 | my ( $uri, $data, $method ) = @params; | |||||||||||||||||
| 244 | 1 | $uri = URI->new($uri); | |||||||||||||||||
| 245 | 1 | my $response; | |||||||||||||||||
| 246 | 1 | ▶ | if ( $method eq 'GET' ) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 247 | 1 | $uri->query_form($data); | |||||||||||||||||
| 248 | 1 | $response = $self->{ua}->get($uri); | |||||||||||||||||
| 249 | } | ||||||||||||||||||
| 250 | elsif ( $method eq 'POST' ) { | ||||||||||||||||||
| 251 | 0 | $response = $self->{ua}->post( $uri, $data ); | |||||||||||||||||
| 252 | } | ||||||||||||||||||
| 253 | elsif ( $method eq 'DELETE' ) { | ||||||||||||||||||
| 254 | 0 | $uri->query_form($data); | |||||||||||||||||
| 255 | 0 | $response = $self->{ua}->delete($uri); | |||||||||||||||||
| 256 | } | ||||||||||||||||||
| 257 | else { | ||||||||||||||||||
| 258 | 0 | croak "Invalid method: $method"; | |||||||||||||||||
| 259 | } | ||||||||||||||||||
| 260 | 1 | return $response; | |||||||||||||||||
| 261 | } | ||||||||||||||||||
| 262 | |||||||||||||||||||
| 263 | # args: | ||||||||||||||||||
| 264 | # * data - hashref | ||||||||||||||||||
| 265 | sub _prepare_json_payload { | ||||||||||||||||||
| 266 | 4 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
_prepare_json_payload: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 267 | 4 | my @params = validate_pos( @_, { type => HASHREF } ); | |||||||||||||||||
| 268 | 4 | my ($data) = @params; | |||||||||||||||||
| 269 | 4 | my $payload = {}; | |||||||||||||||||
| 270 | 4 | $payload->{api_key} = $self->{api_key}; | |||||||||||||||||
| 271 | 4 | $payload->{format} = 'json'; | |||||||||||||||||
| 272 | # this gives us nice clean utf8 encoded json text | ||||||||||||||||||
| 273 | 4 | $payload->{json} = encode_json($data); | |||||||||||||||||
| 274 | 4 | $payload->{sig} = $self->_get_signature_hash( $payload, $self->{secret} ); | |||||||||||||||||
| 275 | 4 | return $payload; | |||||||||||||||||
| 276 | } | ||||||||||||||||||
| 277 | |||||||||||||||||||
| 278 | # Every request must also generate a signature hash called sig according to the | ||||||||||||||||||
| 279 | # following rules: | ||||||||||||||||||
| 280 | # | ||||||||||||||||||
| 281 | # * take the string values of every parameter, including api_key | ||||||||||||||||||
| 282 | # * sort the values alphabetically, case-sensitively (i.e. ordered by Unicode code point) | ||||||||||||||||||
| 283 | # * concatenate the sorted values, and prepend this string with your shared secret | ||||||||||||||||||
| 284 | # * generate an MD5 hash of this string and use this as sig | ||||||||||||||||||
| 285 | # * now generate your URL-encoded query string from your parameters plus sig | ||||||||||||||||||
| 286 | |||||||||||||||||||
| 287 | # args: | ||||||||||||||||||
| 288 | # * params - hashref | ||||||||||||||||||
| 289 | # * secret - scalar | ||||||||||||||||||
| 290 | # NOTE This internal method assumes a single level hash with values for only 'api_key', 'format', and 'json' | ||||||||||||||||||
| 291 | # NOTE Since we pack everything into the 'json' value this is safe and we do not need to recurse down a nested hash. | ||||||||||||||||||
| 292 | sub _get_signature_hash { | ||||||||||||||||||
| 293 | 6 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
_get_signature_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 294 | 6 | my @params = validate_pos( @_, { type => HASHREF }, { type => SCALAR } ); | |||||||||||||||||
| 295 | 6 | my ( $api_param_hash, $secret ) = @params; | |||||||||||||||||
| 296 | 6 | my @api_param_values = values %{$api_param_hash}; | |||||||||||||||||
| 297 | 6 | my $sig_string = join '', $secret, sort @api_param_values; | |||||||||||||||||
| 298 | # assumes utf8 encoded text, works fine because we use encode_json internally | ||||||||||||||||||
| 299 | 6 | return md5_hex($sig_string); | |||||||||||||||||
| 300 | } | ||||||||||||||||||
| 301 | |||||||||||||||||||
| 302 | ### XXX | ||||||||||||||||||
| 303 | ### DEPRECATED METHODS | ||||||||||||||||||
| 304 | ### XXX | ||||||||||||||||||
| 305 | |||||||||||||||||||
| 306 | # args: | ||||||||||||||||||
| 307 | # * email - scalar | ||||||||||||||||||
| 308 | sub getEmail { | ||||||||||||||||||
| 309 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
getEmail: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 310 | 1 | warnings::warnif( 'deprecated', 'getEmail is deprecated, use get_email instead' ); | |||||||||||||||||
| 311 | 1 | return $self->get_email(@_); | |||||||||||||||||
| 312 | } | ||||||||||||||||||
| 313 | |||||||||||||||||||
| 314 | # args: | ||||||||||||||||||
| 315 | # * email - scalar | ||||||||||||||||||
| 316 | # * vars - hashref (optional) | ||||||||||||||||||
| 317 | # * lists - hashref (optional) | ||||||||||||||||||
| 318 | # * templates - hashref (optional) | ||||||||||||||||||
| 319 | sub setEmail { | ||||||||||||||||||
| 320 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
setEmail: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 321 | 1 | warnings::warnif( 'deprecated', 'setEmail is deprecated, use set_email instead' ); | |||||||||||||||||
| 322 | 1 | return $self->set_email(@_); | |||||||||||||||||
| 323 | } | ||||||||||||||||||
| 324 | |||||||||||||||||||
| 325 | # args: | ||||||||||||||||||
| 326 | # * send_id - scalar | ||||||||||||||||||
| 327 | sub getSend { | ||||||||||||||||||
| 328 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
getSend: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 329 | 1 | warnings::warnif( 'deprecated', 'getSend is deprecated, use get_send instead' ); | |||||||||||||||||
| 330 | 1 | return $self->get_send(@_); | |||||||||||||||||
| 331 | } | ||||||||||||||||||
| 332 | |||||||||||||||||||
| 333 | # args: | ||||||||||||||||||
| 334 | # * name - scalar | ||||||||||||||||||
| 335 | # * list - scalar | ||||||||||||||||||
| 336 | # * schedule_time - scalar | ||||||||||||||||||
| 337 | # * from_name - scalar | ||||||||||||||||||
| 338 | # * from_email - scalar | ||||||||||||||||||
| 339 | # * subject - scalar | ||||||||||||||||||
| 340 | # * content_html - scalar | ||||||||||||||||||
| 341 | # * content_text - scalar | ||||||||||||||||||
| 342 | # * options - hashref (optional) | ||||||||||||||||||
| 343 | sub scheduleBlast { | ||||||||||||||||||
| 344 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
scheduleBlast: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 345 | 1 | warnings::warnif( 'deprecated', 'scheduleBlast is deprecated, use schedule_blast instead' ); | |||||||||||||||||
| 346 | 1 | return $self->schedule_blast(@_); | |||||||||||||||||
| 347 | } | ||||||||||||||||||
| 348 | |||||||||||||||||||
| 349 | # args: | ||||||||||||||||||
| 350 | # * blast_id - scalar | ||||||||||||||||||
| 351 | sub getBlast { | ||||||||||||||||||
| 352 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
getBlast: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 353 | 1 | warnings::warnif( 'deprecated', 'getBlast is deprecated, use get_blast instead' ); | |||||||||||||||||
| 354 | 1 | return $self->get_blast(@_); | |||||||||||||||||
| 355 | } | ||||||||||||||||||
| 356 | |||||||||||||||||||
| 357 | sub copyTemplate { | ||||||||||||||||||
| 358 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
copyTemplate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 359 | 2 | my @params = validate_pos( | |||||||||||||||||
| 360 | @_, | ||||||||||||||||||
| 361 | { type => SCALAR }, | ||||||||||||||||||
| 362 | { type => SCALAR }, | ||||||||||||||||||
| 363 | { type => SCALAR }, | ||||||||||||||||||
| 364 | { type => SCALAR }, | ||||||||||||||||||
| 365 | { type => SCALAR }, | ||||||||||||||||||
| 366 | { type => SCALAR }, | ||||||||||||||||||
| 367 | { type => HASHREF, default => {} } | ||||||||||||||||||
| 368 | ); | ||||||||||||||||||
| 369 | 2 | my ( $template, $data_feed, $setup, $subject_line, $schedule_time, $list, $options ) = @params; | |||||||||||||||||
| 370 | 2 | warnings::warnif( 'deprecated', 'copyTemplate is deprecated, use schedule_blast_from_template instead' ); | |||||||||||||||||
| 371 | # initialize our data hash by copying the contents of the options hash | ||||||||||||||||||
| 372 | 2 | my $data = { %{$options} }; | |||||||||||||||||
| 373 | 2 | $data->{copy_template} = $template; | |||||||||||||||||
| 374 | 2 | $data->{data_feed_url} = $data_feed; | |||||||||||||||||
| 375 | 2 | $data->{setup} = $setup; | |||||||||||||||||
| 376 | 2 | $data->{name} = $subject_line; | |||||||||||||||||
| 377 | 2 | $data->{schedule_time} = $schedule_time; | |||||||||||||||||
| 378 | 2 | $data->{list} = $list; | |||||||||||||||||
| 379 | 2 | return $self->api_post( 'blast', $data ); | |||||||||||||||||
| 380 | } | ||||||||||||||||||
| 381 | |||||||||||||||||||
| 382 | # args: | ||||||||||||||||||
| 383 | # * template_name - scalar | ||||||||||||||||||
| 384 | sub getTemplate { | ||||||||||||||||||
| 385 | 1 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
getTemplate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 386 | 1 | warnings::warnif( 'deprecated', 'getTemplate is deprecated, use get_template instead' ); | |||||||||||||||||
| 387 | 1 | return $self->get_template(@_); | |||||||||||||||||
| 388 | } | ||||||||||||||||||
| 389 | |||||||||||||||||||
| 390 | # args: | ||||||||||||||||||
| 391 | # * email - scalar | ||||||||||||||||||
| 392 | # * password - scalar | ||||||||||||||||||
| 393 | # * include_names - scalar (optional) | ||||||||||||||||||
| 394 | sub importContacts { | ||||||||||||||||||
| 395 | 2 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
importContacts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||
| 396 | 2 | my @p = validate_pos( @_, { type => SCALAR }, { type => SCALAR }, { type => SCALAR, default => 0 } ); | |||||||||||||||||
| 397 | 2 | my ( $email, $password, $include_names ) = @p; | |||||||||||||||||
| 398 | 2 | warnings::warnif( 'deprecated', | |||||||||||||||||
| 399 | 'importContacts is deprecated. The contacts API has been discontinued as of August 1st, 2011.' ); | ||||||||||||||||||
| 400 | 2 | my $data = { | |||||||||||||||||
| 401 | email => $email, | ||||||||||||||||||
| 402 | password => $password, | ||||||||||||||||||
| 403 | include_names => $include_names, | ||||||||||||||||||
| 404 | }; | ||||||||||||||||||
| 405 | 2 | return $self->api_post( 'contacts', $data ); | |||||||||||||||||
| 406 | } | ||||||||||||||||||
| 407 | |||||||||||||||||||
| 408 | 5 | 1; | |||||||||||||||||
| 409 | |||||||||||||||||||
| 410 | __END__ | ||||||||||||||||||
| 411 | |||||||||||||||||||
| 412 | =head1 NAME | ||||||||||||||||||
| 413 | |||||||||||||||||||
| 414 | Sailthru::Client - Perl module for accessing Sailthru's API | ||||||||||||||||||
| 415 | |||||||||||||||||||
| 416 | =head1 SYNOPSIS | ||||||||||||||||||
| 417 | |||||||||||||||||||
| 418 | use Sailthru::Client; | ||||||||||||||||||
| 419 | |||||||||||||||||||
| 420 | # instantiate a new Sailthru::Client with an api_key and secret | ||||||||||||||||||
| 421 | $sc = Sailthru::Client->new('api_key', 'secret'); | ||||||||||||||||||
| 422 | |||||||||||||||||||
| 423 | # send an email to a single email address | ||||||||||||||||||
| 424 | %vars = ( | ||||||||||||||||||
| 425 | name => "Joe Example", | ||||||||||||||||||
| 426 | from_email => "approved_email@your_domain.com", | ||||||||||||||||||
| 427 | your_variable => "some_value" | ||||||||||||||||||
| 428 | ); | ||||||||||||||||||
| 429 | %options = ( reply_to => "your reply_to header"); | ||||||||||||||||||
| 430 | $sc->send('template_name', 'example@example.com', \%vars, \%options); | ||||||||||||||||||
| 431 | |||||||||||||||||||
| 432 | =head1 DESCRIPTION | ||||||||||||||||||
| 433 | |||||||||||||||||||
| 434 | Sailthru::Client is a Perl module for accessing the Sailthru API. | ||||||||||||||||||
| 435 | |||||||||||||||||||
| 436 | Methods return a reference to a hash containing the response values. Dump the | ||||||||||||||||||
| 437 | hash or read the Sailthru API documentation for which values are returned | ||||||||||||||||||
| 438 | by which API calls. | ||||||||||||||||||
| 439 | |||||||||||||||||||
| 440 | L<http://docs.sailthru.com/api> | ||||||||||||||||||
| 441 | |||||||||||||||||||
| 442 | Some options might change. Consult the Sailthru API documentation for | ||||||||||||||||||
| 443 | the latest information. | ||||||||||||||||||
| 444 | |||||||||||||||||||
| 445 | =head1 METHODS | ||||||||||||||||||
| 446 | |||||||||||||||||||
| 447 | =head2 Sailthru::Client->new( $api_key, $secret, [$timeout] ) | ||||||||||||||||||
| 448 | |||||||||||||||||||
| 449 | Returns a new Sailthru::Client object. | ||||||||||||||||||
| 450 | |||||||||||||||||||
| 451 | =over | ||||||||||||||||||
| 452 | |||||||||||||||||||
| 453 | =item $api_key | ||||||||||||||||||
| 454 | |||||||||||||||||||
| 455 | Sailthru API key. | ||||||||||||||||||
| 456 | |||||||||||||||||||
| 457 | =item $secret | ||||||||||||||||||
| 458 | |||||||||||||||||||
| 459 | Sailthru API secret. | ||||||||||||||||||
| 460 | |||||||||||||||||||
| 461 | =item $timeout | ||||||||||||||||||
| 462 | |||||||||||||||||||
| 463 | Optional network timeout in seconds. | ||||||||||||||||||
| 464 | |||||||||||||||||||
| 465 | =back | ||||||||||||||||||
| 466 | |||||||||||||||||||
| 467 | =head2 $sc->send( $template_name, $email, [\%vars, \%options, $schedule_time] ) | ||||||||||||||||||
| 468 | |||||||||||||||||||
| 469 | Remotely send an email template to a single email address. | ||||||||||||||||||
| 470 | |||||||||||||||||||
| 471 | API docs: L<http://docs.sailthru.com/api/send> | ||||||||||||||||||
| 472 | |||||||||||||||||||
| 473 | =over | ||||||||||||||||||
| 474 | |||||||||||||||||||
| 475 | =item $template_name | ||||||||||||||||||
| 476 | |||||||||||||||||||
| 477 | The name of the template to send. | ||||||||||||||||||
| 478 | |||||||||||||||||||
| 479 | =item $email | ||||||||||||||||||
| 480 | |||||||||||||||||||
| 481 | The email address to send to. | ||||||||||||||||||
| 482 | |||||||||||||||||||
| 483 | =item \%vars | ||||||||||||||||||
| 484 | |||||||||||||||||||
| 485 | An optional hashref of the replacement vars to use in the send. Each var may be referenced as {varname} within the template itself. | ||||||||||||||||||
| 486 | |||||||||||||||||||
| 487 | =item \%options | ||||||||||||||||||
| 488 | |||||||||||||||||||
| 489 | An optional hashref to include a replyto header, test keys, etc. See the API documentation for details. | ||||||||||||||||||
| 490 | |||||||||||||||||||
| 491 | =item $schedule_time | ||||||||||||||||||
| 492 | |||||||||||||||||||
| 493 | Do not send the email immediately, but at some point in the future. Any date recognized by PHP's strtotime function is valid, but be sure to specify timezone or use a UTC time to avoid confusion. You may also use relative time. | ||||||||||||||||||
| 494 | |||||||||||||||||||
| 495 | =back | ||||||||||||||||||
| 496 | |||||||||||||||||||
| 497 | =head2 $sc->get_send( $send_id ) | ||||||||||||||||||
| 498 | |||||||||||||||||||
| 499 | Get the status of a send. | ||||||||||||||||||
| 500 | |||||||||||||||||||
| 501 | API docs: L<http://docs.sailthru.com/api/send> | ||||||||||||||||||
| 502 | |||||||||||||||||||
| 503 | =over | ||||||||||||||||||
| 504 | |||||||||||||||||||
| 505 | =item $send_id | ||||||||||||||||||
| 506 | |||||||||||||||||||
| 507 | The unique identifier of the send returned in the response from C<$sc-E<gt>send()>. | ||||||||||||||||||
| 508 | |||||||||||||||||||
| 509 | =back | ||||||||||||||||||
| 510 | |||||||||||||||||||
| 511 | =head2 $sc->get_email( $email ) | ||||||||||||||||||
| 512 | |||||||||||||||||||
| 513 | Get information about a user. | ||||||||||||||||||
| 514 | |||||||||||||||||||
| 515 | API docs: L<http://docs.sailthru.com/api/email> | ||||||||||||||||||
| 516 | |||||||||||||||||||
| 517 | =over | ||||||||||||||||||
| 518 | |||||||||||||||||||
| 519 | =item $email | ||||||||||||||||||
| 520 | |||||||||||||||||||
| 521 | The email address to look up. | ||||||||||||||||||
| 522 | |||||||||||||||||||
| 523 | =back | ||||||||||||||||||
| 524 | |||||||||||||||||||
| 525 | =head2 $sc->set_email( $email, [\%vars, \%lists, \%templates] ) | ||||||||||||||||||
| 526 | |||||||||||||||||||
| 527 | Update information about a user, including adding and removing the user from lists. | ||||||||||||||||||
| 528 | |||||||||||||||||||
| 529 | API docs: L<http://docs.sailthru.com/api/email> | ||||||||||||||||||
| 530 | |||||||||||||||||||
| 531 | =over | ||||||||||||||||||
| 532 | |||||||||||||||||||
| 533 | =item $email | ||||||||||||||||||
| 534 | |||||||||||||||||||
| 535 | The email address to modify. | ||||||||||||||||||
| 536 | |||||||||||||||||||
| 537 | =item \%vars | ||||||||||||||||||
| 538 | |||||||||||||||||||
| 539 | An optional hashref of replacement variables you want to set or a JSON string | ||||||||||||||||||
| 540 | |||||||||||||||||||
| 541 | =item \%lists | ||||||||||||||||||
| 542 | |||||||||||||||||||
| 543 | An optional hashref. Each key is the name of a list and each value is | ||||||||||||||||||
| 544 | 1 to subscribe the user to that list or 0 to remove the user from the list. | ||||||||||||||||||
| 545 | |||||||||||||||||||
| 546 | =item \%templates | ||||||||||||||||||
| 547 | |||||||||||||||||||
| 548 | An optional hashref. Each key is the name of a template, and each value is 1 to | ||||||||||||||||||
| 549 | opt the user back in to template delivery or 0 to opt the user out of template | ||||||||||||||||||
| 550 | delivery. | ||||||||||||||||||
| 551 | |||||||||||||||||||
| 552 | =back | ||||||||||||||||||
| 553 | |||||||||||||||||||
| 554 | =head2 $sc->schedule_blast( $name, $list, $schedule_time, $from_name, $from_email, $subject, $content_html, $content_text, [\%options] ) | ||||||||||||||||||
| 555 | |||||||||||||||||||
| 556 | Schedule a mass mail blast. | ||||||||||||||||||
| 557 | |||||||||||||||||||
| 558 | API docs: L<http://docs.sailthru.com/api/blast> | ||||||||||||||||||
| 559 | |||||||||||||||||||
| 560 | =over | ||||||||||||||||||
| 561 | |||||||||||||||||||
| 562 | =item $name | ||||||||||||||||||
| 563 | |||||||||||||||||||
| 564 | The name to give to this new blast. | ||||||||||||||||||
| 565 | |||||||||||||||||||
| 566 | =item $list | ||||||||||||||||||
| 567 | |||||||||||||||||||
| 568 | The mailing list name to send to. | ||||||||||||||||||
| 569 | |||||||||||||||||||
| 570 | =item $schedule_time | ||||||||||||||||||
| 571 | |||||||||||||||||||
| 572 | When the blast should send. Dates in the past will be scheduled for immediate | ||||||||||||||||||
| 573 | delivery. Any English textual datetime format known to PHP's strtotime function | ||||||||||||||||||
| 574 | is acceptable, such as 2012-03-18 23:57:22 UTC, now (immediate delivery), +3 | ||||||||||||||||||
| 575 | hours (3 hours from now), or March 18, 9:30 EST. Be sure to specify a timezone | ||||||||||||||||||
| 576 | if you use an exact time. | ||||||||||||||||||
| 577 | |||||||||||||||||||
| 578 | =item $from_name | ||||||||||||||||||
| 579 | |||||||||||||||||||
| 580 | The name to use in "From" in the email. | ||||||||||||||||||
| 581 | |||||||||||||||||||
| 582 | =item $from_email | ||||||||||||||||||
| 583 | |||||||||||||||||||
| 584 | The email address to use in "From". Choose from any of your verified emails. | ||||||||||||||||||
| 585 | |||||||||||||||||||
| 586 | =item $subject | ||||||||||||||||||
| 587 | |||||||||||||||||||
| 588 | The subject line of the email. | ||||||||||||||||||
| 589 | |||||||||||||||||||
| 590 | =item $content_html | ||||||||||||||||||
| 591 | |||||||||||||||||||
| 592 | The HTML format version of the email. | ||||||||||||||||||
| 593 | |||||||||||||||||||
| 594 | =item $content_text | ||||||||||||||||||
| 595 | |||||||||||||||||||
| 596 | The text format version of the email. | ||||||||||||||||||
| 597 | |||||||||||||||||||
| 598 | =item \%options | ||||||||||||||||||
| 599 | |||||||||||||||||||
| 600 | An optional hashref containing the optional parameters for a blast. See the API documentation for details. | ||||||||||||||||||
| 601 | |||||||||||||||||||
| 602 | =back | ||||||||||||||||||
| 603 | |||||||||||||||||||
| 604 | =head2 $sc->schedule_blast_from_template( $template_name, $list, $schedule_time, [\%options] ) | ||||||||||||||||||
| 605 | |||||||||||||||||||
| 606 | Schedule a mass mail blast from a template. | ||||||||||||||||||
| 607 | |||||||||||||||||||
| 608 | API docs: L<http://docs.sailthru.com/api/blast> | ||||||||||||||||||
| 609 | |||||||||||||||||||
| 610 | =over | ||||||||||||||||||
| 611 | |||||||||||||||||||
| 612 | =item $template_name | ||||||||||||||||||
| 613 | |||||||||||||||||||
| 614 | The template to copy from. | ||||||||||||||||||
| 615 | |||||||||||||||||||
| 616 | =item $list | ||||||||||||||||||
| 617 | |||||||||||||||||||
| 618 | The mailing list name to send to. | ||||||||||||||||||
| 619 | |||||||||||||||||||
| 620 | =item $schedule_time | ||||||||||||||||||
| 621 | |||||||||||||||||||
| 622 | When the blast should send. Dates in the past will be scheduled for immediate | ||||||||||||||||||
| 623 | delivery. Any English textual datetime format known to PHP's strtotime function | ||||||||||||||||||
| 624 | is acceptable, such as 2012-03-18 23:57:22 UTC, now (immediate delivery), +3 | ||||||||||||||||||
| 625 | hours (3 hours from now), or March 18, 9:30 EST. Be sure to specify a timezone | ||||||||||||||||||
| 626 | if you use an exact time. | ||||||||||||||||||
| 627 | |||||||||||||||||||
| 628 | =item \%options | ||||||||||||||||||
| 629 | |||||||||||||||||||
| 630 | An optional hashref containing the optional parameters for a blast. See the API documentation for details. | ||||||||||||||||||
| 631 | |||||||||||||||||||
| 632 | =back | ||||||||||||||||||
| 633 | |||||||||||||||||||
| 634 | =head2 $sc->get_blast( $blast_id ) | ||||||||||||||||||
| 635 | |||||||||||||||||||
| 636 | Get data on a single blast. | ||||||||||||||||||
| 637 | |||||||||||||||||||
| 638 | API docs: L<http://docs.sailthru.com/api/blast> | ||||||||||||||||||
| 639 | |||||||||||||||||||
| 640 | =over | ||||||||||||||||||
| 641 | |||||||||||||||||||
| 642 | =item $blast_id | ||||||||||||||||||
| 643 | |||||||||||||||||||
| 644 | The blast id returned in the response from C<$sc-E<gt>scheduleBlast()>. | ||||||||||||||||||
| 645 | |||||||||||||||||||
| 646 | =back | ||||||||||||||||||
| 647 | |||||||||||||||||||
| 648 | =head2 $sc->get_template( $template_name ) | ||||||||||||||||||
| 649 | |||||||||||||||||||
| 650 | Get information about a template | ||||||||||||||||||
| 651 | |||||||||||||||||||
| 652 | API docs: L<http://docs.sailthru.com/api/template> | ||||||||||||||||||
| 653 | |||||||||||||||||||
| 654 | =over | ||||||||||||||||||
| 655 | |||||||||||||||||||
| 656 | =item $template_name | ||||||||||||||||||
| 657 | |||||||||||||||||||
| 658 | The name of the template. | ||||||||||||||||||
| 659 | |||||||||||||||||||
| 660 | =back | ||||||||||||||||||
| 661 | |||||||||||||||||||
| 662 | =head2 $sc->api_get( $action, \%data ) | ||||||||||||||||||
| 663 | |||||||||||||||||||
| 664 | This is a generic HTTP GET call to the API. | ||||||||||||||||||
| 665 | |||||||||||||||||||
| 666 | =over | ||||||||||||||||||
| 667 | |||||||||||||||||||
| 668 | =item $action | ||||||||||||||||||
| 669 | |||||||||||||||||||
| 670 | The name of the API action to call. | ||||||||||||||||||
| 671 | |||||||||||||||||||
| 672 | =item \%data | ||||||||||||||||||
| 673 | |||||||||||||||||||
| 674 | A hashref of arguments to pass to the API. | ||||||||||||||||||
| 675 | |||||||||||||||||||
| 676 | =back | ||||||||||||||||||
| 677 | |||||||||||||||||||
| 678 | For example, you could get information about an email with | ||||||||||||||||||
| 679 | |||||||||||||||||||
| 680 | $sc->api_get('GET', 'email', {email=>'somebody@example.com'}); | ||||||||||||||||||
| 681 | |||||||||||||||||||
| 682 | =head2 $sc->api_post( $action, \%data ) | ||||||||||||||||||
| 683 | |||||||||||||||||||
| 684 | This is a generic HTTP POST call to the API. | ||||||||||||||||||
| 685 | |||||||||||||||||||
| 686 | =over | ||||||||||||||||||
| 687 | |||||||||||||||||||
| 688 | =item $action | ||||||||||||||||||
| 689 | |||||||||||||||||||
| 690 | The name of the API action to call. | ||||||||||||||||||
| 691 | |||||||||||||||||||
| 692 | =item \%data | ||||||||||||||||||
| 693 | |||||||||||||||||||
| 694 | A hashref of arguments to pass to the API. | ||||||||||||||||||
| 695 | |||||||||||||||||||
| 696 | =back | ||||||||||||||||||
| 697 | |||||||||||||||||||
| 698 | =head2 $sc->api_delete( $action, \%data ) | ||||||||||||||||||
| 699 | |||||||||||||||||||
| 700 | This is a generic HTTP DELETE call to the API. | ||||||||||||||||||
| 701 | |||||||||||||||||||
| 702 | =over | ||||||||||||||||||
| 703 | |||||||||||||||||||
| 704 | =item $action | ||||||||||||||||||
| 705 | |||||||||||||||||||
| 706 | The name of the API action to call. | ||||||||||||||||||
| 707 | |||||||||||||||||||
| 708 | =item \%data | ||||||||||||||||||
| 709 | |||||||||||||||||||
| 710 | A hashref of arguments to pass to the API. | ||||||||||||||||||
| 711 | |||||||||||||||||||
| 712 | =back | ||||||||||||||||||
| 713 | |||||||||||||||||||
| 714 | =head1 SEE ALSO | ||||||||||||||||||
| 715 | |||||||||||||||||||
| 716 | See the Sailthru API documentation for more details on their API. | ||||||||||||||||||
| 717 | |||||||||||||||||||
| 718 | L<http://docs.sailthru.com/api> | ||||||||||||||||||
| 719 | |||||||||||||||||||
| 720 | =head1 AUTHOR | ||||||||||||||||||
| 721 | |||||||||||||||||||
| 722 | Finn Smith | ||||||||||||||||||
| 723 | |||||||||||||||||||
| 724 | Steve Sanbeg | ||||||||||||||||||
| 725 | |||||||||||||||||||
| 726 | Steve Miketa | ||||||||||||||||||
| 727 | |||||||||||||||||||
| 728 | Sam Gerstenzang | ||||||||||||||||||
| 729 | |||||||||||||||||||
| 730 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||
| 731 | |||||||||||||||||||
| 732 | Copyright (C) 2012 by Finn Smith <finn@timeghost.net> | ||||||||||||||||||
| 733 | |||||||||||||||||||
| 734 | Copyright (C) 2012 by Steve Sanbeg <stevesanbeg@buzzfeed.com> | ||||||||||||||||||
| 735 | |||||||||||||||||||
| 736 | Copyright (C) 2011 by Steve Miketa <steve@sailthru.com> | ||||||||||||||||||
| 737 | |||||||||||||||||||
| 738 | Adapted from the original Sailthru::Client & Triggermail modules created by Sam | ||||||||||||||||||
| 739 | Gerstenzang and Steve Miketa. | ||||||||||||||||||
| 740 | |||||||||||||||||||
| 741 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 742 | the same terms as Perl itself, either Perl version 5.10.0 or, at your option, | ||||||||||||||||||
| 743 | any later version of Perl 5 you may have available. | ||||||||||||||||||
| 744 | |||||||||||||||||||
| 745 | =cut | ||||||||||||||||||