shove 1.0.4 → 1.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/README.markdown +22 -0
- data/lib/shove/app.rb +7 -0
- data/lib/shove.rb +3 -8
- data/shove.gemspec +4 -1
- data/spec/shove_client_spec.rb +2 -2
- metadata +9 -9
data/README.markdown
CHANGED
@@ -58,6 +58,7 @@ end
|
|
58
58
|
Apps, channels, and clients can be controlled from the HTTP API
|
59
59
|
|
60
60
|
Grant a connection to dan@shove.io
|
61
|
+
|
61
62
|
```ruby
|
62
63
|
Shove.grant_connect("dan@shove.io") do |response|
|
63
64
|
# handle response
|
@@ -226,6 +227,27 @@ channel.publish("hi!")
|
|
226
227
|
channel.publish(obj.to_json)
|
227
228
|
```
|
228
229
|
|
230
|
+
Channel Keys
|
231
|
+
------------
|
232
|
+
You can generate channel keys which allow clients of
|
233
|
+
your shove network to publish and subscribe to specific
|
234
|
+
channels.
|
235
|
+
|
236
|
+
Example: Create a key for the channel groups:788
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
key = Shove.channel_key "group:788"
|
240
|
+
```
|
241
|
+
|
242
|
+
If it's for a particular App, use:
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
key = app.channel_key "group:788"
|
246
|
+
```
|
247
|
+
|
248
|
+
Note: if you don't have the app key speficied for the app, the
|
249
|
+
channel key generated will not be correct.
|
250
|
+
|
229
251
|
Using the Command Line
|
230
252
|
----------------------
|
231
253
|
|
data/lib/shove/app.rb
CHANGED
@@ -69,6 +69,13 @@ module Shove
|
|
69
69
|
Http::Request.new("#{url}/#{path}", @config)
|
70
70
|
end
|
71
71
|
|
72
|
+
# Generate a channel key for a client to self authorize
|
73
|
+
# publish and subscribe actions.
|
74
|
+
# +channel+ the name of the channel
|
75
|
+
def channel_key channel
|
76
|
+
Digest::SHA1.hexdigest "#{@config.app_key}-#{channel}"
|
77
|
+
end
|
78
|
+
|
72
79
|
####
|
73
80
|
|
74
81
|
# Connect to shove as a client in the current process
|
data/lib/shove.rb
CHANGED
@@ -18,7 +18,7 @@ require "digest/sha1"
|
|
18
18
|
# See https://github.com/shove/shove for client documentation
|
19
19
|
module Shove
|
20
20
|
|
21
|
-
Version = "1.0.
|
21
|
+
Version = "1.0.5"
|
22
22
|
|
23
23
|
class ShoveException < Exception; end
|
24
24
|
|
@@ -83,15 +83,10 @@ module Shove
|
|
83
83
|
|
84
84
|
# Create a channel key
|
85
85
|
# +channel+ the name of the channel
|
86
|
-
def channel_key channel
|
87
|
-
|
88
|
-
key = @config.app_key
|
89
|
-
end
|
90
|
-
digest = Digest::SHA1.hexdigest "#{key}-#{channel}"
|
86
|
+
def channel_key channel
|
87
|
+
@app.channel_key channel
|
91
88
|
end
|
92
89
|
|
93
|
-
|
94
|
-
|
95
90
|
end
|
96
91
|
end
|
97
92
|
|
data/shove.gemspec
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "shove"
|
3
|
+
|
1
4
|
spec = Gem::Specification.new do |s|
|
2
5
|
s.name = "shove"
|
3
|
-
s.version =
|
6
|
+
s.version = Shove::Version
|
4
7
|
s.date = "2012-02-08"
|
5
8
|
s.summary = "Ruby gem for leveraging shove.io, the web push platform"
|
6
9
|
s.email = "dan@shove.io"
|
data/spec/shove_client_spec.rb
CHANGED
@@ -192,8 +192,8 @@ describe Shove::Client do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should generate a channel key" do
|
195
|
-
key = Shove.channel_key "money"
|
196
|
-
key.should == "
|
195
|
+
key = Shove.channel_key "money"
|
196
|
+
key.should == "6f78f2ba414a482fc5c45eb080d8877ddf1fc6ba"
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should authorize on a channel" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: em-http-request
|
16
|
-
requirement: &
|
16
|
+
requirement: &70156622099200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70156622099200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: em-ws-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70156622110300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.1.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70156622110300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yajl-ruby
|
38
|
-
requirement: &
|
38
|
+
requirement: &70156622116560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70156622116560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: confstruct
|
49
|
-
requirement: &
|
49
|
+
requirement: &70156622111420 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 0.2.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70156622111420
|
58
58
|
description: Client side implementation for the shove.io API. See http://shove.io/documentation
|
59
59
|
email: dan@shove.io
|
60
60
|
executables:
|