erniebrodeur / pushover

A gem to interface with pushover.net
http://erniebrodeur.github.io/pushover/
MIT License
64 stars 24 forks source link

added ability to use Pushover#configure to set params #1

Closed benwoody closed 12 years ago

benwoody commented 12 years ago

Changes:

Pushover#notification uses hash params to set token/user instead of set params Pushover#configure added to add ability to set token/user in one fail swoop so it doesn't have to be continually set in params. Example:

Pushover.configure do |c|
  c.token='app token'
  c.user='your token'
end

Pushover.notification('Hello', 'World')

You can still set tokens in #notification, only using a hash:

Pushover.notification('Hello', 'World', token:'app token', user:'your token')

Binary still works with this commit.

Also, this helps with setting non-ivar'd user tokens. Now, if this is used inside of any sort of DSL or web app, the application token can be set by an admin, and the user token can be set by the user, as used at http://lobste.rs

pushover.rb is getting a bit large, might be an idea to put it in it's own file in ./lib

benwoody commented 12 years ago

This would also make it easier to set other optional API params: device, title, url, url_title, priority, timestamp.

These would be added to :attar_accessor and #keys

benwoody commented 12 years ago

I would suggest putting title as an optional param as well.

erniebrodeur commented 12 years ago

Thanks, I was going to add file level config today, this will make it quicker.