Class: Prowl
- Inherits:
-
Object
- Object
- Prowl
- Defined in:
- lib/prowl.rb
Defined Under Namespace
Classes: MissingAPIKey, PriorityOutOfRange, TooManyAPIKeys
Constant Summary collapse
- API_URL =
"https://prowl.weks.net:443/publicapi"
- MAX_API_KEYS =
5
- PRIORITY_RANGE =
-2..2
Class Method Summary collapse
-
.add(params = {}) ⇒ Object
Utility function that creates an instance and sends a prowl.
-
.verify(apikey) ⇒ Object
Utility function to verify API keys.
Instance Method Summary collapse
- #add(params = {}) ⇒ Object
-
#defaults(params) ⇒ Object
Modify this instance’s defaults.
-
#initialize(defaults = {}) ⇒ Prowl
constructor
A new instance of Prowl.
- #valid? ⇒ Boolean
Constructor Details
#initialize(defaults = {}) ⇒ Prowl
Returns a new instance of Prowl.
15 16 17 |
# File 'lib/prowl.rb', line 15 def initialize(defaults = {}) @defaults = defaults end |
Class Method Details
.add(params = {}) ⇒ Object
Utility function that creates an instance and sends a prowl
33 34 35 |
# File 'lib/prowl.rb', line 33 def self.add(params = {}) new(params).add end |
.verify(apikey) ⇒ Object
Utility function to verify API keys
38 39 40 |
# File 'lib/prowl.rb', line 38 def self.verify(apikey) new({:apikey => apikey}).valid? end |
Instance Method Details
#add(params = {}) ⇒ Object
19 20 21 |
# File 'lib/prowl.rb', line 19 def add(params = {}) perform("add", params) end |
#defaults(params) ⇒ Object
Modify this instance’s defaults
24 25 26 |
# File 'lib/prowl.rb', line 24 def defaults(params) @defaults = @defaults.merge(params) end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/prowl.rb', line 28 def valid? @valid ||= (perform("verify") == 200) end |