mind_meld 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mind_meld +13 -3
- data/lib/mind_meld/device.rb +1 -2
- data/lib/mind_meld.rb +6 -4
- 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: a5e9cb6b0333f7744eae18b357aedc5a7f210639
|
4
|
+
data.tar.gz: 5a92afa0428c48cdc212600653e8d513bcc7368f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31caa2e9f52f55235867b1202d14be9c3cba76ff11f8637f985cc4930281e0885bcbc8a9f572b02c111544aba8228830aacad6f543d55ece8faf3f1942c2f01
|
7
|
+
data.tar.gz: 7f20393534f3521c56c08212844ca7e758b4aae522960eb7a49bdb1a4d4b23c159e6cfc5df9765b6e42fda87bf1b112dcb0fa99e3be1164c25c82afeb572c484
|
data/bin/mind_meld
CHANGED
@@ -55,9 +55,19 @@ when 'list'
|
|
55
55
|
)
|
56
56
|
|
57
57
|
devs = mm.devices
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
if devs.is_a? Hash
|
59
|
+
if devs['status'] == '500'
|
60
|
+
puts "Error: #{devs['error']}"
|
61
|
+
else
|
62
|
+
puts "Error: Cannot understand response"
|
63
|
+
puts devs
|
64
|
+
end
|
65
|
+
else
|
66
|
+
devs.each do |dev|
|
67
|
+
dev['plugin_type'] =~ /HiveMind(.*)::/
|
68
|
+
type = $1
|
69
|
+
puts "%10s : %4d : %s" % [ type, dev['id'], dev['name'] ]
|
70
|
+
end
|
61
71
|
end
|
62
72
|
when 'action'
|
63
73
|
opts = Parser.parse 'action', ARGV
|
data/lib/mind_meld/device.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'net/http'
|
3
|
-
require 'active_support/core_ext/object/to_query'
|
4
3
|
require 'mind_meld'
|
5
4
|
|
6
5
|
class MindMeld::Device < MindMeld
|
@@ -9,7 +8,7 @@ class MindMeld::Device < MindMeld
|
|
9
8
|
|
10
9
|
@device = options[:device]
|
11
10
|
# To trigger registration (is this needed?)
|
12
|
-
@device_details = {}
|
11
|
+
@device_details = {}.with_indifferent_access
|
13
12
|
device_details
|
14
13
|
end
|
15
14
|
|
data/lib/mind_meld.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'net/http'
|
3
3
|
require 'active_support/core_ext/object/to_query'
|
4
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
5
|
require 'openssl'
|
5
6
|
|
6
7
|
class MindMeld
|
@@ -27,16 +28,17 @@ class MindMeld
|
|
27
28
|
def request type, call, params = {}
|
28
29
|
if @http
|
29
30
|
begin
|
30
|
-
|
31
|
+
# Allow for 'array with indifferent access'
|
32
|
+
{ reply: JSON.parse(@http.send(
|
31
33
|
"request_#{type}",
|
32
34
|
"/api/#{call}.json",
|
33
35
|
type == :get ? params : params.to_query
|
34
|
-
).body)
|
36
|
+
).body) }.with_indifferent_access[:reply]
|
35
37
|
rescue => e
|
36
|
-
{ error: e.message }
|
38
|
+
{ error: e.message }.with_indifferent_access
|
37
39
|
end
|
38
40
|
else
|
39
|
-
{ error: 'Mind Meld not configured' }
|
41
|
+
{ error: 'Mind Meld not configured' }.with_indifferent_access
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mind_meld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Haig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|