Learn R Programming

pushoverr (version 0.1.1)

set_pushover_app: Store Pushover app and user information and use for all subsequent queries

Description

set_pushover_app allows an application token to be stored that will be used for all subsequent calls that require a token (e.g., pushover).

pushover_app.isset determines whether or not a Pushover app has been set

unset_pushover_app removes a stored Pushover app token, which means that a token will have to be provided to all subsequent API calls.

get_pushover_app returns the token associated with the current Pushover app

set_pushover_user allows a user key to be stored that will be used for all subsequent calls that require a user key (e.g., pushover).

pushover_user.isset indicates whether or not a Pushover user/group is currently set

unset_pushover_user removes a stored Pushover user/group, which means that a key will have to be provided to all subsequent API calls.

get_pushover_user gets the key associated with the current Pushover user/group

Usage

set_pushover_app(token, user = NA)

pushover_app.isset()

unset_pushover_app()

get_pushover_app()

set_pushover_user(user)

pushover_user.isset()

unset_pushover_user()

get_pushover_user()

Arguments

token
The application token
user
If a user/group key is given, that information will also be saved for subsequent queries. This is eqivalant to calling set_pushover_user.

Value

  • pushover_app.isset returns a boolean indicating whether the app token has been set (TRUE) or not (FALSE).

    get_pushover_app returns a string representing the token associated with the current app (if one is set)

    pushover_user.isset returns boolean indicating whether the user/group is set (TRUE) or not (FALSE).

    get_pushover_user returns a string containing a Pushover user/group key

Examples

Run this code
# Set the Pushover user account to use
set_pushover_app('KzGDORePK8gMaC0QOYAMyEEuzJnyUi')

# Determine whether the Pushover user account has been set
if(pushover_app.isset())
{
    cat(paste('The Pushover app token has been set to', get_pushover_app()))
}
# Set the Pushover user account to use
set_pushover_user('uQiRzpo4DXghDmr9QzzfQu27cmVRsG')

# Determine whether the Pushover user account has been set
if(pushover_user.isset())
{
    cat(paste('Pushover user has been set to', get_pushover_user()))
}

When both the app token and user account have been set, we can send a
message without providing either of them:
pushover('this took so much less typing!')
pushover_high('and again!')
# Forget about the current Pushover user
unset_pushover_user()

Run the code above in your browser using DataLab