File Coverage

blib/lib/SMS/Send/NL/Mollie.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package SMS::Send::NL::Mollie;
2              
3 1     1   86614 use strict;
  1         4  
  1         92  
4 1     1   8 use base 'SMS::Send::Driver';
  1         1  
  1         124  
5 1     1   739 use Net::SMS::Mollie;
  0            
  0            
6              
7             use vars qw{$VERSION};
8             BEGIN {
9             $VERSION = '0.01';
10             }
11              
12             sub new {
13             my ($class, %params) = @_;
14              
15             foreach(qw/username password/) {
16             Carp::croak("No $_ specified") unless(defined $params{"_$_"});
17             }
18              
19             my $self = bless { %params }, $class;
20              
21             return $self;
22             }
23              
24             sub send_sms {
25             my $self = shift;
26             my %params = @_;
27              
28             my $mollie = Net::SMS::Mollie->new(
29             username => $self->{"_username"},
30             password => $self->{"_password"},
31             );
32             $mollie->originator($self->{"_originator"})
33             if(defined $self->{"_originator"});
34             $mollie->originator($self->{"_gateway"})
35             if(defined $self->{"_gateway"});
36              
37             $mollie->recipient($params{"to"});
38             return $mollie->send($params{"text"});
39             }
40              
41             #################### main pod documentation begin ###################
42              
43             =head1 NAME
44              
45             SMS::Send::NL::Mollie - SMS::Send driver for www.mollie.nl
46              
47             =head1 SYNOPSIS
48              
49             use SMS::Send;
50              
51             my $sender = SMS::Send->new('NL::Mollie',
52             _username => 'MyUserName',
53             _password => 'P4ssw0rd!',
54             _originator => '0612345678',
55             _gateway => 2,
56             );
57              
58             my $sent = $sender->send_sms(
59             text => 'My very urgent message',
60             to => '0687654321',
61             );
62              
63             =head1 DESCRIPTION
64              
65             SMS::Send::NL::Mollie is a L driver which allows you to send
66             messages through L.
67              
68             =head1 METHODS
69              
70             =head2 new
71              
72             The C method takes a few parameters. C<_username> and C<_password>
73             are mandatory, C<_originator>, and C<_gateway> are optional.
74             See L for details on these parameters.
75              
76             This driver is a very simplified wrapper around L
77             and provides a lot less functionality than L.
78              
79             =head2 send_sms
80              
81             Takes C as recipient phonenumber, and C as the text that's
82             supposed to be delivered.
83              
84             =head1 SEE ALSO
85              
86             =over 5
87              
88             =item * L
89              
90             =item * L
91              
92             =back
93              
94             =head1 BUGS
95              
96             Please report any bugs to L
97              
98             =head1 AUTHOR
99              
100             M. Blom
101             Eblom@cpan.orgE
102             L
103              
104             =head1 COPYRIGHT
105              
106             This program is free software; you can redistribute
107             it and/or modify it under the same terms as Perl itself.
108              
109             The full text of the license can be found in the
110             LICENSE file included with this module.
111              
112             =cut
113              
114             1;