pubsubhubbub-rails 0.2.2 → 0.2.3
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/app/jobs/pubsubhubbub/fetch_topic_job.rb +6 -1
- data/lib/pubsubhubbub/version.rb +1 -1
- data/lib/pubsubhubbub.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e8bc78d56e7b428056aafff01871dd50b1d495
|
4
|
+
data.tar.gz: d006724c06381685bd67e242d52b19a939618a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb00f7e01dd78f52ae6abd126aba1ccfe51fb5e5659fc99bf419cb4120de55e70e6fd49283c74a8ab796a1a6082e740f416e2ab10929c7aae28bf52a8ddecfa
|
7
|
+
data.tar.gz: 47e46ae2ac9014b27425e99a4f35f69120bb846d39c13fb6d8d48c4b06092d96d266bddfd5d7d64de77378735be308ac83eee449d11ac3c5c17d09eb9f544ead
|
data/README.md
CHANGED
@@ -28,6 +28,12 @@ If you want to override topic verification (which is done before subscribe/unsub
|
|
28
28
|
Pubsubhubbub.verify_topic = lambda { |topic_url| topic_url == 'http://mysite.com/my-feed' }
|
29
29
|
```
|
30
30
|
|
31
|
+
You can also override the fetching of the topic when it is updated, for example if it's generally not publicly accessible or if you generate the feed from the Rails app where you mounted the hub.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Pubsubhubbub.render_topic = lambda { |topic_url| FeedsController.render(:show) }
|
35
|
+
```
|
36
|
+
|
31
37
|
## Installation
|
32
38
|
Add this line to your application's Gemfile:
|
33
39
|
|
@@ -5,7 +5,12 @@ module Pubsubhubbub
|
|
5
5
|
|
6
6
|
def perform(hub_url, url)
|
7
7
|
return unless Subscription.where(topic: url).active.any?
|
8
|
-
|
8
|
+
|
9
|
+
current_payload = if Pubsubhubbub.render_topic.is_a?(Proc)
|
10
|
+
Pubsubhubbub.render_topic.call(url)
|
11
|
+
else
|
12
|
+
HTTP.timeout(:per_operation, write: 60, connect: 20, read: 60).get(url).body.to_s
|
13
|
+
end
|
9
14
|
|
10
15
|
Subscription.where(topic: url).active.find_each do |subscription|
|
11
16
|
DeliverPayloadJob.perform_later(hub_url, subscription.id, current_payload)
|
data/lib/pubsubhubbub/version.rb
CHANGED
data/lib/pubsubhubbub.rb
CHANGED