Class: Nezumi::Push

Inherits:
Object
  • Object
show all
Defined in:
lib/nezumi/push.rb

Class Method Summary collapse

Class Method Details

.notify(message, opts = {}) ⇒ Object

Raises:



4
5
6
7
8
9
10
11
12
13
# File 'lib/nezumi/push.rb', line 4

def self.notify(message, opts = {})
  url   = ENV['NEZUMI_URL']
  sound = opts.fetch(:sound, "default")
  push  = opts.fetch(:push, true)

  raise URLNotSetError.new if url.nil? || url.empty?
  raise ArgumentError.new("Message must not be blank") if message.nil? || message.empty?

  RestClient.post(url, { :message => message, :sound => sound, :push => !!push })
end