crossbar-http 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/README.md +9 -6
- data/lib/crossbar-http/client.rb +4 -4
- data/lib/crossbar-http/version.rb +1 -1
- 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: 19a2298c3a79adeae874b6b4dcff452bbdf536a0
|
4
|
+
data.tar.gz: 2dc0cf90b84e592ae2b570665c17e6dcfa96c8ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba1b8ddb833e5cf23c4f5dba920848d5795a54d6568d8ca92747339369f62ac146870dc9e5a2418a652f07b5febb65e06f51326c32e39c2ba71769a706fbc389
|
7
|
+
data.tar.gz: 8a0a5e9d2bae3b7958c8479600a2a12d91eb797b88eeed8acdc9788a7614fd9f505af947c33bbd2b0315735f564d9e4bece81ccd75cc46c04a9a18d43254b3a0
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,11 @@ Module that provides methods for accessing Crossbar.io HTTP Bridge Services
|
|
6
6
|
|
7
7
|
## Revision History
|
8
8
|
|
9
|
-
- v0.1:
|
9
|
+
- v0.1.0:
|
10
10
|
- Initial version
|
11
|
+
- v0.1.1:
|
12
|
+
- Fixed typos in README
|
13
|
+
- Added support for https (I didn't know the library I was using didn't)
|
11
14
|
|
12
15
|
## Installation
|
13
16
|
|
@@ -21,8 +24,8 @@ gem 'crossbar-http'
|
|
21
24
|
To call a Crossbar HTTP bridge, do the following
|
22
25
|
|
23
26
|
``` ruby
|
24
|
-
client = Crossbar::HTTP::Client("http://127.0.0.1/call")
|
25
|
-
result = client.call("com.example.add", 2, 3, offset
|
27
|
+
client = Crossbar::HTTP::Client.new("http://127.0.0.1/call")
|
28
|
+
result = client.call("com.example.add", 2, 3, offset: 10)
|
26
29
|
```
|
27
30
|
|
28
31
|
This will call the following method
|
@@ -41,8 +44,8 @@ def onJoin(self, details):
|
|
41
44
|
To publish to a Crossbar HTTP bridge, do the following
|
42
45
|
|
43
46
|
``` ruby
|
44
|
-
client = Crossbar::HTTP::Client("http://127.0.0.1/publish")
|
45
|
-
result = client.publish("com.example.event", event
|
47
|
+
client = Crossbar::HTTP::Client.new("http://127.0.0.1/publish")
|
48
|
+
result = client.publish("com.example.event", event: "new event")
|
46
49
|
```
|
47
50
|
|
48
51
|
The receiving subscription would look like
|
@@ -61,7 +64,7 @@ For bridge services that have a key and secret defined, simply include the key a
|
|
61
64
|
client.
|
62
65
|
|
63
66
|
``` ruby
|
64
|
-
client = Crossbar::HTTP::Client("http://127.0.0.1/publish", key: "key", secret: "secret")
|
67
|
+
client = Crossbar::HTTP::Client.new("http://127.0.0.1/publish", key: "key", secret: "secret")
|
65
68
|
```
|
66
69
|
|
67
70
|
## Contributing
|
data/lib/crossbar-http/client.rb
CHANGED
@@ -133,11 +133,11 @@ module Crossbar
|
|
133
133
|
self.sequence += 1
|
134
134
|
|
135
135
|
# Create the request
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
137
|
+
req = Net::HTTP::Post.new(uri)
|
138
|
+
req['Content-Type'] = 'application/json'
|
139
|
+
req.body = encoded_params
|
139
140
|
|
140
|
-
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
141
141
|
http.request(req)
|
142
142
|
end
|
143
143
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crossbar-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Chapman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|