Module: Legion::Extensions::Pushover::Helpers::Client
- Included in:
- Runners::Message
- Defined in:
- lib/legion/extensions/pushover/helpers/client.rb
Instance Method Summary collapse
- #message(**opts) ⇒ Object
- #timestamp(**opts) ⇒ Object
- #token(**opts) ⇒ Object
- #user(**opts) ⇒ Object
Instance Method Details
#message(**opts) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/legion/extensions/pushover/helpers/client.rb', line 6 def (**opts) client_hash = {} %i[message priority device title url url_title sound expire retry callback].each do |thing| client_hash[thing] = opts[thing] if opts.key?(thing) && !opts[thing].nil? end ::Pushover::Message.new(token: token(opts), user: user(opts), timestamp: Time.now.getlocal, **client_hash) end |
#timestamp(**opts) ⇒ Object
17 18 19 20 |
# File 'lib/legion/extensions/pushover/helpers/client.rb', line 17 def (**opts) opts[:timstamp] if opts.key? :timestamp Time.now.getutc end |
#token(**opts) ⇒ Object
22 23 24 |
# File 'lib/legion/extensions/pushover/helpers/client.rb', line 22 def token(**opts) find_setting('token', opts) end |
#user(**opts) ⇒ Object
26 27 28 |
# File 'lib/legion/extensions/pushover/helpers/client.rb', line 26 def user(**opts) find_setting('user', opts) end |