rack-superfeedr 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Gemfile +2 -2
- data/Gemfile.lock +31 -30
- data/VERSION +1 -1
- data/lib/rack-superfeedr.rb +29 -12
- data/rack-superfeedr.gemspec +6 -6
- data/test/test_rack-superfeedr.rb +1 -1
- metadata +17 -21
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWU2NzliNmM1NjE4MDQxYjM4ZThjYTdkMzlmZjQ2YTQzYTc5OTNlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTU5NDYxMDc0YmM4MzJjNGE0Y2U5ZmExNWQ0M2ViYzlmNWE0YWM4NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDk0NTA2M2U4YjNkYWMxMDFkNWUyY2U5OGEyN2YyNTAwZTQ4YWY2ZGIyN2Mw
|
10
|
+
YjVkMjFjYzE3NjYzZjhhYTE1NjMxMDJhYjE1OWVjOWJhODVkYTAzN2NkY2I5
|
11
|
+
MjM5ODhhMjRjOTJjMWE1ZDgxNzg0MTgzYzk2MmI2ZGFjMTcwZWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmNjZTFjMWZlZTBjNmE2NmUxNzRjM2Q3ZDA2MmRiNGMwNDg1NWM3MzM2N2M5
|
14
|
+
ZDFkNTAzNzE4NDhiYjQzMzRhMDI1OWNmNDQzZTNkNGExY2RmNmI2ODdiZmU5
|
15
|
+
NjE0ZTA4YjhhNjIwYzgzZWNmZjViM2Q2NjllZDJiOTAzYzFhOTY=
|
data/Gemfile
CHANGED
@@ -3,14 +3,14 @@ source 'http://rubygems.org'
|
|
3
3
|
# Example:
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
gem 'rack'
|
6
|
-
gem 'nokogiri', ">=1.6.1"
|
7
6
|
|
8
7
|
# Add dependencies to develop your gem here.
|
9
8
|
# Include everything needed to run rake, tests, features, etc.
|
10
|
-
group :development do
|
9
|
+
group :development, :test do
|
11
10
|
gem 'shoulda', '>= 0'
|
12
11
|
gem 'turn'
|
13
12
|
gem 'bundler', '>= 1.0.0'
|
14
13
|
gem 'jeweler', '>= 1.6.4'
|
15
14
|
gem 'thin'
|
15
|
+
gem 'test-unit'
|
16
16
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (4.0.
|
4
|
+
activesupport (4.0.13)
|
5
5
|
i18n (~> 0.6, >= 0.6.9)
|
6
6
|
minitest (~> 4.2)
|
7
7
|
multi_json (~> 1.3)
|
8
8
|
thread_safe (~> 0.1)
|
9
9
|
tzinfo (~> 0.3.37)
|
10
|
-
addressable (2.3.
|
11
|
-
ansi (1.
|
10
|
+
addressable (2.3.8)
|
11
|
+
ansi (1.5.0)
|
12
12
|
builder (3.2.2)
|
13
|
-
daemons (1.
|
13
|
+
daemons (1.2.2)
|
14
14
|
descendants_tracker (0.0.4)
|
15
15
|
thread_safe (~> 0.3, >= 0.3.1)
|
16
|
-
eventmachine (1.0.
|
17
|
-
faraday (0.9.
|
16
|
+
eventmachine (1.0.7)
|
17
|
+
faraday (0.9.1)
|
18
18
|
multipart-post (>= 1.2, < 3)
|
19
|
-
git (1.2.
|
20
|
-
github_api (0.12.
|
19
|
+
git (1.2.9.1)
|
20
|
+
github_api (0.12.3)
|
21
21
|
addressable (~> 2.3)
|
22
22
|
descendants_tracker (~> 0.0.4)
|
23
23
|
faraday (~> 0.8, < 0.10)
|
24
|
-
hashie (>= 3.
|
24
|
+
hashie (>= 3.3)
|
25
25
|
multi_json (>= 1.7.5, < 2.0)
|
26
26
|
nokogiri (~> 1.6.3)
|
27
27
|
oauth2
|
28
|
-
hashie (3.
|
29
|
-
highline (1.
|
30
|
-
i18n (0.
|
28
|
+
hashie (3.4.1)
|
29
|
+
highline (1.7.2)
|
30
|
+
i18n (0.7.0)
|
31
31
|
jeweler (2.0.1)
|
32
32
|
builder
|
33
33
|
bundler (>= 1.0)
|
@@ -37,40 +37,41 @@ GEM
|
|
37
37
|
nokogiri (>= 1.5.10)
|
38
38
|
rake
|
39
39
|
rdoc
|
40
|
-
|
41
|
-
|
42
|
-
mini_portile (0.6.0)
|
40
|
+
jwt (1.4.1)
|
41
|
+
mini_portile (0.6.2)
|
43
42
|
minitest (4.7.5)
|
44
|
-
multi_json (1.
|
43
|
+
multi_json (1.11.0)
|
45
44
|
multi_xml (0.5.5)
|
46
45
|
multipart-post (2.0.0)
|
47
|
-
nokogiri (1.6.
|
48
|
-
mini_portile (
|
46
|
+
nokogiri (1.6.6.2)
|
47
|
+
mini_portile (~> 0.6.0)
|
49
48
|
oauth2 (1.0.0)
|
50
49
|
faraday (>= 0.8, < 0.10)
|
51
50
|
jwt (~> 1.0)
|
52
51
|
multi_json (~> 1.3)
|
53
52
|
multi_xml (~> 0.5)
|
54
53
|
rack (~> 1.2)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
power_assert (0.2.3)
|
55
|
+
rack (1.6.0)
|
56
|
+
rake (10.4.2)
|
57
|
+
rdoc (4.2.0)
|
59
58
|
shoulda (3.5.0)
|
60
59
|
shoulda-context (~> 1.0, >= 1.0.1)
|
61
60
|
shoulda-matchers (>= 1.4.1, < 3.0)
|
62
61
|
shoulda-context (1.2.1)
|
63
|
-
shoulda-matchers (2.
|
62
|
+
shoulda-matchers (2.8.0)
|
64
63
|
activesupport (>= 3.0.0)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
test-unit (3.0.9)
|
65
|
+
power_assert
|
66
|
+
thin (1.6.3)
|
67
|
+
daemons (~> 1.0, >= 1.0.9)
|
68
|
+
eventmachine (~> 1.0)
|
69
|
+
rack (~> 1.0)
|
70
|
+
thread_safe (0.3.5)
|
70
71
|
turn (0.9.7)
|
71
72
|
ansi
|
72
73
|
minitest (~> 4)
|
73
|
-
tzinfo (0.3.
|
74
|
+
tzinfo (0.3.43)
|
74
75
|
|
75
76
|
PLATFORMS
|
76
77
|
ruby
|
@@ -78,8 +79,8 @@ PLATFORMS
|
|
78
79
|
DEPENDENCIES
|
79
80
|
bundler (>= 1.0.0)
|
80
81
|
jeweler (>= 1.6.4)
|
81
|
-
nokogiri (>= 1.6.1)
|
82
82
|
rack
|
83
83
|
shoulda
|
84
|
+
test-unit
|
84
85
|
thin
|
85
86
|
turn
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
data/lib/rack-superfeedr.rb
CHANGED
@@ -151,18 +151,6 @@ module SuperfeedrAPI
|
|
151
151
|
# Unsubscribes a url. If you used an id for the susbcription, you need to use _the same_.
|
152
152
|
# 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
|
153
153
|
# It returns true if the unsubscription was successful (or will be confirmed if you used async => true in the options), false otherwise
|
154
|
-
# You can also pass an opts third argument that will be merged with the options used in Typhoeus's Request (https://github.com/dbalatero/typhoeus)
|
155
|
-
|
156
|
-
##
|
157
|
-
# Subscribe you to a url. id needs to match the id you used to subscribe.
|
158
|
-
# A 3rd options argument can be supplied with
|
159
|
-
# - sync => true (defaults to false) if you want to perfrom a verification of intent syncrhonously
|
160
|
-
# - async => true (defaults to false) if you want to perfrom a verification of intent asyncrhonously
|
161
|
-
# - hub => if you want to use an explicit hub, defaults to Superfeedr's http://push.superfeedr.com
|
162
|
-
# It yields 3 arguments to a block:
|
163
|
-
# - body of the response (useful to debug failed notifications)
|
164
|
-
# - success flag
|
165
|
-
# - response (useful to debug failed requests mostly)
|
166
154
|
def unsubscribe(url, id = nil, opts = {}, &blk)
|
167
155
|
endpoint = opts[:hub] || @@superfeedr_endpoint
|
168
156
|
request = prep_request(url, id, endpoint, opts)
|
@@ -178,6 +166,35 @@ module SuperfeedrAPI
|
|
178
166
|
r
|
179
167
|
end
|
180
168
|
|
169
|
+
##
|
170
|
+
# Replay as notification.
|
171
|
+
# Required:
|
172
|
+
# - url of the topic to be replayed
|
173
|
+
# - id to build the callback url
|
174
|
+
# 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
|
175
|
+
# It returns true if the unsubscription was successful (or will be confirmed if you used async => true in the options), false otherwise
|
176
|
+
def replay(url, id = nil, opts = {}, &blk)
|
177
|
+
endpoint = opts[:hub] || @@superfeedr_endpoint
|
178
|
+
request = prep_request(url, id, endpoint, opts)
|
179
|
+
|
180
|
+
request['hub.mode'] = 'replay'
|
181
|
+
|
182
|
+
response = http_get(endpoint, request)
|
183
|
+
|
184
|
+
r = response.body, Integer(response.code) == 204, response
|
185
|
+
if blk
|
186
|
+
blk.call(r)
|
187
|
+
end
|
188
|
+
r
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
##
|
193
|
+
# Lists subscriptions.
|
194
|
+
# options (first argument) include:
|
195
|
+
# - page (integer starts at 1)
|
196
|
+
# - by_page (integer, number of items per page)
|
197
|
+
# - search (string) a query string to only match certain subscriptions. Check Superfeedr docs for details
|
181
198
|
def list(opts = {}, &blk)
|
182
199
|
endpoint = @@superfeedr_endpoint
|
183
200
|
request = {
|
data/rack-superfeedr.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: rack-superfeedr 0.4.
|
5
|
+
# stub: rack-superfeedr 0.4.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "rack-superfeedr"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["julien51"]
|
14
|
-
s.date = "2015-04-
|
14
|
+
s.date = "2015-04-24"
|
15
15
|
s.description = "A gem that provides a rack middleware to interract with Superfeedr's API. "
|
16
16
|
s.email = "julien@superfeedr.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -42,29 +42,29 @@ Gem::Specification.new do |s|
|
|
42
42
|
|
43
43
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
44
|
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
45
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 1.6.1"])
|
46
45
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
46
|
s.add_development_dependency(%q<turn>, [">= 0"])
|
48
47
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
49
48
|
s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
|
50
49
|
s.add_development_dependency(%q<thin>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<test-unit>, [">= 0"])
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<rack>, [">= 0"])
|
53
|
-
s.add_dependency(%q<nokogiri>, [">= 1.6.1"])
|
54
53
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
55
54
|
s.add_dependency(%q<turn>, [">= 0"])
|
56
55
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
57
56
|
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
58
57
|
s.add_dependency(%q<thin>, [">= 0"])
|
58
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
59
59
|
end
|
60
60
|
else
|
61
61
|
s.add_dependency(%q<rack>, [">= 0"])
|
62
|
-
s.add_dependency(%q<nokogiri>, [">= 1.6.1"])
|
63
62
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
64
63
|
s.add_dependency(%q<turn>, [">= 0"])
|
65
64
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
66
65
|
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
67
66
|
s.add_dependency(%q<thin>, [">= 0"])
|
67
|
+
s.add_dependency(%q<test-unit>, [">= 0"])
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -3,7 +3,7 @@ require 'rack'
|
|
3
3
|
require_relative 'helper.rb'
|
4
4
|
|
5
5
|
# To run tests locally, we're using runscope's passageway which proxies requests inside the firewall. (make sure you bind to port 4567)
|
6
|
-
HOST = '
|
6
|
+
HOST = '3bbb3b2e39fe.a.passageway.io'
|
7
7
|
PORT = 80
|
8
8
|
# Also, we need superfeedr credentials.
|
9
9
|
LOGIN = 'demo'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-superfeedr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- julien51
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -25,23 +25,21 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: shoulda
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
|
35
|
-
type: :runtime
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - ! '>='
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
42
|
-
MS42LjE=
|
40
|
+
version: '0'
|
43
41
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
42
|
+
name: turn
|
45
43
|
requirement: !ruby/object:Gem::Requirement
|
46
44
|
requirements:
|
47
45
|
- - ! '>='
|
@@ -55,27 +53,27 @@ dependencies:
|
|
55
53
|
- !ruby/object:Gem::Version
|
56
54
|
version: '0'
|
57
55
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
56
|
+
name: bundler
|
59
57
|
requirement: !ruby/object:Gem::Requirement
|
60
58
|
requirements:
|
61
59
|
- - ! '>='
|
62
60
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
61
|
+
version: 1.0.0
|
64
62
|
type: :development
|
65
63
|
prerelease: false
|
66
64
|
version_requirements: !ruby/object:Gem::Requirement
|
67
65
|
requirements:
|
68
66
|
- - ! '>='
|
69
67
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
68
|
+
version: 1.0.0
|
71
69
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
70
|
+
name: jeweler
|
73
71
|
requirement: !ruby/object:Gem::Requirement
|
74
72
|
requirements:
|
75
73
|
- - ! '>='
|
76
74
|
- !ruby/object:Gem::Version
|
77
75
|
version: !binary |-
|
78
|
-
|
76
|
+
MS42LjQ=
|
79
77
|
type: :development
|
80
78
|
prerelease: false
|
81
79
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,25 +81,23 @@ dependencies:
|
|
83
81
|
- - ! '>='
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: !binary |-
|
86
|
-
|
84
|
+
MS42LjQ=
|
87
85
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
86
|
+
name: thin
|
89
87
|
requirement: !ruby/object:Gem::Requirement
|
90
88
|
requirements:
|
91
89
|
- - ! '>='
|
92
90
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
94
|
-
MS42LjQ=
|
91
|
+
version: '0'
|
95
92
|
type: :development
|
96
93
|
prerelease: false
|
97
94
|
version_requirements: !ruby/object:Gem::Requirement
|
98
95
|
requirements:
|
99
96
|
- - ! '>='
|
100
97
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
102
|
-
MS42LjQ=
|
98
|
+
version: '0'
|
103
99
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
100
|
+
name: test-unit
|
105
101
|
requirement: !ruby/object:Gem::Requirement
|
106
102
|
requirements:
|
107
103
|
- - ! '>='
|