ostatus2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +74 -0
  3. metadata +102 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73f059441105cb19ff006d6e1e73b3e4a6f1e480
4
+ data.tar.gz: 578ef3a4bedebe13ea5eb673082c24ff6ea1a8f0
5
+ SHA512:
6
+ metadata.gz: eb93203d24dab71975713420ed7fd17b5c03efa10aa296193800612c0f7d657d14df20bfac8d7e24c04ac5f98ceb0fc863f8058e1fbe3160e392df3693164212
7
+ data.tar.gz: 72c752cd43c93434b650b14f46148892d69e17c81fd247ca1bea6dca86e995154c26001aba025fe38bb65b4724eed6ec538ec000d26b18fa2d503cb23f6bf1c2
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ OStatus2
2
+ ========
3
+
4
+ [![Gem Version](http://img.shields.io/gem/v/ostatus2.svg)][gem]
5
+ [![Build Status](http://img.shields.io/travis/Gargron/ostatus2.svg)][travis]
6
+ [![Dependency Status](http://img.shields.io/gemnasium/Gargron/ostatus2.svg)][gemnasium]
7
+
8
+ [gem]: https://rubygems.org/gems/ostatus2
9
+ [travis]: https://travis-ci.org/Gargron/ostatus2
10
+ [gemnasium]: https://gemnasium.com/Gargron/ostatus2
11
+
12
+ A Ruby toolset for interacting with the OStatus suite of protocols:
13
+
14
+ * Subscribing to and publishing feeds via PubSubHubbub
15
+ * Interacting with feeds via Salmon
16
+
17
+ The 2 in the name is not a reference to any protocol version. There used to be a different Ruby gem called "ostatus" which this one seeks to replace.
18
+
19
+ ## Installation
20
+
21
+ gem install ostatus2
22
+
23
+ ## Usage
24
+
25
+ When your feed updates and you need to notify subscribers:
26
+
27
+ p = OStatus2::Publication.new('http://url.to/feed', ['http://some.hub'])
28
+ p.publish
29
+
30
+ When you want to subscribe to a feed:
31
+
32
+ token = 'abc123'
33
+ secret = 'def456'
34
+
35
+ s = OStatus2::Subscription.new('http://url.to/feed', token: token, secret: secret, webhook: 'http://url.to/webhook', hub: 'http://some.hub')
36
+ s.subscribe
37
+
38
+ Your webhook URL will receive a HTTP **GET** request that you will need to handle:
39
+
40
+ if s.valid?(params['hub.topic'], params['hub.verify_token'])
41
+ # echo back params['hub.challenge']
42
+ else
43
+ # return 404
44
+ end
45
+
46
+ Once the subscription is established, your webhook URL will be receiving HTTP **POST** requests. Among the headers of such a request will be the hub's signature on the content: `X-Hub-Signature`. You can verify the integrity of the request:
47
+
48
+ body = request.body.read
49
+ signature = request.env['HTTP_X_HUB_SIGNATURE']
50
+
51
+ if s.verify(body, signature)
52
+ # Do something with the data!
53
+ end
54
+
55
+ When you want to notify a remote resource about an interaction (like a comment):
56
+
57
+ your_rsa_keypair = OpenSSL::PKey::RSA.new 2048
58
+
59
+ salmon = OStatus2::Salmon.new
60
+ envelope = salmon.pack(comment, your_rsa_keypair)
61
+
62
+ salmon.post('http://remote.salmon/endpoint', envelope)
63
+
64
+ When you receive a Salmon notification about a remote interaction:
65
+
66
+ salmon = OStatus2::Salmon.new
67
+ comment = salmon.unpack(envelope)
68
+
69
+ # Parse comment and determine who the remote author is pretending to be,
70
+ # fetch their public key via Webfinger or something like that, and finally
71
+
72
+ if salmon.verify(envelope, remote_public_key)
73
+ # You can be sure the salmon is genuine
74
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ostatus2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eugen Rochko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: addressable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.8'
69
+ description: Toolset for interacting with the OStatus suite of protocols
70
+ email:
71
+ - eugen@zeonfederated.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - README.md
77
+ homepage: https://github.com/Gargron/ostatus2
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.6
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Toolset for interacting with the OStatus suite of protocols
101
+ test_files: []
102
+ has_rdoc: