osub 0.0.4 → 0.0.5
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.
- data/lib/osub/{subscription.rb → subscriber.rb} +31 -9
- data/lib/osub/version.rb +1 -1
- data/lib/osub.rb +2 -1
- metadata +48 -60
@@ -40,15 +40,37 @@ module OSub
|
|
40
40
|
change_subscription(:unsubscribe, hub_url, token)
|
41
41
|
end
|
42
42
|
|
43
|
-
def change_subscription(mode, hub_url, token)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
def change_subscription(mode, hub_url, token, redirect_limit = 10)
|
44
|
+
hub_uri = URI.parse(hub_url)
|
45
|
+
|
46
|
+
req = Net::HTTP::Post.new(hub_uri.request_uri)
|
47
|
+
req.set_form_data({
|
48
|
+
'hub.mode' => mode.to_s,
|
49
|
+
'hub.callback' => @callback_url,
|
50
|
+
'hub.verify' => async ? 'async' : 'sync',
|
51
|
+
'hub.verify_token' => token,
|
52
|
+
'hub.lease_seconds' => '',
|
53
|
+
'hub.secret' => @secret,
|
54
|
+
'hub.topic' => @topic_url
|
55
|
+
})
|
56
|
+
|
57
|
+
http = Net::HTTP.new(hub_uri.hostname, hub_uri.port)
|
58
|
+
if hub_uri.scheme == 'https'
|
59
|
+
http.use_ssl = true
|
60
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
61
|
+
end
|
62
|
+
|
63
|
+
response = http.request(req)
|
64
|
+
|
65
|
+
if response.is_a?(Net::HTTPRedirection) && redirect_limit > 0
|
66
|
+
location = response['location']
|
67
|
+
self.change_subscription(mode, hub_url, token, redirect_limit - 1)
|
68
|
+
else
|
69
|
+
response
|
70
|
+
end
|
71
|
+
|
72
|
+
rescue OpenSSL::SSL::SSLError
|
73
|
+
return nil
|
52
74
|
end
|
53
75
|
|
54
76
|
def verify_subscription(token)
|
data/lib/osub/version.rb
CHANGED
data/lib/osub.rb
CHANGED
metadata
CHANGED
@@ -1,98 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: osub
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Hackers of the Severed Hand
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: ruby-hmac
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: ostatus
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
25
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ostatus
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
44
38
|
type: :runtime
|
45
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
46
|
description: This is a simple implementation of a subscriber in the PubSubHubbub protocol.
|
47
|
-
email:
|
47
|
+
email:
|
48
48
|
- hotsh@xomb.org
|
49
49
|
executables: []
|
50
|
-
|
51
50
|
extensions: []
|
52
|
-
|
53
51
|
extra_rdoc_files: []
|
54
|
-
|
55
|
-
files:
|
52
|
+
files:
|
56
53
|
- .gitignore
|
57
54
|
- Gemfile
|
58
55
|
- LICENSE
|
59
56
|
- Rakefile
|
60
57
|
- lib/osub.rb
|
58
|
+
- lib/osub/subscriber.rb
|
61
59
|
- lib/osub/subscribers.rb
|
62
|
-
- lib/osub/subscription.rb
|
63
60
|
- lib/osub/version.rb
|
64
61
|
- osub.gemspec
|
65
|
-
has_rdoc: true
|
66
62
|
homepage: http://github.com/hotsh/osub
|
67
63
|
licenses: []
|
68
|
-
|
69
64
|
post_install_message:
|
70
65
|
rdoc_options: []
|
71
|
-
|
72
|
-
require_paths:
|
66
|
+
require_paths:
|
73
67
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
69
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
81
|
-
version: "0"
|
82
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
75
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
- 0
|
89
|
-
version: "0"
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
90
80
|
requirements: []
|
91
|
-
|
92
81
|
rubyforge_project: osub
|
93
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.8.24
|
94
83
|
signing_key:
|
95
84
|
specification_version: 3
|
96
85
|
summary: This is a simple implementation of a subscriber in the PubSubHubbub protocol.
|
97
86
|
test_files: []
|
98
|
-
|