module Legion::Extensions::Pushover::Helpers::Client

Public Instance Methods

message(**opts) click to toggle source
# File lib/legion/extensions/pushover/helpers/client.rb, line 6
def message(**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) click to toggle source
# File lib/legion/extensions/pushover/helpers/client.rb, line 17
def timestamp(**opts)
  opts[:timstamp] if opts.key? :timestamp
  Time.now.getutc
end
token(**opts) click to toggle source
# File lib/legion/extensions/pushover/helpers/client.rb, line 22
def token(**opts)
  find_setting('token', opts)
end
user(**opts) click to toggle source
# File lib/legion/extensions/pushover/helpers/client.rb, line 26
def user(**opts)
  find_setting('user', opts)
end