pubsubhubbub-rails 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +6 -0
- data/Rakefile +2 -16
- data/app/controllers/pubsubhubbub/subscriptions_controller.rb +3 -3
- data/app/jobs/pubsubhubbub/deliver_payload_job.rb +1 -1
- data/app/models/pubsubhubbub/subscription.rb +5 -0
- data/db/migrate/20161126203748_create_pubsubhubbub_subscriptions.rb +1 -0
- data/lib/pubsubhubbub.rb +2 -0
- data/lib/pubsubhubbub/engine.rb +4 -0
- data/lib/pubsubhubbub/version.rb +1 -1
- metadata +2 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e1e57ed25a60b5353d6a2a0be5383ec687f5348
|
4
|
+
data.tar.gz: fe069db3bb82d6b97c480d6081074190cb2ba4f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5495c78dc0562ff98871987caa3a4c0bfc4729e0fa981bf7ab58cb7b6440675dbfeb3527849205d614726dafbd10d3da2fe06fd9cbbbb3f0c34531ed2fef572c
|
7
|
+
data.tar.gz: 7d67a52dc39f8c60c093f45b90b9636bededbbcb6271e12e84a1594be2363bd496dd127cea21314bb8ae2edc05a64018504a61dfbe652411ebfaae70bccaceba
|
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Pubsubhubbub
|
2
2
|
|
3
|
+
[][gem]
|
4
|
+
[][gemnasium]
|
5
|
+
|
6
|
+
[gem]: https://rubygems.org/gems/pubsubhubbub-rails
|
7
|
+
[gemnasium]: https://gemnasium.com/Gargron/pubsubhubbub
|
8
|
+
|
3
9
|
This is a mountable PubSubHubbub server conforming to the v0.4 of the spec.
|
4
10
|
|
5
11
|
## Usage
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
begin
|
2
3
|
require 'bundler/setup'
|
3
4
|
rescue LoadError
|
@@ -14,24 +15,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
15
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
16
|
end
|
16
17
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
18
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
18
19
|
load 'rails/tasks/engine.rake'
|
19
20
|
|
20
|
-
|
21
21
|
load 'rails/tasks/statistics.rake'
|
22
22
|
|
23
|
-
|
24
|
-
|
25
23
|
require 'bundler/gem_tasks'
|
26
|
-
|
27
|
-
require 'rake/testtask'
|
28
|
-
|
29
|
-
Rake::TestTask.new(:test) do |t|
|
30
|
-
t.libs << 'lib'
|
31
|
-
t.libs << 'test'
|
32
|
-
t.pattern = 'test/**/*_test.rb'
|
33
|
-
t.verbose = false
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
task default: :test
|
@@ -40,10 +40,10 @@ module Pubsubhubbub
|
|
40
40
|
xml = Nokogiri::XML(response.body)
|
41
41
|
xml.encoding = 'utf-8'
|
42
42
|
|
43
|
-
link = xml.at_xpath('//xmlns:link[@rel="hub"]')
|
44
|
-
topic = xml.at_xpath('//xmlns:link[@rel="self"]')
|
43
|
+
link = xml.at_xpath('//xmlns:link[@rel="hub"]', xmlns: XMLNS)
|
44
|
+
topic = xml.at_xpath('//xmlns:link[@rel="self"]', xmlns: XMLNS)
|
45
45
|
|
46
|
-
link
|
46
|
+
link&.attribute('href')&.value == hub_url && topic&.attribute('href')&.value == @topic
|
47
47
|
end
|
48
48
|
|
49
49
|
def subscribe
|
@@ -9,7 +9,7 @@ module Pubsubhubbub
|
|
9
9
|
link = LinkHeader.new([[hub_url, [%w(rel hub)]], [subscription.topic, [%w(rel self)]]])
|
10
10
|
headers = {}
|
11
11
|
|
12
|
-
headers['Link'] = link
|
12
|
+
headers['Link'] = link.to_s
|
13
13
|
headers['X-Hub-Signature'] = sign_payload(subscription.secret, current_payload) if subscription.secret
|
14
14
|
|
15
15
|
response = HTTP.timeout(:per_operation, write: 60, connect: 20, read: 60)
|
@@ -14,11 +14,16 @@ module Pubsubhubbub
|
|
14
14
|
end
|
15
15
|
|
16
16
|
before_validation :generate_challenge
|
17
|
+
before_validation :set_min_expiration
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
21
|
def generate_challenge
|
21
22
|
self.challenge = SecureRandom.hex
|
22
23
|
end
|
24
|
+
|
25
|
+
def set_min_expiration
|
26
|
+
self.lease_seconds = 0 unless expires_at
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
data/lib/pubsubhubbub.rb
CHANGED
data/lib/pubsubhubbub/engine.rb
CHANGED
data/lib/pubsubhubbub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubsubhubbub-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugen Rochko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,48 +86,6 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0.0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: sqlite3
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: pry-rails
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: httplog
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '0'
|
131
89
|
description: A PubSubHubbub server conforming to the v0.4 spec, mountable from a Rails
|
132
90
|
app
|
133
91
|
email:
|