File Coverage

blib/lib/SMS/Send/NANP/Raco_TMO.pm
Criterion Covered Total %
statement 12 25 48.0
branch 0 8 0.0
condition 0 2 0.0
subroutine 4 6 66.6
pod 1 1 100.0
total 17 42 40.4


line stmt bran cond sub pod time code
1             package SMS::Send::NANP::Raco_TMO;
2 1     1   20689 use strict;
  1         2  
  1         27  
3 1     1   5 use warnings;
  1         2  
  1         29  
4 1     1   4 use base qw{SMS::Send::Driver::WebService};
  1         5  
  1         877  
5 1     1   135917 use XML::Simple qw{XMLin};
  1         10432  
  1         7  
6              
7             our $VERSION = '0.03';
8             our $PACKAGE = __PACKAGE__;
9              
10             =head1 NAME
11              
12             SMS::Send::NANP::Raco_TMO - SMS::Send driver for RacoWireless T-Mobile Web Service
13              
14             =head1 SYNOPSIS
15              
16             Using L Driver API
17              
18             SMS-Send.ini
19             [NANP::Raco_TMO]
20             username=myuser
21             password=mypass
22            
23             use SMS::Send;
24             my $service = SMS::Send->new('NANP::Raco_TMO');
25             my $success = $service->send_sms(
26             to => '+1-800-555-1212',
27             text => 'Hello World!',
28             );
29              
30             =head1 DESCRIPTION
31              
32             This package provides an SMS::Send driver against the SMS web service at RacoWireless https://t-mobile.racowireless.com/SMSRicochet2.0/
33              
34             =head1 USAGE
35              
36             use SMS::Send::NANP::Raco_TMO;
37             my $service = SMS::Send::NANP::Raco_TMO->new(
38             username => $partnerID,
39             password => $webServiceKey,
40             );
41             my $success = $service->send_sms(
42             to => '+18005551212',
43             text => 'Hello World!',
44             );
45              
46             =head1 METHODS
47              
48             This package is a trivial sub class of the package L all of the work is in that Driver base package.
49              
50             =head2 send_sms
51              
52             Sends the SMS message and returns 1 for success and 0 for failure or die on critical error.
53              
54             =cut
55              
56             sub send_sms {
57 0     0 1   my $self = shift;
58 0           my %argv = @_;
59 0 0         my $to = $argv{"to"} or die("Error: to address required");
60 0 0         my $text = defined($argv{"text"}) ? $argv{"text"} : '';
61 0           my @form = (
62             partnerID => $self->username,
63             webServiceKey => $self->password,
64             to => $to,
65             message => $text,
66             );
67 0           my $response = $self->ua->post($self->url, \@form);
68 0 0         die(sprintf("HTTP Error: %s", $response->status_line)) unless $response->is_success;
69 0           my $content = $response->decoded_content;
70 0           my $data = XMLin($content);
71 0           $self->{"__data"}=$data;
72 0   0       my $status = $data->{"ServiceResult"} || '';
73 0 0         return $status eq 'ACCEPTED' ? 1 : 0;
74             }
75              
76             =head1 PROPERTIES
77              
78             =head2 username
79              
80             =cut
81              
82             #see SMS::Send::Driver::WebService->username
83              
84             =head2 password
85              
86             =cut
87              
88             #see SMS::Send::Driver::WebService->password
89              
90             =head2 url
91              
92             Default: https://t-mobile.racowireless.com/SMSRicochet2.0/Send.asmx/SendSMS
93              
94             =cut
95              
96             #see SMS::Send::Driver::WebService->url
97              
98 0     0     sub _url_default {"https://t-mobile.racowireless.com/SMSRicochet2.0/Send.asmx/SendSMS"};
99              
100             =head1 BUGS
101              
102             =head1 SUPPORT
103              
104             =head1 AUTHOR
105              
106             Michael R. Davis
107             CPAN ID: MRDVT
108             Satellite Tracking of People, LLC
109             mdavis@stopllc.com
110             http://www.stopllc.com/
111              
112             =head1 COPYRIGHT
113              
114             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
115              
116             The full text of the license can be found in the LICENSE file included with this module.
117              
118             =head1 SEE ALSO
119              
120             L, L, L
121              
122             =cut
123              
124             1;