pubsubhubbub-rails 0.2.1 → 0.2.2

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: 6349db14daf275336a05ef0f3eb475254dffe6bc
4
- data.tar.gz: c8ce75a29351f825b8d1c799dd33665c555ba063
3
+ metadata.gz: 51b911c4708d544e5e92f761de1f988d237f895c
4
+ data.tar.gz: 8dd3bbbc86ae5183271e6b24315d146c52cb2640
5
5
  SHA512:
6
- metadata.gz: 545bfa9f131ed04832b7ecea89f0ac91883de681f4aafec1b4ff8cb8f3f3557b5d5175bb095acd0abbabc4f82bd8688a0684466e9568174d3af0138249933a8f
7
- data.tar.gz: 737998e5e77034a4875dffb4451306b7aa37abbda116423fc6894bf1e677657e5e25269f44f3de6aeb4fa7aea96596306031932f5d6211976ae6e3e2b0658f88
6
+ metadata.gz: e918b92fc3d44fc6c386c8983cba1957b300e0c5208f3134195ee04109769b84d01c4aad99216e9efdd02330c360946018c1950278d55b99af3a89e8282b7af3
7
+ data.tar.gz: d932bb8527324d21d571e260b18dcd5c84cc39b9918c161d69fea1387dbbdd52ca89b3852f4319ab5499906c8677563ec39bb47e63a22916e50e72bf8ce0fc3e
data/README.md CHANGED
@@ -12,11 +12,21 @@ This is a mountable PubSubHubbub server conforming to the v0.4 of the spec.
12
12
 
13
13
  In `routes.rb`:
14
14
 
15
- mount Pubsubhubbub::Engine, at: 'pubsubhubbub', as: :pubsubhubbub
15
+ ```ruby
16
+ mount Pubsubhubbub::Engine, at: 'pubsubhubbub', as: :pubsubhubbub
17
+ ```
16
18
 
17
19
  In feed:
18
20
 
19
- <link rel="hub" href="<%= pubsubhubbub_url %>" />
21
+ ```erb
22
+ <link rel="hub" href="<%= pubsubhubbub_url %>" />
23
+ ```
24
+
25
+ If you want to override topic verification (which is done before subscribe/unsubscribe events to confirm that the topic is in fact using the hub), you can add a custom initializer, e.g. `config/initializers/pubsubhubbub.rb`:
26
+
27
+ ```ruby
28
+ Pubsubhubbub.verify_topic = lambda { |topic_url| topic_url == 'http://mysite.com/my-feed' }
29
+ ```
20
30
 
21
31
  ## Installation
22
32
  Add this line to your application's Gemfile:
@@ -30,6 +30,8 @@ module Pubsubhubbub
30
30
  private
31
31
 
32
32
  def check_topic_hub!
33
+ return Pubsubhubbub.verify_topic.call(@topic) if Pubsubhubbub.verify_topic.is_a?(Proc)
34
+
33
35
  uri = Addressable::URI.parse(@topic)
34
36
  response = HTTP.get(uri)
35
37
 
data/lib/pubsubhubbub.rb CHANGED
@@ -14,4 +14,6 @@ module Pubsubhubbub
14
14
 
15
15
  class ValidationError < StandardError
16
16
  end
17
+
18
+ mattr_accessor :verify_topic
17
19
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Pubsubhubbub
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Rochko