line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SMS::MessageBird::API::Balance; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
4
|
2
|
|
|
2
|
|
24
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
57
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use parent 'SMS::MessageBird::API'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SMS::MessageBird::API::Balance - 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 Balance method 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
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 get |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Out: $response - Hashref of response data. See "Response Data" above. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This method implements the GET /balance route of the API. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Requests the balance information for the authenticated MessageBird account. |
69
|
|
|
|
|
|
|
The authenticated account is the one tied to the api_key supplied to this or the |
70
|
|
|
|
|
|
|
SMS::MessageBird module upon instantiation. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Please see the L |
73
|
|
|
|
|
|
|
for more information. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get { |
78
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $self->_api_request( get => '/balance' ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
James Ronan, C<< >> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 BUGS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
91
|
|
|
|
|
|
|
or through the web interface at L. |
92
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
93
|
|
|
|
|
|
|
bug as I make changes. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Alternatively you can raise an issue on the source code which is available on |
96
|
|
|
|
|
|
|
L. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Copyright 2016 James Ronan. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
103
|
|
|
|
|
|
|
the same terms as Perl itself. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|