pubsubhubbub 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +20 -0
  2. data/VERSION +1 -1
  3. data/lib/pubsubhubbub/client.rb +27 -29
  4. metadata +29 -13
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gemspec|
6
+ gemspec.name = "pubsubhubbub"
7
+ gemspec.summary = "Asynchronous PubSubHubbub client for Ruby"
8
+ gemspec.description = gemspec.summary
9
+ gemspec.email = "ilya@igvita.com"
10
+ gemspec.homepage = "http://github.com/igrigorik/pubsubhubbub"
11
+ gemspec.authors = ["Ilya Grigorik"]
12
+ gemspec.add_dependency('eventmachine', '>= 0.12.9')
13
+ gemspec.add_dependency('em-http-request', '>= 0.1.5')
14
+ gemspec.rubyforge_project = "pubsubhubbub"
15
+ end
16
+
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
20
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -19,42 +19,40 @@ module EventMachine
19
19
  {'hub.url' => feed, 'hub.mode' => 'publish'}.to_params
20
20
  end.join("&")
21
21
 
22
- r = EventMachine::HttpRequest.new(@hub).post :body => data, :head => HEADERS
23
- r.callback {
24
- if r.response_header.status == 204
25
- succeed r
26
- else
27
- fail r
28
- end
29
- }
30
-
31
- r.errback { fail }
32
- r
22
+ request(:body => data, :head => HEADERS)
33
23
  end
34
24
 
35
- # These command will work only if the callback URL supports confirmation.
25
+ # These command will work only if the callback URL supports confirmation.
36
26
  def subscribe(feed, callback, options = {}); command('subscribe', feed, callback, options); end
37
27
  def unsubscribe(feed, callback, options = {}); command('unsubscribe', feed, callback, options); end
38
28
 
39
29
  private
40
-
41
- def command(cmd, feed, callback, options)
42
- options['hub.verify'] ||= "sync"
43
-
44
- params = {'hub.topic' => feed, 'hub.mode' => cmd, 'hub.callback' => callback}.merge(options).to_params
45
- r = EventMachine::HttpRequest.new(@hub).post :body => params, :head => HEADERS
46
-
47
- r.callback {
48
- if r.response_header.status == 204
49
- succeed r
50
- else
51
- fail r
30
+
31
+ def command(cmd, feed, callback, options)
32
+ options['hub.verify'] ||= "sync"
33
+ params = {'hub.topic' => feed, 'hub.mode' => cmd, 'hub.callback' => callback}.merge(options).to_params
34
+
35
+ request(:body => params, :head => HEADERS)
36
+ end
37
+
38
+ def request(opts)
39
+ r = http_request(opts)
40
+
41
+ r.callback do
42
+ if r.response_header.status == 204
43
+ succeed r
44
+ else
45
+ fail r
46
+ end
52
47
  end
53
- }
54
48
 
55
- r.errback { fail }
56
- r
57
- end
49
+ r.errback { fail }
50
+ r
51
+
52
+ end
58
53
 
54
+ def http_request(opts)
55
+ EventMachine::HttpRequest.new(@hub).post opts
56
+ end
59
57
  end
60
- end
58
+ end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubsubhubbub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ilya Grigorik
@@ -9,29 +14,37 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-10-26 00:00:00 -04:00
17
+ date: 2010-05-01 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: eventmachine
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 12
30
+ - 9
23
31
  version: 0.12.9
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: em-http-request
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 1
44
+ - 5
33
45
  version: 0.1.5
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  description: Asynchronous PubSubHubbub client for Ruby
36
49
  email: ilya@igvita.com
37
50
  executables: []
@@ -42,6 +55,7 @@ extra_rdoc_files:
42
55
  - README.rdoc
43
56
  files:
44
57
  - README.rdoc
58
+ - Rakefile
45
59
  - VERSION
46
60
  - lib/pubsubhubbub.rb
47
61
  - lib/pubsubhubbub/client.rb
@@ -59,18 +73,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
73
  requirements:
60
74
  - - ">="
61
75
  - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
62
78
  version: "0"
63
- version:
64
79
  required_rubygems_version: !ruby/object:Gem::Requirement
65
80
  requirements:
66
81
  - - ">="
67
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
68
85
  version: "0"
69
- version:
70
86
  requirements: []
71
87
 
72
88
  rubyforge_project: pubsubhubbub
73
- rubygems_version: 1.3.5
89
+ rubygems_version: 1.3.6
74
90
  signing_key:
75
91
  specification_version: 3
76
92
  summary: Asynchronous PubSubHubbub client for Ruby