Skip to content

frnktrgr/grails-pushover

Repository files navigation

grails-pushover

Provides easy access to Pushover API.

Installation

Add following line to dependencies section in build.gradle.

compile 'org.grails.plugins:pushover:1.0.1'

Configuration

Add following lines to grails-app/conf/application.yml:

grails:
	pushover:
		token: <API_TOKEN>
		defaultUser: <DEFAULT_USER>

Get your free API Token from Pushover.

The specified token is used in every Pushover call if no explicit token option is given.

If pushoverService.message() is called without a user/group token, the defaultUser is used.

Getting started

Send message to default user

Send message hello world to defaultUser with configured token (see Configuration).

pushoverService.message("hello world")

Send message to some user/group

Send message hello world to <USER/GROUP_TOKEN>.

pushoverService.message("hello world", [user: '<USER/GROUP_TOKEN>'])

Send message using another API token

Send message hello world using <ANOTHER_API_TOKEN> API token.

pushoverService.message("hello world", [token: '<ANOTHER_API_TOKEN>'])

API

All methods and options are named after their Pushover API counterparts. Please read Pushover API.

Send message

pushoverService.message(String message, Map options=[:])

Retrieve the list of current sounds

pushoverService.sounds(Map options=[:])

User/Group verification

pushoverService.validateUser(String user, Map options=[:])

Retrieve information about a group

pushoverService.groups(String group, Map options=[:])
  • group: group key
  • options
    • token: your application's API token (optional if token in config is set)
  • return value: map of Pushover response (see https://pushover.net/api#response)

Adding a user to a group

pushoverService.groupsAddUser(String group, String user, Map options=[:])

Removing a user from a group

pushoverService.groupsDeleteUser(String group, String user, Map options=[:])
  • group: group key
  • user: user key
  • options
    • token: your application's API token (optional if token in config is set)
  • return value: map of Pushover response (see https://pushover.net/api#response)

Temporarily disabling a user in a group

pushoverService.groupsDisableUser(String group, String user, Map options=[:])
  • group: group key
  • user: user key
  • options
    • token: your application's API token (optional if token in config is set)
  • return value: map of Pushover response (see https://pushover.net/api#response)

Re-enabling a user in a group

pushoverService.groupsEnableUser(String group, String user, Map options=[:])
  • group: group key
  • user: user key
  • options
    • token: your application's API token (optional if token in config is set)
  • return value: map of Pushover response (see https://pushover.net/api#response)

Renaming a group

pushoverService.groupsRename(String group, String name, Map options=[:])
  • group: group key
  • name: new name of the group
  • options
    • token: your application's API token (optional if token in config is set)
  • return value: map of Pushover response (see https://pushover.net/api#response)

##TODOs See also https://pushover.net/api