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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 713a7f513d5197cb40f7f59e40af9e0b71aa43ea
4
- data.tar.gz: 277f7a6f8d07f5d9706e6d7216e3a48c7f8f0973
3
+ metadata.gz: 82834f96da926c89edc1118bdd8c27a8e9d06668
4
+ data.tar.gz: eb6edd40cd3d229d80d0cf56ccba8d0df64a48c0
5
5
  SHA512:
6
- metadata.gz: 1ad3a7fc6c32e9d2b66e8a24813f58cbae795e4b9651736c7eaacacce43e5cfb1d47069ac82a6624cfee825b35d2a5c7edd4f5689165f76bfddd9328c25e3a64
7
- data.tar.gz: 8f367c64f166fd53a5632bcfdb17e90bbd0fed1e0aaff6044e4bb34f297da139ce22b10c0e99905b80a4e22e9dad776183c026cbf6fdb19b47f5dcf4a53b425d
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 = topic_url
11
- @webhook_url = options[:webhook] || ''
12
- @secret = options[:secret] || ''
13
- @token = options[:token] || ''
14
- @hub = options[: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, token)
38
- @topic_url == topic_url && @token == token
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.verify_token' => @token, 'hub.secret' => @secret, 'hub.topic' => @topic_url })
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
 
@@ -1,3 +1,3 @@
1
1
  module OStatus2
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3"
3
3
  end
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.2.1
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-19 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http