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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c0761fc157efbacefd443814f709b27b5e4fc09f4de6aaff6c9a79af34478ac
4
- data.tar.gz: acf4c51ad6703c91c0c55ee69c485f8729039ce30713f8a46e03edd11256703a
3
+ metadata.gz: a7c3f6ef9f99c7964c872665441a94a314c726a89d93aae5ec7625b8adaa6541
4
+ data.tar.gz: 12cec7c9cf751aba456133cd88b8b5592ab6751b0b764bf29a69c911e17c9897
5
5
  SHA512:
6
- metadata.gz: 312976b7738a57b707156e45836f6e77b42099e41962f69ffd20b4823e5cda7b231b4d7570536402d06f9684588523c7b2eeee788cd5f156cbe921a1a1d87c4e
7
- data.tar.gz: b32bd83cbc137c216968e6b0a252c3f19bc8f287a037feb0d17cbbd48487045bffb2cc37699198fd9962cb7bbfada8d9cd698a62b882d23cf126348c741e1371
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.2.1)
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.16.4
41
+ 1.17.2
data/README.md CHANGED
@@ -36,6 +36,9 @@ device.power_off(delay: 10) # waits 10 seconds before powering the device off
36
36
 
37
37
  # or chain methods together
38
38
  device.power_off.power_on(delay: 15) # turn off device, wait 15 seconds, then turn device back on
39
+
40
+ # reboot
41
+ device.reboot
39
42
  ```
40
43
 
41
44
 
@@ -1,3 +1,3 @@
1
1
  class TplinkSmarthomeApi
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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 smarthome_cli_available?
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 $? == 0
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.2.1
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: 2018-12-28 00:00:00.000000000 Z
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
- rubyforge_project:
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