• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/WebService/H16-Feb-2015-601278

t/H16-Feb-2015-416317

.travis.ymlH A D16-Feb-201576 87

Build.PLH A D16-Feb-20151.5 KiB4744

ChangesH A D16-Feb-20151.3 KiB4027

MANIFESTH A D16-Feb-2015301 2120

META.jsonH A D16-Feb-20151.8 KiB6867

META.ymlH A D16-Feb-20151.1 KiB4443

Makefile.PLH A D16-Feb-20151.1 KiB3230

README.mkdnH A D16-Feb-20158 KiB241152

README.mkdn

1# NAME
2
3WebService::Pushover - interface to Pushover API
4
5# VERSION
6
7This document describes WebService::Pushover version 1.0.0.
8
9# SYNOPSIS
10
11    use WebService::Pushover;
12
13    my $push = WebService::Pushover->new(
14        user_token => 'PUSHOVER USER TOKEN',
15        api_token  => 'PUSHOVER API TOKEN',
16    ) or die( "Unable to instantiate WebService::Pushover.\n" );
17
18    my %params = (
19        message  => 'test test test',
20        priority => 0,
21    );
22
23    my $status = $push->message( %params );
24
25# DESCRIPTION
26
27This module provides a Perl wrapper around the Pushover
28( [http://pushover.net](http://pushover.net) ) RESTful API.  You'll need to register with
29Pushover to obtain an API token for yourself and for your application
30before you'll be able to do anything with this module.
31
32# INTERFACE
33
34- new(_%params_)
35
36    Creates an object that allows for interaction with Pushover. The following
37    are valid arguments; all are optional:
38
39    - base\_url **OPTIONAL**
40
41        Sets the base URL for the API to connect to. Defaults to [http://api.pushover.net](http://api.pushover.net)
42
43    - user\_token **OPTIONAL**
44
45        The Pushover user token, obtained by registering at [http://pushover.net](http://pushover.net).
46        If specified, will be used as a default in any call that requires a user token.
47
48    - api\_token **OPTIONAL**
49
50        The Pushover application token, obtained by registering at [http://pushover.net/apps](http://pushover.net/apps).
51        If specified, will be used as a default in any call that requires an API token.
52
53    - debug **OPTIONAL**
54
55        Set this to a true value in order to enable tracing of API call operations.
56
57- debug()
58
59    _debug()_ returns 1 if debugging is enabled, and 0 otherwise.
60
61- message(_%params_)
62
63    _message()_ sends a message to Pushover and returns a scalar reference
64    representation of the message status.  The following are valid parameters:
65
66    - token **OPTIONAL**
67
68        The Pushover application token.
69        If not specified, the `api_token` specified in `new` will be used.
70
71    - user **OPTIONAL**
72
73        The Pushover user token.
74        If not specified, the `user_token` specified in `new` will be used.
75
76    - device **OPTIONAL**
77
78        The Pushover device name; if not supplied, the user will be validated if at
79        least one device is registered to that user.
80
81    - title **OPTIONAL**
82
83        A string that will appear as the title of the message; if not supplied, the
84        name of the application registered to the application token will appear.
85
86    - message **REQUIRED**
87
88        A string that will appear as the body of the message.
89
90    - timestamp **OPTIONAL**
91
92        The desired message timestamp, in Unix epoch seconds.
93
94    - priority **OPTIONAL**
95
96        Set this value to "2" to mark the message as emergency priority, "1" to mark
97        the message as high priority, set it to "-1" to mark the message as low
98        priority, or set it to "0" or leave it unset for standard priority.
99
100    - retry **OPTIONAL**
101
102        You must pass this parameter when sending messages at emergency priority.  Set
103        this value to the number of seconds before Pushover tries again to obtain
104        confirmation of message receipt.
105
106    - expire **OPTIONAL**
107
108        You must pass this parameter when sending messages at emergency priority.  Set
109        this value to the number of seconds before Pushover stops trying to obtain
110        confirmation of message receipt.
111
112    - url **OPTIONAL**
113
114        A string that will be attached to the message as a supplementary URL.
115
116    - url\_title **OPTIONAL**
117
118        A string that will be displayed as the title of any supplementary URL.
119
120    - sound **OPTIONAL**
121
122        Select a sound to be associated with this notification.  Check the Pushover API
123        documentation for valid values.
124
125- user(_%params_)
126
127    _user()_ sends an application token and a user token to Pushover and
128    returns a scalar reference representation of the validity of those tokens.  The
129    following are valid parameters:
130
131    - token **OPTIONAL**
132
133        The Pushover application token.
134        If not specified, the `api_token` specified in `new` will be used.
135
136    - user **OPTIONAL**
137
138        The Pushover user token.
139        If not specified, the `user_token` specified in `new` will be used.
140
141    - device **OPTIONAL**
142
143        The Pushover device name; if not supplied, the message will go to all devices
144        registered to the user token.
145
146- receipt(_%params_)
147
148    _receipt()_ sends an application token and a receipt token to Pushover and
149    returns a scalar reference representation of the confirmation status of the
150    notification associated with the receipt.  The following are valid parameters:
151
152    - token **OPTIONAL**
153
154        The Pushover application token.
155        If not specified, the `api_token` specified in `new` will be used.
156
157    - receipt **REQUIRED**
158
159        The Pushover receipt token, obtained by parsing the output returned after
160        sending a message with emergency priority.
161
162- sounds(_%params_)
163
164    _sounds()_ sends an application token to Pushover and returns a hash reference
165    listing the available sounds (suitable for passing to the _sound_ parameter of
166    the _message()_.  The following are valid parameters:
167
168    - token **OPTIONAL**
169
170        The Pushover application token.
171        If not specified, the `api_token` specified in `new` will be used.
172
173## DEPRECATED METHODS
174
175The following methods are depreated, and will be removed in a future
176release. They remain for now to provide backwards compatibility.
177
178- push(_%params_)
179
180    _push()_ is a **DEPRECATED** alias for _message()_.
181
182- tokens(_%params_)
183
184    _tokens()_ is a **DEPRECATED** alias for _user()_.
185
186# DIAGNOSTICS
187
188Inspect the value returned by any method, which will be a Perl data structure
189parsed from the JSON or XML response returned by the Pushover API.
190
191# DEPENDENCIES
192
193- [DateTime](https://metacpan.org/pod/DateTime)
194- [DateTime::Format::Strptime](https://metacpan.org/pod/DateTime::Format::Strptime)
195- [Moo](https://metacpan.org/pod/Moo)
196- [WebService::Simple](https://metacpan.org/pod/WebService::Simple)
197- [WebService::Simple::Parser::JSON](https://metacpan.org/pod/WebService::Simple::Parser::JSON)
198- [Params::Validate](https://metacpan.org/pod/Params::Validate)
199- [Readonly](https://metacpan.org/pod/Readonly)
200- [URI](https://metacpan.org/pod/URI)
201
202# BUGS AND LIMITATIONS
203
204No bugs have been reported.
205
206Please report any bugs or feature requests through the web interface at [https://github.com/hakamadare/webservice-pushover/issues](https://github.com/hakamadare/webservice-pushover/issues).
207
208# AUTHOR
209
210Steve Huff  `<shuff@cpan.org>`
211
212# LICENCE AND COPYRIGHT
213
214Copyright (c) 2012, Steve Huff `<shuff@cpan.org>`. All rights reserved.
215
216This module is free software; you can redistribute it and/or
217modify it under the same terms as Perl itself. See [perlartistic](https://metacpan.org/pod/perlartistic).
218
219# DISCLAIMER OF WARRANTY
220
221BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
222FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
223OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
224PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
225EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
226WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
227ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
228YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
229NECESSARY SERVICING, REPAIR, OR CORRECTION.
230
231IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
232WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
233REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
234LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
235OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
236THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
237RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
238FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
239SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
240SUCH DAMAGES.
241