hydna 0.1.8 → 0.1.9
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/README.md +2 -2
- data/lib/hydna.rb +5 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f0d90e7539d6af9d876a6d6c8852c4fa4a19a0
|
4
|
+
data.tar.gz: 57facea14364370b218d660d35501be2b5bb3d71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ce646ed53c462fb94b68c7936bc49cb8fc4b755a9752a58338812324cc640db66e5fe3ffe038fae4f562473b166141ae8ddc11a9de956a955217502100261c
|
7
|
+
data.tar.gz: 59ab7952d06fbd3c7510a535f755940b5bb47a13b1c7860eb45df4df44df72c42b16441fbfd53b5167e166ba031a76464288cbe1ace9eb6a9c325db1eb3aa34b
|
data/README.md
CHANGED
@@ -18,10 +18,10 @@ The `hydna`-module exposes two functions:
|
|
18
18
|
|
19
19
|
begin
|
20
20
|
# sending messages
|
21
|
-
Hydna.push("
|
21
|
+
Hydna.push("http://public.hydna.net/hello", "Hello World")
|
22
22
|
|
23
23
|
# sending signals
|
24
|
-
Hydna.emit("
|
24
|
+
Hydna.emit("http://public.hydna.net/hello", "Hello World")
|
25
25
|
|
26
26
|
rescue Exception => e
|
27
27
|
puts e.message
|
data/lib/hydna.rb
CHANGED
@@ -4,9 +4,8 @@ require 'net/https'
|
|
4
4
|
|
5
5
|
module Hydna
|
6
6
|
|
7
|
-
DEFAULT_CHANNEL =
|
7
|
+
DEFAULT_CHANNEL = "/"
|
8
8
|
MAX_PAYLOAD_SIZE = 0xFFF8
|
9
|
-
MAX_CHANNEL_VALUE = 0xFFFFFFFF
|
10
9
|
MAX_TOKEN_SIZE = 0xFFFF
|
11
10
|
|
12
11
|
def self.emit(domain, data, ctoken=nil, agent='hydna-ruby-push')
|
@@ -52,10 +51,10 @@ module Hydna
|
|
52
51
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
53
52
|
end
|
54
53
|
|
55
|
-
path =
|
54
|
+
path = uri['channel']
|
56
55
|
|
57
56
|
if uri['token'] != nil
|
58
|
-
path = "%s?%s" % [
|
57
|
+
path = "%s?%s" % [uri['channel'], uri['token']]
|
59
58
|
end
|
60
59
|
|
61
60
|
begin
|
@@ -116,29 +115,8 @@ module Hydna
|
|
116
115
|
if query.length < 2
|
117
116
|
return DEFAULT_CHANNEL
|
118
117
|
end
|
119
|
-
|
120
|
-
parts = query.split("/")
|
121
|
-
|
122
|
-
if parts.length > 3
|
123
|
-
raise "Unable to parse channel"
|
124
|
-
end
|
125
118
|
|
126
|
-
|
127
|
-
|
128
|
-
if pos != nil
|
129
|
-
channel = parts[1].slice(pos+1, parts[1].length).hex
|
130
|
-
return channel
|
131
|
-
end
|
132
|
-
|
133
|
-
if !is_numeric(parts[1])
|
134
|
-
raise "Invalid channel"
|
135
|
-
end
|
136
|
-
|
137
|
-
channel = Integer(parts[1])
|
138
|
-
|
139
|
-
if channel > MAX_CHANNEL_VALUE or channel <= 0
|
140
|
-
raise "Invalid channel"
|
141
|
-
end
|
119
|
+
channel = query
|
142
120
|
|
143
121
|
return channel;
|
144
122
|
end
|
@@ -152,6 +130,7 @@ module Hydna
|
|
152
130
|
uri = URI.parse(domain)
|
153
131
|
|
154
132
|
channel = path_to_channel(uri.path)
|
133
|
+
|
155
134
|
token = clean_token(uri.query)
|
156
135
|
|
157
136
|
return {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isak Wiström
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Hydna exposes a straightforward API over HTTP. It uses a single resource;
|
14
14
|
sending messages is done by making POST requests to the same URI you'd use to connect
|