fastprowl 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/fastprowl.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "fastprowl"
5
- s.version = "0.1"
5
+ s.version = "0.2"
6
6
  s.date = Time.now
7
7
  s.authors = ["Matthew Riley MacPherson"]
8
8
  s.email = "matt@lonelyvegan.com"
@@ -12,6 +12,6 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "http://github.com/tofumatt/FastProwl"
13
13
  s.files = FileList['lib/*.rb', '[A-Z]*', 'fastprowl.gemspec', 'test/*.rb'].to_a
14
14
  s.test_file = 'test/fastprowl_test.rb'
15
- s.add_dependency('typhoeus')
15
+ s.add_dependency('typhoeus', '>= 0.1.0')
16
16
  s.add_development_dependency('mocha') # Used to run the tests, that's all...
17
17
  end
data/lib/fastprowl.rb CHANGED
@@ -42,6 +42,11 @@ class FastProwl
42
42
  @user_agent = user_agent
43
43
  end
44
44
 
45
+ # Queue a verify API call in the Hydra.
46
+ def valid?
47
+ @hydra.queue(request('verify'))
48
+ end
49
+
45
50
  # Send a single Prowl notification _immediately_ (don't queue it in
46
51
  # the Hydra). Returns the response code of the action
47
52
  def self.add(params = {})
@@ -50,6 +55,14 @@ class FastProwl
50
55
  prowl.run
51
56
  end
52
57
 
58
+ # Send a single Prowl notification _immediately_ (don't queue it in
59
+ # the Hydra). Returns the response code of the action
60
+ def self.verify(apikey)
61
+ prowl = new(:apikey => apikey)
62
+ prowl.valid?
63
+ prowl.run
64
+ end
65
+
53
66
  private
54
67
 
55
68
  # Setup and return a Typhoeus HTTP request
@@ -1,9 +1,8 @@
1
- require 'test/unit'
2
-
3
1
  $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/../lib")
4
2
  require 'fastprowl'
5
3
 
6
4
  require 'rubygems'
5
+ require 'test/unit'
7
6
  require 'mocha'
8
7
 
9
8
  class FastProwlTest < Test::Unit::TestCase
@@ -34,6 +33,16 @@ class FastProwlTest < Test::Unit::TestCase
34
33
  assert FastProwl.add(:apikey => VALID_API_KEY, :application => APPLICATION, :event => 'test_valid_api_key', :description => "This should work.")
35
34
  end
36
35
 
36
+ # Test an invalid API key
37
+ def test_invalid_api_key
38
+ assert !FastProwl.verify(BAD_API_KEY)
39
+ end
40
+
41
+ # Verify an API key
42
+ def test_verify_api_key
43
+ assert FastProwl.verify(VALID_API_KEY)
44
+ end
45
+
37
46
  # Concurrency test -- try to send a bunch of notifications
38
47
  def test_multi
39
48
  prowl = FastProwl.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastprowl
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Riley MacPherson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-15 00:00:00 -04:00
12
+ date: 2010-02-16 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 0.1.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mocha