line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SMS::MessageBird::API::HLR; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
49
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use parent 'SMS::MessageBird::API'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SMS::MessageBird::API::HLR - Sub-module for the SMS::MessageBird distribution. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This is a sub-module which is part of the SMS::MessageBird distribution. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
While this module can be used directly, it's designed to be used via |
18
|
|
|
|
|
|
|
L |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module provides the interface to the HLR related methods of the MessageBird |
24
|
|
|
|
|
|
|
JSON API. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The methods implmented acceept the paramteres as named in the MessageBird API |
27
|
|
|
|
|
|
|
documentation which can be found at the L. |
28
|
|
|
|
|
|
|
If you're using this distribution you should be familiar with the API |
29
|
|
|
|
|
|
|
documentation. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 Response Data |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Every method returns a standardised hashref containin the following keys: |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item ok |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Value of 0 or 1. Indicates if the request was completed successfully or not. |
40
|
|
|
|
|
|
|
This value is based on LWP::UserAgent's is_success() method. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item code |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This is the HTTP code returned by the API. In the event of ok => 0 - it's |
45
|
|
|
|
|
|
|
possible that the request was a 401 etc. So this is provided for sanity |
46
|
|
|
|
|
|
|
checking. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item content |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This is a Perl hashref data structure decoded from the API's response JSON |
51
|
|
|
|
|
|
|
as-is. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Please see the L |
54
|
|
|
|
|
|
|
for more information on the expected structure. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 request |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
In: %params - Hash of params accepted by the MessageBird API. |
64
|
|
|
|
|
|
|
Out: $response - Hashref of response data. See "Response Data" above. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This method implements the POST /hlr route of the API. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Requests an HLR lookup for a given MSISDN. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Accepted parameters are listed in the MessageBird API documentation. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Require parameters are as follows: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item msisdn |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The MSISDN formatted telephone number to do the network query on. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item reference |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
A client reference string for human reference. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub request { |
89
|
0
|
|
|
0
|
1
|
|
my ($self, %params) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self->_api_request( |
92
|
|
|
|
|
|
|
post => "/hlr", |
93
|
|
|
|
|
|
|
\%params, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 get |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
In: $hlr_id - The HLR ID returned by the request call. |
101
|
|
|
|
|
|
|
Out: $response - Hashref of response data. See "Response Data" above. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This method implements the GET /hlr/{hlr_id} route of the API. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Attempts to retrieve the result of a previously requested HLR. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Please see the L |
108
|
|
|
|
|
|
|
for more information. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub get { |
113
|
0
|
|
|
0
|
1
|
|
my ($self, $hlr_id) = @_; |
114
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
my $route = ($hlr_id) ? "/hlr/$hlr_id" |
116
|
|
|
|
|
|
|
: '/hlr'; |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $self->_api_request( get => $route ); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 remove |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
In: $hlr_id - The HLR ID returned by the request call. |
125
|
|
|
|
|
|
|
Out: $response - Hashref of response data. See "Response Data" above. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This method implements the DELETE /hlr/{hlr_id} route of the API. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Deletes the result of a previously requested HLR. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Please see the L |
132
|
|
|
|
|
|
|
for more information. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub remove { |
137
|
0
|
|
|
0
|
1
|
|
my ($self, $hlr_id) = @_; |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
return $self->_no_param_supplied('HLR ID') if !$hlr_id; |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
return $self->_api_request( delete => "/hlr/$hlr_id" ); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 del |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Synonym for the L method. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub del { |
152
|
0
|
|
|
0
|
1
|
|
my ($self, $hlr_id) = @_; |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
return $self->remove($hlr_id); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 AUTHOR |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
James Ronan, C<< >> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 BUGS |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
165
|
|
|
|
|
|
|
or through the web interface at L. |
166
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
167
|
|
|
|
|
|
|
bug as I make changes. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Alternatively you can raise an issue on the source code which is available on |
170
|
|
|
|
|
|
|
L. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Copyright 2016 James Ronan. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
177
|
|
|
|
|
|
|
the same terms as Perl itself. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
182
|
|
|
|
|
|
|
|