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)


25
26
27
28
# File 'lib/prowly.rb', line 25

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

#remaining_calls(key) ⇒ Object



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

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

#retrieve_apikey(providerkey, token) ⇒ Object



38
39
40
# File 'lib/prowly.rb', line 38

def retrieve_apikey(providerkey, token)
  api.call Interface::Command::RETRIEVE_APIKEY, "providerkey=#{providerkey}&token=#{token}"
end

#retrieve_token(providerkey) ⇒ Object



34
35
36
# File 'lib/prowly.rb', line 34

def retrieve_token(providerkey)
  api.call Interface::Command::RETRIEVE_TOKEN, "providerkey=#{providerkey}"
end

#valid_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/prowly.rb', line 42

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

#verify(apikey) ⇒ Object



30
31
32
# File 'lib/prowly.rb', line 30

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

#versionObject



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

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