nlhue 0.1.1 → 0.1.2
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/lib/nlhue/bridge.rb +12 -5
- data/lib/nlhue/disco.rb +2 -2
- data/lib/nlhue/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: 316e835681bc596533571a1d66f4bba4d8a1820c
|
|
4
|
+
data.tar.gz: 47dda76305bca4cac07bde9a99f50c8a8f6661f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bc6d3ac8bfe570d6b8ff1bf7507906ca0b24a13d8dcd1f6e4964bab208e860fb75a28b660565ab6aba902493117c69acfa3d8d0a76a9d1780cdb0007497bab9
|
|
7
|
+
data.tar.gz: ca1c3325ba192fa629b9a861fb94439666c9c1aef07f022ee5b2c35ab8197869f66c61d917341ef54eace36ded679a667098d1149e09026e4f350f8dd5b8fb52
|
data/lib/nlhue/bridge.rb
CHANGED
|
@@ -268,7 +268,7 @@ module NLHue
|
|
|
268
268
|
# with true and whether the lights/groups were changed, false
|
|
269
269
|
# and an exception on error.
|
|
270
270
|
def update &block
|
|
271
|
-
@request_queue.get "/api/#{
|
|
271
|
+
@request_queue.get "/api/#{api_key}", :info do |response|
|
|
272
272
|
status, result = check_json response
|
|
273
273
|
|
|
274
274
|
changed = false
|
|
@@ -717,25 +717,25 @@ module NLHue
|
|
|
717
717
|
# Makes a GET request under the API using this Bridge's stored
|
|
718
718
|
# username.
|
|
719
719
|
def get_api subpath, category=nil, &block
|
|
720
|
-
@request_queue.get "/api/#{
|
|
720
|
+
@request_queue.get "/api/#{api_key}#{subpath}", &block
|
|
721
721
|
end
|
|
722
722
|
|
|
723
723
|
# Makes a POST request under the API using this Bridge's stored
|
|
724
724
|
# username.
|
|
725
725
|
def post_api subpath, data, category=nil, content_type=nil, &block
|
|
726
|
-
@request_queue.post "/api/#{
|
|
726
|
+
@request_queue.post "/api/#{api_key}#{subpath}", data, category, content_type, &block
|
|
727
727
|
end
|
|
728
728
|
|
|
729
729
|
# Makes a PUT request under the API using this Bridge's stored
|
|
730
730
|
# username.
|
|
731
731
|
def put_api subpath, data, category=nil, content_type=nil, &block
|
|
732
|
-
@request_queue.put "/api/#{
|
|
732
|
+
@request_queue.put "/api/#{api_key}#{subpath}", data, category, content_type, &block
|
|
733
733
|
end
|
|
734
734
|
|
|
735
735
|
# Makes a DELETE request under the API using this Bridge's
|
|
736
736
|
# stored username.
|
|
737
737
|
def delete_api subpath, category=nil, &block
|
|
738
|
-
@request_queue.delete "/api/#{
|
|
738
|
+
@request_queue.delete "/api/#{api_key}#{subpath}", category, &block
|
|
739
739
|
end
|
|
740
740
|
|
|
741
741
|
# Schedules a Light, Scene, or Group to have its deferred values
|
|
@@ -771,6 +771,13 @@ module NLHue
|
|
|
771
771
|
end
|
|
772
772
|
|
|
773
773
|
private
|
|
774
|
+
# Returns the string to use in API URLs as the API key (the
|
|
775
|
+
# bridge username if registered, or an obviously invalid string
|
|
776
|
+
# otherwise).
|
|
777
|
+
def api_key
|
|
778
|
+
@username || 'unknown'
|
|
779
|
+
end
|
|
780
|
+
|
|
774
781
|
# Sets this bridge's name (call after getting UPnP XML or
|
|
775
782
|
# bridge config JSON), removing the IP address if present.
|
|
776
783
|
def set_name name
|
data/lib/nlhue/disco.rb
CHANGED
|
@@ -23,7 +23,7 @@ module NLHue
|
|
|
23
23
|
MAX_SUBSCRIBED_AGE = 150000
|
|
24
24
|
|
|
25
25
|
# Number of times a bridge can fail to update
|
|
26
|
-
MAX_BRIDGE_ERR =
|
|
26
|
+
MAX_BRIDGE_ERR = 4
|
|
27
27
|
|
|
28
28
|
# Bridges discovered on the network
|
|
29
29
|
# [serial] => {
|
|
@@ -280,7 +280,7 @@ module NLHue
|
|
|
280
280
|
info = @@bridges[br.serial]
|
|
281
281
|
@@bridges.delete br.serial
|
|
282
282
|
br.remove_update_callback info[:cb]
|
|
283
|
-
notify_bridge_removed br,
|
|
283
|
+
notify_bridge_removed br, "Error updating bridge: #{result}"
|
|
284
284
|
EM.next_tick do
|
|
285
285
|
br.clean # next tick to ensure after notify*removed
|
|
286
286
|
do_disco
|
data/lib/nlhue/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nlhue
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Bourgeous
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-11-
|
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|