hue 0.1.4 → 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/hue.gemspec +0 -1
- data/lib/hue/client.rb +9 -28
- data/lib/hue/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 392c6116951d5bc531a34f0ef2c52d5fb5f82ad8
|
4
|
+
data.tar.gz: 3a5e4de39857bd328c5e69deb2866266d709fcc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e21f6cc541aa058b4a5502f7699f0bb67c46ecf63d07c45c4ea036b037a20ced5372db75cb6d2b9d06fa3796badab290eb2639d3d2084487f9038c09e98899e4
|
7
|
+
data.tar.gz: 2d95c4b7a772fbbb966f368f0967ea1d20a9c36b6ee677927a6644548ffde7d93cff812cea376b691f11d72c1180972e31d63bd71e07b0373b1bdb2c0ec5a1f7
|
data/hue.gemspec
CHANGED
data/lib/hue/client.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'json'
|
3
|
-
require 'playful/ssdp'
|
4
3
|
require 'curb'
|
5
4
|
|
6
|
-
# Playful is super verbose
|
7
|
-
Playful.log = false
|
8
|
-
|
9
5
|
module Hue
|
10
6
|
class Client
|
11
7
|
attr_reader :username
|
@@ -33,31 +29,16 @@ module Hue
|
|
33
29
|
|
34
30
|
def bridges
|
35
31
|
@bridges ||= begin
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
easy.url = 'https://www.meethue.com/api/nupnp'
|
45
|
-
easy.perform
|
46
|
-
JSON(easy.body).each do |hash|
|
47
|
-
bs << Bridge.new(self, hash)
|
48
|
-
end
|
49
|
-
bs
|
50
|
-
else
|
51
|
-
devices
|
52
|
-
.uniq { |d| d[:location] }
|
53
|
-
.map do |bridge|
|
54
|
-
Bridge.new(self, {
|
55
|
-
'id' => bridge[:usn],
|
56
|
-
'name' => bridge[:st],
|
57
|
-
'internalipaddress' => URI.parse(bridge[:location]).host
|
58
|
-
})
|
59
|
-
end
|
32
|
+
bs = []
|
33
|
+
easy = Curl::Easy.new
|
34
|
+
easy.follow_location = true
|
35
|
+
easy.max_redirects = 10
|
36
|
+
easy.url = 'https://www.meethue.com/api/nupnp'
|
37
|
+
easy.perform
|
38
|
+
JSON(easy.body).each do |hash|
|
39
|
+
bs << Bridge.new(self, hash)
|
60
40
|
end
|
41
|
+
bs
|
61
42
|
end
|
62
43
|
end
|
63
44
|
|
data/lib/hue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hue
|
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
|
- Sam Soffes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.4.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: playful
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: curb
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|