Module: Prowly

Extended by:
Prowly
Included in:
Prowly
Defined in:
lib/prowly.rb,
lib/prowly/response.rb,
lib/prowly/interface.rb,
lib/prowly/notification.rb

Overview

This is the main Prowly module

Usage:

Prowly.notify do |n|
  n.apikey = "the apikey" or
  n.apikeys = ["apikey_1", "apikey_2", "apikey_n"]
  n.priority = Prowly::Notification::Priority::MODERATE
  n.application = "Prowly"
  n.event = "Notification"
  n.description = "put description here"
end

notification = Prowly::Notification.new(:apikey => "apikey", :application => "Prowly", :description => "Testing...")
result = Prowly.notify(notification)

Defined Under Namespace

Classes: BasicNotification, Interface, Notification, Response

Instance Method Summary collapse

Instance Method Details

#add(notification = Notification.new) {|notification| ... } ⇒ Object Also known as: notify

Yields:

  • (notification)


48
49
50
51
# File 'lib/prowly.rb', line 48

def add(notification = Notification.new)
  yield notification if block_given?
  api.call Interface::Command::ADD, notification.to_params
end

#remaining_calls(key) ⇒ Object



62
63
64
65
66
# File 'lib/prowly.rb', line 62

def remaining_calls(key)
  result = verify(key)
  return result.remaining if result.succeeded?
  result.message
end

#valid_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/prowly.rb', line 57

def valid_key?(key)
  result = verify(key)
  result.succeeded?
end

#verify(apikey) ⇒ Object



53
54
55
# File 'lib/prowly.rb', line 53

def verify(apikey)
  api.call Interface::Command::VERIFY, "apikey=#{apikey}"
end

#versionObject



68
69
70
# File 'lib/prowly.rb', line 68

def version
  File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION]))
end