Module: NotifyPush::Sender
- Defined in:
- lib/notify-push.rb
Overview
MODULE->SENDER ——————————-
Class Method Summary collapse
Class Method Details
.start ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/notify-push.rb', line 65 def self.start() require "pusher" # The only thing we require is a message. # The others will be nil if not supplied. raise "No message supplied." if ARGV[0].blank? notification = { message: ARGV[0], title: ARGV[1], subtitle: ARGV[2] } # Strip the nil key/value pairs out so we don't have to # worry about them on the Receiver end. notification.delete_if {|key, value| value.blank?} # Connect to Pusher and trigger the notification Pusher.url = "http://#{configuration.pusher.key}:#{configuration.pusher.secret}@api.pusherapp.com/apps/#{configuration.pusher.app_id}" Pusher[CHANNEL_NAME].trigger("notification", notification) 0 end |