omniauth-lifx 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daa0b72504e3b844446f115fd851c7e071579521
4
- data.tar.gz: 0bd80e2547fb5f17e5afd5152c9ba4c5b93c7cf0
3
+ metadata.gz: af33f74fb72c9c4f16cc27507a260e728bfdac8a
4
+ data.tar.gz: b2a8d6500b1c9eb4c0ed70a42b6b8ea9d6103b27
5
5
  SHA512:
6
- metadata.gz: cd6d52a521f4d14831579acf70644b6793e19c876fd3d1dcd001d788f66d5e9aeb8f45c3ab326d83a2da1d9a5ce27c810b435025284d3f2c62ec60dbde788198
7
- data.tar.gz: 0a16422eae93b8f113d7518f2b1d95fff771d8706366a612fd993592b35f04a9481756115fdfebd9f9440f69d98e6dc8a1557dbd764aba221c0f5f04ce2551e8
6
+ metadata.gz: edb8317b109538e83310384bf1bdee678bf21110d1189e868f21e5d0a6c350c52c540f0447e0729097f02703076ab217f78961571551ea0f95872cb6be0bf1aa
7
+ data.tar.gz: 71ebe90ce136fb9596fceb154a568d8e2fbde25346517da1acffdb9ceb0c57da3876471b4c438662678e346c84b0e26c1463d909b3c61a95c47393a0bd2aba38
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [1.1.0] - 2016-01-18
6
+
7
+ Set omniauth uid using the Lifx-Account-Uuid header.
8
+
5
9
  ## [1.0.0] - 2016-01-17
6
10
 
7
11
  First version. Hopefully this works.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-lifx (1.0.0)
4
+ omniauth-lifx (1.1.0)
5
5
  omniauth (~> 1.0)
6
6
  omniauth-oauth2 (~> 1.1)
7
7
 
@@ -21,9 +21,9 @@ GEM
21
21
  multi_json (~> 1.3)
22
22
  multi_xml (~> 0.5)
23
23
  rack (~> 1.2)
24
- omniauth (1.2.2)
24
+ omniauth (1.3.1)
25
25
  hashie (>= 1.2, < 4)
26
- rack (~> 1.0)
26
+ rack (>= 1.0, < 3)
27
27
  omniauth-oauth2 (1.3.1)
28
28
  oauth2 (~> 1.0)
29
29
  omniauth (~> 1.2)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Lifx
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -15,26 +15,31 @@ module OmniAuth
15
15
  option :scope, "remote_control:all"
16
16
 
17
17
  uid {
18
- access_token.token
18
+ user_uuid
19
19
  }
20
20
 
21
21
  # extra do
22
22
  # { :endpoints => raw_info }
23
23
  # end
24
24
 
25
- # def raw_info
26
- # return @raw_info if @raw_info
27
- # @raw_info = {}
28
- # uri = URI("https://graph.api.smartthings.com/api/smartapps/endpoints")
29
- # req = Net::HTTP::Get.new(uri)
30
- # req["Authorization"] = "Bearer #{access_token.token}"
31
- # Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
32
- # res = http.request(req)
33
- # @raw_info = JSON.parse(res.body)
34
- # puts res.body
35
- # end
36
- # return @raw_info
37
- # end
25
+ def user_uuid
26
+ all_lights
27
+ @user_uuid
28
+ end
29
+
30
+ def all_lights
31
+ return @all_lights if @all_lights
32
+ @all_lights = {}
33
+ uri = URI("https://api.lifx.com/v1/lights/all")
34
+ req = Net::HTTP::Get.new(uri)
35
+ req["Authorization"] = "Bearer #{access_token.token}"
36
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
37
+ res = http.request(req)
38
+ @user_uuid = res["Lifx-Account-Uuid"]
39
+ @all_lights = JSON.parse(res.body)
40
+ end
41
+ return @all_lights
42
+ end
38
43
  end
39
44
  end
40
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-lifx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hsiu-Fan Wang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth