This gem provides a CLI and an API interface to http://pushover.net.
To install:
% gem install pushover
To use inside of an application, add this to the your gemfile:
% gem 'pushover'
and run bundle to make it available:
% bundle
require 'pushover'
To send with the very minimum amount of information.
Pushover.notification(message: 'message', title: 'title', user: 'USER_TOKEN', token: 'APP_TOKEN')
Optional #configuration method:
Pushover.configure do |config|
config.user='USER_TOKEN'
config.token='APP_TOKEN'
end
Pushover.notification(message: 'message', title: 'title')
To get help do, try --(h)elp
% pushover -h
To send a message.
% pushover -u user_token -a app_key message is the rest of the cli.
Most optional parameters have a shorter form you can use. If that's the case, they will be displayed like --(h)elp
.
The file to use for stored settings (including credentials).
% pushover --(c)onfig_file /tmp/config_file
The title of the message, if not supplied it will end up being the app name.
% pushover --(t)itle "A title"
% pushover --(t)itle "A title"
Priority of the message, either (low,normal,high) or (-1,0,1). For the string you only need the first letter.
% pushover --(p)riority high
% pushover --(p)riority h
% pushover --(p)riority -1
Currently retry/expire is supported, currently these are in seconds. Callback url's are not.
% pushover --emergency_retry 60
% pushover --emergency_expire 3600
It won't pre-check values sent to the api, so you will need to tune for the current min/max values or check api documentation.
Specific device to send the message too, must be registered at pushover.net
% pushover --(d)evice "Device name"
Supplementary URL that can be passed with the message.
% pushover --url "http://www.github.com/erniebrodeur/pushover"
The display string of the supplementary URL.
% pushover --url "http://www.git.com/erniebrodeur/pushover" --url_title "This repo."
Time is tricky, I just pass the string off to the stdlib Time.parse
. Therefore, if it fails I can't do much about it. Though, it shouldn't fail, it seems to take just a ton of stuff. You can always handle this yourself and just pass in an epoch (string or fixnum).
% pushover --time 1331249662
% pushover --time "6:30"
As far as I can tell, you can toss a ton of different things and get an output.
- rfc822: Tue, 14 Nov 2000 14:55:07 -0500
- xml: 1979-08-13T06:30:00.313UTC
- Aug 13, 1979 6:30
- 1979/08/13, 6:30:50 UTC
- 6:30
- 14:30
- Aug 21
Get the available list of sounds:
% pushover --sound_list
Play a specific sound with a message:
% pushover --sound Magic
% pushover --sound per
- You only need to supply an unambiguous partial string.
- It is not case sensitive.
You can also save and use stored information. The username/application are titles. They can be anything you want to reference them.
% pushover -u user_token --save-user email@somewhere.net
% pushover -a app_key --save-app myApp
Delete done in the api, not lifted to the cli.
Now, you can use these to send messages instead of having to remember the key:
% pushover -a myApp -u email@somewhere.net Hello from somewhere!
If you don't supply the application or user name, it will use the first one in the save file.
% pushover so now I can just send an app.
Anytime you supply tokens directly to the cli, it will ignore any saved information and try them. This allows you to use it as a once-off tool while keeping credentials stored.
- Callback urls.
- Receipt testing.
- Rebuild the CLI so it works more like a git/bundle command.
- More argument/string magic.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request