pubsubhubbub-rails 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51b911c4708d544e5e92f761de1f988d237f895c
4
- data.tar.gz: 8dd3bbbc86ae5183271e6b24315d146c52cb2640
3
+ metadata.gz: 61e8bc78d56e7b428056aafff01871dd50b1d495
4
+ data.tar.gz: d006724c06381685bd67e242d52b19a939618a24
5
5
  SHA512:
6
- metadata.gz: e918b92fc3d44fc6c386c8983cba1957b300e0c5208f3134195ee04109769b84d01c4aad99216e9efdd02330c360946018c1950278d55b99af3a89e8282b7af3
7
- data.tar.gz: d932bb8527324d21d571e260b18dcd5c84cc39b9918c161d69fea1387dbbdd52ca89b3852f4319ab5499906c8677563ec39bb47e63a22916e50e72bf8ce0fc3e
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
- current_payload = HTTP.timeout(:per_operation, write: 60, connect: 20, read: 60).get(url).body.to_s
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)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Pubsubhubbub
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  end
data/lib/pubsubhubbub.rb CHANGED
@@ -16,4 +16,5 @@ module Pubsubhubbub
16
16
  end
17
17
 
18
18
  mattr_accessor :verify_topic
19
+ mattr_accessor :render_topic
19
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubsubhubbub-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Rochko