blib/lib/SMS/Send/NANP/Raco_TMO.pm

filter: Statementstmt 53.5% 15 / 28 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 43.4% 20 / 46 CC 6 SCAR 31.6
CC
6
Cov
39%
send_sms
42.0
_url_default
2.0
BEGIN
1.0
CRAP 23.5
↑ Summary
1 package SMS::Send::NANP::Raco_TMO;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw{SMS::Send::Driver::WebService};
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use XML::Simple qw{XMLin};
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.03';
8 2 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<SMS::Send> 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<SMS::Send::Driver::WebService> 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 0 ▶sub send_sms {
Subroutine send_sms: not called CC=6 SCAR=37.4
Pod documented
57 0 my $self = shift;
58 0 my %argv = @_;
59 0 ▶ my $to = $argv{"to"} or die("Error: to address required");
Branch: 1 branch
BranchTrueFalseTotal
my $to = $argv{"to"} or die "Error: to address required" 0 0 0
60 0 ▶ my $text = defined($argv{"text"}) ? $argv{"text"} : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $argv{'text'} ? : 0 0 0
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 ▶ die(sprintf("HTTP Error: %s", $response->status_line)) unless $response->is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $response->is_success 0 0 0
69 0 my $content = $response->decoded_content;
70 0 my $data = XMLin($content);
71 0 $self->{"__data"}=$data;
72 0 ▶ my $status = $data->{"ServiceResult"} || '';
Condition0%0/2
$data->{'ServiceResult'} || ''
l!l
00
MC/DC0%0/1
$data->{'ServiceResult'} || ''
$data->{'ServiceResult'}
Truth table0%0/2
A
A= $data->{'ServiceResult'}
Aresult
11
00
73 0 ▶ return $status eq 'ACCEPTED' ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$status eq 'ACCEPTED' ? : 0 0 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 ▶sub _url_default {"https://t-mobile.racowireless.com/SMSRicochet2.0/Send.asmx/SendSMS"};
Subroutine _url_default: not called CC=1 SCAR=6.9
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<SMS::Send>, L<SMS::Send::Driver::WebService>, L<XML::Simple>
121  
122 =cut
123  
124 2 1;
↑ Summary