eshq 0.0.2 → 0.0.3
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.md +19 -0
- data/lib/eshq/client.rb +5 -1
- data/lib/eshq/version.rb +1 -1
- metadata +4 -3
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
The EventSource HQ Gem
|
2
|
+
======================
|
3
|
+
|
4
|
+
Make sure you have an EventSource HQ account.
|
5
|
+
|
6
|
+
The eshq gem will use the following environment variables:
|
7
|
+
|
8
|
+
ESHQ_URL
|
9
|
+
ESHQ_KEY
|
10
|
+
ESHQ_SECRET
|
11
|
+
|
12
|
+
To create a new socket that the client-side javascript library can use
|
13
|
+
to connect with:
|
14
|
+
|
15
|
+
ESHQ.open(:channel => "your-channel")
|
16
|
+
|
17
|
+
To send a message to a channel:
|
18
|
+
|
19
|
+
ESHQ.send(:channel => "your-channel", :data => "raw message data")
|
data/lib/eshq/client.rb
CHANGED
@@ -15,7 +15,11 @@ module ESHQ
|
|
15
15
|
|
16
16
|
def post(path, params)
|
17
17
|
response = Net::HTTP.post_form(url_for(path), params.merge(credentials))
|
18
|
-
|
18
|
+
if response.code == "200"
|
19
|
+
response.content_type == "application/json" ? JSON.parse(response.body) : true
|
20
|
+
else
|
21
|
+
raise "Error #{response.body}"
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def credentials
|
data/lib/eshq/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mathias Biilmann Christensen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-09-
|
17
|
+
date: 2011-09-27 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -68,6 +68,7 @@ extra_rdoc_files: []
|
|
68
68
|
files:
|
69
69
|
- .gitignore
|
70
70
|
- Gemfile
|
71
|
+
- README.md
|
71
72
|
- Rakefile
|
72
73
|
- eshq.gemspec
|
73
74
|
- lib/eshq.rb
|