wink_scheduler 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/lib/wink_scheduler/client.rb +9 -7
- data/lib/wink_scheduler/schedule.rb +4 -5
- data/lib/wink_scheduler/version.rb +1 -1
- data/wink_scheduler.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801d0b306b4c65b601fc2aeced74759dc63f14c3
|
4
|
+
data.tar.gz: 020cb77aa62adbb059bceadaeb282cad0819b458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad58b6216cb945341f08618a854e4b603880eedce3f4a76d062fc4950f14fc2589af2489b0fe2aba26f3b195bd43aecb985fd728caf815dd7a398320f34d044d
|
7
|
+
data.tar.gz: 1b9fab5079419db65764ccce18b6693c5bca1999fae5f95fe1f5dcbd773f57ac6dbafc990f541220b9a7c6efafe0c267bd7dee6d583ee90e3f83acdbada3fab3
|
data/Gemfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'winker'
|
1
2
|
require 'wink_scheduler/schedule'
|
2
3
|
|
3
4
|
module WinkScheduler
|
@@ -6,11 +7,17 @@ module WinkScheduler
|
|
6
7
|
@auth = conf["auth"]
|
7
8
|
@schedules = conf["schedules"]
|
8
9
|
|
9
|
-
|
10
|
+
Winker.configure do |wink|
|
10
11
|
wink.client_id = @auth["client_id"]
|
11
12
|
wink.client_secret = @auth["client_secret"]
|
12
13
|
wink.access_token = @auth["access_token"]
|
13
14
|
wink.refresh_token = @auth["refresh_token"]
|
15
|
+
wink.username = @auth["client_id"]
|
16
|
+
wink.password = @auth["client_secret"]
|
17
|
+
wink.endpoint = "https://winkapi.quirky.com"
|
18
|
+
if wink.respond_to?(:logger)
|
19
|
+
wink.logger = nil
|
20
|
+
end
|
14
21
|
end
|
15
22
|
end
|
16
23
|
|
@@ -18,16 +25,11 @@ module WinkScheduler
|
|
18
25
|
threads = []
|
19
26
|
@schedules.each do |s|
|
20
27
|
threads << Thread.new do
|
21
|
-
w = WinkScheduler::Schedule.new(
|
28
|
+
w = WinkScheduler::Schedule.new(s)
|
22
29
|
w.run
|
23
30
|
end
|
24
31
|
end
|
25
32
|
threads.each {|t| t.join}
|
26
33
|
end
|
27
|
-
|
28
|
-
def test
|
29
|
-
c = Wink::Client.new
|
30
|
-
p c.group("All").on
|
31
|
-
end
|
32
34
|
end
|
33
35
|
end
|
@@ -1,17 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'winker'
|
2
2
|
require 'weather-api'
|
3
3
|
require 'yaml'
|
4
4
|
require 'time'
|
5
5
|
|
6
6
|
module WinkScheduler
|
7
7
|
class Schedule
|
8
|
-
def initialize(
|
9
|
-
@client = client
|
8
|
+
def initialize(opts)
|
10
9
|
if opts["device"]
|
11
|
-
@object =
|
10
|
+
@object = Winker.devices.select { |d| next if d == nil; d.name == opts["device"] }[0]
|
12
11
|
@type = :device
|
13
12
|
elsif opts["group"]
|
14
|
-
@object =
|
13
|
+
@object = Winker.groups.select { |g| next if g == nil; g.name == opts["group"] }[0]
|
15
14
|
@type = :group
|
16
15
|
else
|
17
16
|
raise "device or group not defined"
|
data/wink_scheduler.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "weather-api", "~> 1.2"
|
22
|
+
spec.add_dependency "winker", "~> 0.0.14"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wink_scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Lanford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: weather-api
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: winker
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.14
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.14
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|