ostatus2 0.1.1 → 0.2
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.
- checksums.yaml +4 -4
- data/lib/ostatus2/subscription.rb +2 -2
- data/lib/ostatus2/subscription_response.rb +28 -0
- data/lib/ostatus2/version.rb +1 -1
- data/lib/ostatus2.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f2bf068c141d0b56b19918f2e63c7cdb09d1f7
|
4
|
+
data.tar.gz: 1dac4281a76c4271da2f983d2fc681d3aef40fbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bdf235fd69bf66163458baf423e362627a9e20f08cf971756b03f8e38037b22b3c98d826b6b23a106b6fbc09a9ae35faf5075e0ab2d6f80390501a7f284101a
|
7
|
+
data.tar.gz: 522c7df5fd213a553e911fedb6266fe3e21807ee108c34b2a3591dfb83806801077e04dec039c856319def7fcb3f4566bdcd31f6c919b09e52c3dae6f3eb3c7e
|
@@ -51,8 +51,8 @@ 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.
|
55
|
-
response.code
|
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 })
|
55
|
+
SubscriptionResponse.new(response.code, response.body.to_s)
|
56
56
|
end
|
57
57
|
|
58
58
|
def http_client
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module OStatus2
|
2
|
+
class SubscriptionResponse
|
3
|
+
# @param [Integer] code HTTP status code
|
4
|
+
# @param [String] body HTTP response body
|
5
|
+
def initialize(code, body)
|
6
|
+
@code = code
|
7
|
+
@body = body
|
8
|
+
end
|
9
|
+
|
10
|
+
# Was the hub operation successful?
|
11
|
+
# @return [Boolean]
|
12
|
+
def successful?
|
13
|
+
@code == 202
|
14
|
+
end
|
15
|
+
|
16
|
+
# Was the hub operation not successful?
|
17
|
+
# @return [Boolean]
|
18
|
+
def failed?
|
19
|
+
!success?
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns error message if the operation was not successful
|
23
|
+
# @return [String]
|
24
|
+
def message
|
25
|
+
@body
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/ostatus2/version.rb
CHANGED
data/lib/ostatus2.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.2'
|
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-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/ostatus2/publication.rb
|
79
79
|
- lib/ostatus2/salmon.rb
|
80
80
|
- lib/ostatus2/subscription.rb
|
81
|
+
- lib/ostatus2/subscription_response.rb
|
81
82
|
- lib/ostatus2/version.rb
|
82
83
|
homepage: https://github.com/Gargron/ostatus2
|
83
84
|
licenses:
|
@@ -99,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
102
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.4.
|
103
|
+
rubygems_version: 2.4.5.1
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Toolset for interacting with the OStatus2 suite of protocols
|
106
107
|
test_files: []
|
107
|
-
has_rdoc:
|