huey 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8f4c3837f65eb7ca77400cab890aa464ffa469ca
4
+ data.tar.gz: e0759a7ecb3d0d038f9972cd94b67561d27640f9
5
+ SHA512:
6
+ metadata.gz: 0d5803ff4f5cc2471da1087578717fe400f8f8c32e972c5d3d1f9b9992a254094a39c78b8c0613ee28eb489bd9e18f3266f1adf6e0876453eb5adbf4a9cf9851
7
+ data.tar.gz: f718ff168af4ca6130dfe5b7ebba7013258b82950d91cadda06d0b68ac4ec5a1a8b92ec713410bcb66622b880e9866700baa1a3ea7b023b0d1f092df1f3653fb
data/.gitignore CHANGED
@@ -14,4 +14,7 @@ doc/
14
14
  pkg/
15
15
  tmp/
16
16
 
17
- */.DS_Store
17
+ */.DS_Store
18
+
19
+ .ruby-version
20
+ .ruby-gemset
data/Gemfile.lock CHANGED
@@ -1,29 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- huey (1.2.0)
4
+ huey (2.0.0)
5
5
  chronic (>= 0.9.0)
6
6
  color (>= 1.4.1)
7
7
  eventmachine (>= 1.0.0)
8
8
  httparty (>= 0.9.0)
9
+ multi_json (~> 1.8)
9
10
 
10
11
  GEM
11
12
  remote: http://rubygems.org/
12
13
  specs:
13
14
  addressable (2.3.2)
14
15
  chronic (0.9.1)
15
- color (1.4.1)
16
+ color (1.4.2)
16
17
  color-tools (1.3.0)
17
18
  crack (0.3.1)
18
19
  eventmachine (1.0.3)
19
- httparty (0.10.2)
20
- multi_json (~> 1.0)
20
+ httparty (0.12.0)
21
+ json (~> 1.8)
21
22
  multi_xml (>= 0.5.2)
23
+ json (1.8.1)
22
24
  metaclass (0.0.1)
23
25
  mocha (0.13.1)
24
26
  metaclass (~> 0.0.1)
25
- multi_json (1.7.2)
26
- multi_xml (0.5.3)
27
+ multi_json (1.8.2)
28
+ multi_xml (0.5.5)
27
29
  rake (0.9.5)
28
30
  timecop (0.5.9.2)
29
31
  webmock (1.9.0)
data/README.markdown CHANGED
@@ -14,23 +14,24 @@ You shouldn't need to initialize anything to make Huey work correctly, but if yo
14
14
 
15
15
  ```ruby
16
16
  Huey.configure do |config|
17
- # Huey now uses the Phillips Hue API to discover local bridges, but you can specify the Hue IP manually if your
18
- # Huey server is not on your local network.
19
- config.hue_ip = 123.456.789.012
17
+ # Huey now uses the Phillips Hue API to discover local bridges, but you can specify the Hue IP
18
+ # manually if your Huey server is not on your local network.
19
+ config.hue_ip = '123.456.789.012'
20
20
 
21
21
  # SSDP is disabled by default.
22
22
  config.ssdp = true
23
23
 
24
- # For discovering the Hue hub, usually you won't have to change this
24
+ # For discovering the Hue hub, usually you won't have to change this.
25
25
  config.ssdp_ip = '239.255.255.250'
26
26
 
27
- # Also for discovering the Hue hub
27
+ # Also for discovering the Hue hub.
28
28
  config.ssdp_port = 1900
29
29
 
30
- # If you get constant errors about not being able to find the Hue hub and you're sure it's connected, increase this
30
+ # If you get constant errors about not being able to find the Hue hub and you're sure
31
+ # it's connected, increase this.
31
32
  config.ssdp_ttl = 1
32
33
 
33
- # Change this if you don't like the included uuid
34
+ # Change this if you don't like the included uuid.
34
35
  config.uuid = '0123456789abdcef0123456789abcdef'
35
36
  end
36
37
  ```
data/huey.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency('httparty', '>=0.9.0')
23
23
  s.add_dependency('chronic', '>=0.9.0')
24
24
  s.add_dependency('color', '>= 1.4.1')
25
+ s.add_dependency('multi_json', '~> 1.8')
25
26
 
26
27
  s.add_development_dependency('bundler', '>=0')
27
28
  s.add_development_dependency('yard', '>=0.8.3')
data/lib/huey.rb CHANGED
@@ -6,6 +6,7 @@ require 'httparty'
6
6
  require 'color'
7
7
  require 'yaml'
8
8
  require 'chronic'
9
+ require 'multi_json'
9
10
 
10
11
  require 'huey/version'
11
12
 
data/lib/huey/config.rb CHANGED
@@ -14,6 +14,7 @@ module Huey #:nodoc
14
14
  option :ssdp_port, default: 1900
15
15
  option :ssdp_ttl, default: 1
16
16
  option :hue_ip, default: nil
17
+ option :hue_port, default: 80
17
18
  option :uuid, default: '0123456789abdcef0123456789abcdef'
18
19
 
19
20
  # The default logger for Huey: either the Rails logger or just stdout.
data/lib/huey/request.rb CHANGED
@@ -7,7 +7,7 @@ module Huey
7
7
  [:get, :post, :put, :delete].each do |method|
8
8
  define_method(method) do |url = '', options = {}|
9
9
  response = HTTParty.send(method,
10
- "http://#{self.hue_ip}/api/#{Huey::Config.uuid}/#{url}",
10
+ "http://#{self.hue_ip}:#{Huey::Config.hue_port}/api/#{Huey::Config.uuid}/#{url}",
11
11
  options).parsed_response
12
12
 
13
13
  if self.error?(response, 1)
@@ -20,7 +20,7 @@ module Huey
20
20
  end
21
21
 
22
22
  def register
23
- response = HTTParty.post("http://#{self.hue_ip}/api",
23
+ response = HTTParty.post("http://#{self.hue_ip}:#{Huey::Config.hue_port}/api",
24
24
  body: MultiJson.dump({username: Huey::Config.uuid,
25
25
  devicetype: 'Huey'})).parsed_response
26
26
 
@@ -63,4 +63,4 @@ module Huey
63
63
  end
64
64
 
65
65
  end
66
- end
66
+ end
data/lib/huey/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Huey
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -47,4 +47,14 @@ class RequestTest < Test::Unit::TestCase
47
47
 
48
48
  Huey::Config.hue_ip = nil
49
49
  end
50
+
51
+ def test_uses_configured_ip_
52
+ Huey::Config.hue_port = 12345
53
+
54
+ stub_request(:any, "http://0.0.0.0:12345/api/0123456789abdcef0123456789abcdef/")
55
+ Huey::Request.get
56
+
57
+ assert_requested :get, "http://0.0.0.0:12345/api/0123456789abdcef0123456789abcdef/"
58
+ end
59
+
50
60
  end
metadata CHANGED
@@ -1,142 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huey
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
5
- prerelease:
4
+ version: 2.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Veraticus
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-09 00:00:00.000000000 Z
11
+ date: 2013-11-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: eventmachine
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: httparty
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.9.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.9.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: chronic
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.9.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.9.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: color
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 1.4.1
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.4.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: multi_json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.8'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.8'
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: bundler
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
- - - ! '>='
87
+ - - '>='
84
88
  - !ruby/object:Gem::Version
85
89
  version: '0'
86
90
  type: :development
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
- - - ! '>='
94
+ - - '>='
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: yard
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
- - - ! '>='
101
+ - - '>='
100
102
  - !ruby/object:Gem::Version
101
103
  version: 0.8.3
102
104
  type: :development
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
- - - ! '>='
108
+ - - '>='
108
109
  - !ruby/object:Gem::Version
109
110
  version: 0.8.3
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: mocha
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.13.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
- - - ! '>='
122
+ - - '>='
124
123
  - !ruby/object:Gem::Version
125
124
  version: 0.13.1
126
125
  - !ruby/object:Gem::Dependency
127
126
  name: webmock
128
127
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
128
  requirements:
131
- - - ! '>='
129
+ - - '>='
132
130
  - !ruby/object:Gem::Version
133
131
  version: 1.9.0
134
132
  type: :development
135
133
  prerelease: false
136
134
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
135
  requirements:
139
- - - ! '>='
136
+ - - '>='
140
137
  - !ruby/object:Gem::Version
141
138
  version: 1.9.0
142
139
  description: Everything you could want for making Phillips Hue lightbulbs obey your
@@ -178,27 +175,26 @@ files:
178
175
  - test/unit/ssdp_test.rb
179
176
  homepage: https://github.com/Veraticus/huey
180
177
  licenses: []
178
+ metadata: {}
181
179
  post_install_message:
182
180
  rdoc_options: []
183
181
  require_paths:
184
182
  - lib
185
183
  required_ruby_version: !ruby/object:Gem::Requirement
186
- none: false
187
184
  requirements:
188
- - - ! '>='
185
+ - - '>='
189
186
  - !ruby/object:Gem::Version
190
187
  version: 1.9.1
191
188
  required_rubygems_version: !ruby/object:Gem::Requirement
192
- none: false
193
189
  requirements:
194
- - - ! '>='
190
+ - - '>='
195
191
  - !ruby/object:Gem::Version
196
192
  version: '0'
197
193
  requirements: []
198
194
  rubyforge_project:
199
- rubygems_version: 1.8.23
195
+ rubygems_version: 2.1.0
200
196
  signing_key:
201
- specification_version: 3
197
+ specification_version: 4
202
198
  summary: Quick and simple discovery and control of Phillips Hue lightbulbs
203
199
  test_files: []
204
200
  has_rdoc: