tplink_smarthome_api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -2
- data/README.md +3 -0
- data/lib/tplink_smarthome_api/version.rb +1 -1
- data/lib/tplink_smarthome_api.rb +7 -3
- data/tplink_smarthome_api.gemspec +3 -0
- metadata +45 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c3f6ef9f99c7964c872665441a94a314c726a89d93aae5ec7625b8adaa6541
|
4
|
+
data.tar.gz: 12cec7c9cf751aba456133cd88b8b5592ab6751b0b764bf29a69c911e17c9897
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e302dc08a85ca110bb245467125cee6e7878607ce84250304e887a6b8c4a4ec3cf9f187c8692be7e06f564d105a2a43634600f0ff03c938fbf3dcc11ddb5c57
|
7
|
+
data.tar.gz: fb076f5d2f0363f4acfde3fa837b653ae8693c4df09fe0002219f56de1ea9aa7bda581287694e79e79c9e4d94c96926f85ec6b52957ac01475f6d75e0fa360a4
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tplink_smarthome_api (0.
|
4
|
+
tplink_smarthome_api (0.3.0)
|
5
|
+
json
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
9
10
|
diff-lcs (1.3)
|
11
|
+
irb (1.0.0)
|
12
|
+
json (2.2.0)
|
10
13
|
rake (10.5.0)
|
11
14
|
rspec (3.7.0)
|
12
15
|
rspec-core (~> 3.7.0)
|
@@ -21,15 +24,18 @@ GEM
|
|
21
24
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
25
|
rspec-support (~> 3.7.0)
|
23
26
|
rspec-support (3.7.1)
|
27
|
+
shell_mock (0.7.2)
|
24
28
|
|
25
29
|
PLATFORMS
|
26
30
|
ruby
|
27
31
|
|
28
32
|
DEPENDENCIES
|
29
33
|
bundler (~> 1.16)
|
34
|
+
irb
|
30
35
|
rake (~> 10.0)
|
31
36
|
rspec (~> 3.0)
|
37
|
+
shell_mock (~> 0.7)
|
32
38
|
tplink_smarthome_api!
|
33
39
|
|
34
40
|
BUNDLED WITH
|
35
|
-
1.
|
41
|
+
1.17.2
|
data/README.md
CHANGED
data/lib/tplink_smarthome_api.rb
CHANGED
@@ -5,7 +5,7 @@ class TplinkSmarthomeApi
|
|
5
5
|
attr_accessor :ip_address, :verbose
|
6
6
|
|
7
7
|
def initialize(ip_address, verbose: false)
|
8
|
-
raise RuntimeError unless
|
8
|
+
raise RuntimeError unless self.dependendies_met?
|
9
9
|
@ip_address = ip_address
|
10
10
|
@verbose = verbose
|
11
11
|
end
|
@@ -36,6 +36,10 @@ class TplinkSmarthomeApi
|
|
36
36
|
send_command payload
|
37
37
|
end
|
38
38
|
|
39
|
+
def self.dependencies_met?
|
40
|
+
self.smarthome_cli_available?
|
41
|
+
end
|
42
|
+
|
39
43
|
private
|
40
44
|
|
41
45
|
def send_command(payload)
|
@@ -43,9 +47,9 @@ class TplinkSmarthomeApi
|
|
43
47
|
self
|
44
48
|
end
|
45
49
|
|
46
|
-
def smarthome_cli_available?
|
50
|
+
def self.smarthome_cli_available?
|
47
51
|
`which tplink-smarthome-api`
|
48
|
-
return true if
|
52
|
+
return true if $?.exitstatus == 0
|
49
53
|
|
50
54
|
puts "[#{Time.now}] tplink-smarthome-api could not be found."
|
51
55
|
puts "[#{Time.now}] To install it, run: `npm install -g tplink-smarthome-api`"
|
@@ -22,7 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
+
spec.add_dependency "json"
|
25
26
|
spec.add_development_dependency "bundler", "~> 1.16"
|
26
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "shell_mock", "~> 0.7"
|
30
|
+
spec.add_development_dependency "irb"
|
28
31
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tplink_smarthome_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Mercier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,34 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: shell_mock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: irb
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
description: A simple Ruby library to control TP-Link smart plugs
|
56
98
|
email:
|
57
99
|
- foss@carlmercier.com
|
@@ -92,8 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
134
|
- !ruby/object:Gem::Version
|
93
135
|
version: '0'
|
94
136
|
requirements: []
|
95
|
-
|
96
|
-
rubygems_version: 2.7.6
|
137
|
+
rubygems_version: 3.0.3
|
97
138
|
signing_key:
|
98
139
|
specification_version: 4
|
99
140
|
summary: A simple Ruby library to control TP-Link smart plugs
|