rack-superfeedr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +28 -0
- data/README.rdoc +31 -5
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/examples/sinatra_app.rb +8 -7
- data/lib/rack-superfeedr.rb +3 -3
- data/rack-superfeedr.gemspec +78 -0
- metadata +26 -24
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
mime-types (1.17.2)
|
10
|
+
nokogiri (1.5.0)
|
11
|
+
rack (1.4.0)
|
12
|
+
rake (0.9.2.2)
|
13
|
+
rcov (0.9.11)
|
14
|
+
shoulda (2.11.3)
|
15
|
+
typhoeus (0.3.3)
|
16
|
+
mime-types
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
bundler (~> 1.0.0)
|
23
|
+
jeweler (~> 1.6.4)
|
24
|
+
nokogiri
|
25
|
+
rack
|
26
|
+
rcov
|
27
|
+
shoulda
|
28
|
+
typhoeus
|
data/README.rdoc
CHANGED
@@ -1,8 +1,36 @@
|
|
1
1
|
= rack-superfeedr
|
2
2
|
|
3
|
-
A gem that provides a rack middleware to interact with Superfeedr's PubSubHubbub API. It let you subscribe
|
3
|
+
A gem that provides a rack middleware to interact with {Superfeedr}[http://superfeedr.com/]'s PubSubHubbub API. It let you *subscribe*, *unsubscribe* and *receive* incoming feed notifications.
|
4
|
+
This should work with any Rack-compatible framework, as well as fully managed platforms like {Heroku}[http://www.heroku.com/].
|
4
5
|
|
5
|
-
==
|
6
|
+
== Installing
|
7
|
+
|
8
|
+
gem install rack-superfeedr
|
9
|
+
|
10
|
+
== Using
|
11
|
+
|
12
|
+
You first need a {subscriber account}[http://superfeedr.com/subscriber] with Superfeedr.
|
13
|
+
|
14
|
+
*Warning* : your web application needs to be accessible for Superfeedr to send notifications. If you want to test it locally, we suggest you use it with a tool like {showoff}[https://showoff.io/] which will make your local port accessible from the outside world.
|
15
|
+
|
16
|
+
=== Sinatra
|
17
|
+
|
18
|
+
See the {example}[https://github.com/superfeedr/rack-superfeedr/blob/master/examples/sinatra_app.rb]... and {check the docs}[http://rubydoc.info/github/superfeedr/rack-superfeedr/master/Rack/Superfeedr] for more details.
|
19
|
+
|
20
|
+
=== Rails
|
21
|
+
|
22
|
+
Tested with Rails 3.2, but should work with any Rails version that supports Rack.
|
23
|
+
|
24
|
+
Install the gem (using bundle), and then in <code>config/application.rb</code>, inside the <code>class Application < Rails::Application</code> block, just add the following line.
|
25
|
+
|
26
|
+
config.middleware.use Rack::Superfeedr, { :host => DOMAIN, :login => SUPERFEEDR_LOGIN, :password => SUPERFEEDR_PASSWORD} do |superfeedr|
|
27
|
+
Superfeedr = superfeedr
|
28
|
+
end
|
29
|
+
|
30
|
+
You can then access the Superfeedr object anywhere in your rails application with <code>YOUR_APP_::Application::Superfeedr</code>.
|
31
|
+
|
32
|
+
|
33
|
+
== Contributing
|
6
34
|
|
7
35
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
36
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -10,10 +38,8 @@ A gem that provides a rack middleware to interact with Superfeedr's PubSubHubbub
|
|
10
38
|
* Start a feature/bugfix branch
|
11
39
|
* Commit and push until you are happy with your contribution
|
12
40
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
41
|
|
15
42
|
== Copyright
|
16
43
|
|
17
|
-
Copyright (c) 2012 Superfeedr. See LICENSE.txt for
|
18
|
-
further details.
|
44
|
+
Copyright (c) 2012 Superfeedr. See LICENSE.txt for further details.
|
19
45
|
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "rack-superfeedr"
|
18
|
-
gem.homepage = "http://
|
18
|
+
gem.homepage = "http://rubygems.org/gems/rack-superfeedr"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.add_dependency "rack"
|
21
21
|
gem.add_dependency "nokogiri"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/examples/sinatra_app.rb
CHANGED
@@ -3,19 +3,20 @@ require 'rack-superfeedr'
|
|
3
3
|
|
4
4
|
use Rack::Superfeedr, { :host => "plant-leg.showoff.io", :login => "demo", :password => "demo", :format => "json", :async => false } do |superfeedr|
|
5
5
|
Superfeedr = superfeedr
|
6
|
-
superfeedr.on_notification do |notification|
|
7
|
-
puts notification.to_s
|
8
|
-
end
|
9
6
|
end
|
10
7
|
|
11
8
|
get '/hi' do
|
12
|
-
"Hello World!"
|
9
|
+
"Hello World!" # Maybe serve the data you saved from Superfeedr's handler.
|
13
10
|
end
|
14
11
|
|
15
12
|
get '/subscribe' do
|
16
|
-
Superfeedr.subscribe("http://push-pub.appspot.com/feed"
|
13
|
+
Superfeedr.subscribe("http://push-pub.appspot.com/feed")
|
17
14
|
end
|
18
15
|
|
19
16
|
get '/unsubscribe' do
|
20
|
-
Superfeedr.unsubscribe("http://push-pub.appspot.com/feed"
|
21
|
-
end
|
17
|
+
Superfeedr.unsubscribe("http://push-pub.appspot.com/feed")
|
18
|
+
end
|
19
|
+
|
20
|
+
Superfeedr.on_notification do |notification|
|
21
|
+
puts notification.to_s # You probably want to persist that data in some kind of data store...
|
22
|
+
end
|
data/lib/rack-superfeedr.rb
CHANGED
@@ -16,7 +16,7 @@ module Rack
|
|
16
16
|
# is concerned by a notification.
|
17
17
|
# The optional block will be called to let you confirm the subscription (or not).
|
18
18
|
# It returns true if the subscription was successful (or will be confirmed if you used async => true in the options), false otherwise
|
19
|
-
def subscribe(url, id, &block)
|
19
|
+
def subscribe(url, id = nil, &block)
|
20
20
|
feed_id = "#{id ? id : Base64.urlsafe_encode64(url)}"
|
21
21
|
if block
|
22
22
|
@verifications[feed_id] ||= {}
|
@@ -42,7 +42,7 @@ module Rack
|
|
42
42
|
# Unsubscribes a url. If you used an id for the susbcription, you need to use _the same_.
|
43
43
|
# The optional block will be called to let you confirm the subscription (or not). This is not applicable for if you use params[:async] => true
|
44
44
|
# It returns true if the unsubscription was successful (or will be confirmed if you used async => true in the options), false otherwise
|
45
|
-
def unsubscribe(url, id, &block)
|
45
|
+
def unsubscribe(url, id = nil, &block)
|
46
46
|
feed_id = "#{id ? id : Base64.urlsafe_encode64(url)}"
|
47
47
|
if block
|
48
48
|
@verifications[feed_id] ||= {}
|
@@ -70,7 +70,7 @@ module Rack
|
|
70
70
|
end
|
71
71
|
|
72
72
|
##
|
73
|
-
# When using this Rack, you need to supply the following
|
73
|
+
# When using this Rack, you need to supply the following params (2nd argument):
|
74
74
|
# - :host (the host for your web app. Used to build the callback urls.)
|
75
75
|
# - :login
|
76
76
|
# - :password
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rack-superfeedr}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["julien51"]
|
12
|
+
s.date = %q{2012-01-21}
|
13
|
+
s.description = %q{A gem that provides a rack middleware to interract with Superfeedr's API. }
|
14
|
+
s.email = %q{julien@superfeedr.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"examples/sinatra_app.rb",
|
28
|
+
"lib/rack-superfeedr.rb",
|
29
|
+
"rack-superfeedr.gemspec",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_rack-superfeedr.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://rubygems.org/gems/rack-superfeedr}
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.6.2}
|
37
|
+
s.summary = %q{A gem that provides a rack middleware to interract with Superfeedr's API.}
|
38
|
+
|
39
|
+
if s.respond_to? :specification_version then
|
40
|
+
s.specification_version = 3
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
44
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
45
|
+
s.add_runtime_dependency(%q<typhoeus>, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
49
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<typhoeus>, [">= 0"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
55
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
56
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
57
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
60
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
61
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
62
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
63
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
64
|
+
end
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
67
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
68
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
69
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
72
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
74
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
75
|
+
s.add_dependency(%q<typhoeus>, [">= 0"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-superfeedr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-21 00:00:00.000000000 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
17
|
-
requirement: &
|
17
|
+
requirement: &2169168240 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2169168240
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: nokogiri
|
28
|
-
requirement: &
|
28
|
+
requirement: &2169166360 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2169166360
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: typhoeus
|
39
|
-
requirement: &
|
39
|
+
requirement: &2169164060 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2169164060
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: shoulda
|
50
|
-
requirement: &
|
50
|
+
requirement: &2169163100 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2169163100
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: bundler
|
61
|
-
requirement: &
|
61
|
+
requirement: &2169162020 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 1.0.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2169162020
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: jeweler
|
72
|
-
requirement: &
|
72
|
+
requirement: &2169160980 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.6.4
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2169160980
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rcov
|
83
|
-
requirement: &
|
83
|
+
requirement: &2169160080 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2169160080
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rack
|
94
|
-
requirement: &
|
94
|
+
requirement: &2169159000 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2169159000
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: nokogiri
|
105
|
-
requirement: &
|
105
|
+
requirement: &2169158160 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2169158160
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: typhoeus
|
116
|
-
requirement: &
|
116
|
+
requirement: &2169157400 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2169157400
|
125
125
|
description: ! 'A gem that provides a rack middleware to interract with Superfeedr''s
|
126
126
|
API. '
|
127
127
|
email: julien@superfeedr.com
|
@@ -133,16 +133,18 @@ extra_rdoc_files:
|
|
133
133
|
files:
|
134
134
|
- .document
|
135
135
|
- Gemfile
|
136
|
+
- Gemfile.lock
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.rdoc
|
138
139
|
- Rakefile
|
139
140
|
- VERSION
|
140
141
|
- examples/sinatra_app.rb
|
141
142
|
- lib/rack-superfeedr.rb
|
143
|
+
- rack-superfeedr.gemspec
|
142
144
|
- test/helper.rb
|
143
145
|
- test/test_rack-superfeedr.rb
|
144
146
|
has_rdoc: true
|
145
|
-
homepage: http://
|
147
|
+
homepage: http://rubygems.org/gems/rack-superfeedr
|
146
148
|
licenses:
|
147
149
|
- MIT
|
148
150
|
post_install_message:
|
@@ -157,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
159
|
version: '0'
|
158
160
|
segments:
|
159
161
|
- 0
|
160
|
-
hash: -
|
162
|
+
hash: -4467505655233297769
|
161
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
164
|
none: false
|
163
165
|
requirements:
|