hue_bridge 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e13d26deb5013836e8da097b9464477b8b87c79c
4
- data.tar.gz: 85f90026f3b33b603fb82f13f5f3e9f9c670c227
3
+ metadata.gz: 11373903b6f45366294584a698152666145419f8
4
+ data.tar.gz: 420e900fcbb39e6539f13e98a957fa966225885b
5
5
  SHA512:
6
- metadata.gz: dd8ba35b06d757fe1cf517f407cd8382d6e083fa2bd904aa5c05211ec05c861230bb385a1b0aa82b6e40754d8ed2645e1c895c0685a1bf027a980cd065f23154
7
- data.tar.gz: 7546f8ce08b678ff8ddb09ca7653efe2e11f99df47356a34a85e905b2e246121f709fa946cf36b6df9ea95626b4a6ad31c838c8320ed51d5f84c519106a279d9
6
+ metadata.gz: 1dd456ca637265767e185799aad3dda2ae18a049e60018df9703ed568154966e0b2dc49d3d0d841113b4f3ef0b0a011471b12d569ec06bb874378fc75423e5b9
7
+ data.tar.gz: 66080c48bc755fc95551a63bbb0ce693bd2824a10ddb203e0708d605975a04ce947b4f14bd78f91e32198ee9e607e69e7746b84b93e8ba629f6aa3d5e6777b89
data/hue_bridge.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "hue_bridge"
8
8
  spec.version = HueBridge::VERSION
9
9
  spec.authors = ["Kristopher Bredemeier"]
10
- spec.email = ["kb@i22.de"]
10
+ spec.email = ["k.bredemeier@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Gem to controll Philips hue lights with ruby}
13
13
  spec.description = %q{Gem to controll Philips hue lights with ruby}
@@ -19,9 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "rest-client", "~> 2.0"
23
- spec.add_runtime_dependency "capistrano", ">= 3.0.0"
24
-
25
22
  spec.add_development_dependency "bundler", "~> 1.12"
26
23
  spec.add_development_dependency "rake", "~> 10.0"
27
24
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -1,4 +1,4 @@
1
- require 'rest-client'
1
+ require 'net/http'
2
2
  require 'json'
3
3
 
4
4
  module HueBridge
@@ -6,14 +6,15 @@ module HueBridge
6
6
  # light on, off and to toggle it.
7
7
  #
8
8
  class LightBulp
9
- # @param [String] ip The Hue Bridge's IP
10
- # @param [String] user_id The user id to access the api
11
- # @param [Integer] light_bulp_id The id of the light bulp
9
+ # @param [Hash] options LightBulp options
10
+ # @option options [String] :hue_bridge_ip The Hue Bridge's IP
11
+ # @option options [String] :user_id The user id to access the api
12
+ # @option options [Integer] :light_bulp_id The id of the light bulp
12
13
  #
13
- def initialize(ip, user_id, light_bulp_id)
14
- @light_bulp_id = light_bulp_id
15
- @user_id = user_id
16
- @ip = ip
14
+ def initialize(options = {})
15
+ @light_bulp_id = options.fetch(:light_bulp_id)
16
+ @user_id = options.fetch(:user_id)
17
+ @ip = options.fetch(:hue_bridge_ip)
17
18
  end
18
19
 
19
20
  # Toggles the light bulp and returns it's state.
@@ -63,12 +64,12 @@ module HueBridge
63
64
  end
64
65
 
65
66
  def put(resource, params)
66
- RestClient.put(url(resource), JSON.generate(params))
67
+ http = Net::HTTP.new(@ip)
68
+ http.request_put("/#{path}/#{resource}", JSON.generate(params))
67
69
  end
68
70
 
69
- def url(resource = nil)
70
- File.join @ip, 'api', @user_id,
71
- 'lights', @light_bulp_id.to_s, resource.to_s
71
+ def path
72
+ File.join 'api', @user_id, 'lights', @light_bulp_id.to_s
72
73
  end
73
74
  end
74
75
  end
@@ -1,3 +1,3 @@
1
1
  module HueBridge
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hue_bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristopher Bredemeier
@@ -10,34 +10,6 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rest-client
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: capistrano
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 3.0.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 3.0.0
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: bundler
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +96,7 @@ dependencies:
124
96
  version: 3.0.0
125
97
  description: Gem to controll Philips hue lights with ruby
126
98
  email:
127
- - kb@i22.de
99
+ - k.bredemeier@gmail.com
128
100
  executables: []
129
101
  extensions: []
130
102
  extra_rdoc_files: []
@@ -164,8 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
136
  version: '0'
165
137
  requirements: []
166
138
  rubyforge_project:
167
- rubygems_version: 2.5.1
139
+ rubygems_version: 2.4.8
168
140
  signing_key:
169
141
  specification_version: 4
170
142
  summary: Gem to controll Philips hue lights with ruby
171
143
  test_files: []
144
+ has_rdoc: