ostatus2 0.2.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ostatus2/subscription.rb +9 -9
- data/lib/ostatus2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82834f96da926c89edc1118bdd8c27a8e9d06668
|
4
|
+
data.tar.gz: eb6edd40cd3d229d80d0cf56ccba8d0df64a48c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afea277aab5d499ba2e10da7f7f20cb273d446fbfac6c2d2740cb9ee6bd6a6cef7be60e95f93ec753c7dfaa9ae76e29451f6cf97c78189f7ba9fe0540ba5995e
|
7
|
+
data.tar.gz: b3e2133de2da00f7d67fd80e7b4c44494e1f14a9a96e0faf0791c9719a08947b040e5d784d83fe41539ffb4a5b83d745417e587f0dc89533db867a36c2bf0626
|
@@ -5,13 +5,14 @@ module OStatus2
|
|
5
5
|
# @option options [String] :webhook Webhook URL
|
6
6
|
# @option options [String] :hub Hub URL to work with
|
7
7
|
# @option options [String] :secret Secret key of the subscription
|
8
|
+
# @option options [String] :lease_seconds Number of seconds to request subscription for (may not be respected by hub)
|
8
9
|
# @option options [String] :token Verification token of the subscription
|
9
10
|
def initialize(topic_url, options = {})
|
10
|
-
@topic_url
|
11
|
-
@webhook_url
|
12
|
-
@secret
|
13
|
-
@
|
14
|
-
@hub
|
11
|
+
@topic_url = topic_url
|
12
|
+
@webhook_url = options[:webhook] || ''
|
13
|
+
@secret = options[:secret] || ''
|
14
|
+
@lease_seconds = options[:lease_seconds] || ''
|
15
|
+
@hub = options[:hub] || ''
|
15
16
|
end
|
16
17
|
|
17
18
|
# Subscribe to the topic via a specified hub
|
@@ -32,10 +33,9 @@ module OStatus2
|
|
32
33
|
|
33
34
|
# Check if the hub is responding to the right subscription request
|
34
35
|
# @param [String] topic_url A hub.topic from the hub
|
35
|
-
# @param [String] token A hub.verify_token from the hub
|
36
36
|
# @return [Boolean]
|
37
|
-
def valid?(topic_url
|
38
|
-
@topic_url == topic_url
|
37
|
+
def valid?(topic_url)
|
38
|
+
@topic_url == topic_url
|
39
39
|
end
|
40
40
|
|
41
41
|
# Verify that the feed contents were meant for this subscription
|
@@ -51,7 +51,7 @@ module OStatus2
|
|
51
51
|
|
52
52
|
def update_subscription(mode)
|
53
53
|
hub_url = Addressable::URI.parse(@hub)
|
54
|
-
response = http_client.post(hub_url, form: { 'hub.mode' => mode.to_s, 'hub.callback' => @webhook_url, 'hub.verify' => 'async', 'hub.
|
54
|
+
response = http_client.post(hub_url, form: { 'hub.mode' => mode.to_s, 'hub.callback' => @webhook_url, 'hub.verify' => 'async', 'hub.lease_seconds' => '', 'hub.secret' => @secret, 'hub.topic' => @topic_url })
|
55
55
|
SubscriptionResponse.new(response.code, response.body.to_s)
|
56
56
|
end
|
57
57
|
|
data/lib/ostatus2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ostatus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
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-09-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|