switchbot 0.7.0 → 0.8.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 +4 -4
- data/.github/workflows/main.yml +4 -6
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/lib/switchbot/bot.rb +9 -1
- data/lib/switchbot/client.rb +4 -0
- data/lib/switchbot/color_bulb.rb +9 -1
- data/lib/switchbot/humidifier.rb +9 -1
- data/lib/switchbot/light.rb +9 -1
- data/lib/switchbot/lock.rb +9 -1
- data/lib/switchbot/plug_mini.rb +17 -0
- data/lib/switchbot/version.rb +1 -1
- data/lib/switchbot.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc3479417cb8f17cdb727ce13981d7bca88163f75bc14419d7fcb1c446a355a0
|
4
|
+
data.tar.gz: a8fb35982f2b10684f89ad3a7bb20604198d24b2966cec99ca81aff5cfc51ce7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6f2df352088e371a871e10c8685139a33320c92254fd8ee9231dfc8927090e8fc3643d1dd706e09ca71ccce64646c0b5fceba7e2404e6c45bf38093dd7edef7
|
7
|
+
data.tar.gz: 725ea36d3fedf1f53d383e60dff9fd246865e920d023f98d4978a1f43f0ad68f8c977f28e839d8cc77002bfca9923cf0f7895eb5ff98f7dc8daaf264ca9b78f8
|
data/.github/workflows/main.yml
CHANGED
@@ -8,16 +8,14 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
10
|
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
11
|
-
ruby: [2.6, 2.7, '3.0', 3.1]
|
11
|
+
ruby: [2.6, 2.7, '3.0', 3.1, 3.2]
|
12
12
|
name: Ruby ${{ matrix.ruby }}
|
13
13
|
steps:
|
14
|
-
- uses: actions/checkout@
|
14
|
+
- uses: actions/checkout@v3
|
15
15
|
- name: Set up Ruby
|
16
16
|
uses: ruby/setup-ruby@v1
|
17
17
|
with:
|
18
18
|
ruby-version: ${{ matrix.ruby }}
|
19
|
+
bundler-cache: true
|
19
20
|
- name: Run the default task
|
20
|
-
run:
|
21
|
-
gem install bundler -v 2.2.4
|
22
|
-
bundle install
|
23
|
-
bundle exec rake
|
21
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](http://github.com/ytkg/switchbot/compare/v0.
|
2
|
+
[full changelog](http://github.com/ytkg/switchbot/compare/v0.8.0...main)
|
3
|
+
|
4
|
+
## v0.8.0
|
5
|
+
[full changelog](http://github.com/ytkg/switchbot/compare/v0.7.0...v0.8.0)
|
6
|
+
|
7
|
+
* Add Plug Mini
|
8
|
+
* https://github.com/ytkg/switchbot/pull/21
|
3
9
|
|
4
10
|
## v0.7.0
|
5
11
|
[full changelog](http://github.com/ytkg/switchbot/compare/v0.6.0...v0.7.0)
|
data/README.md
CHANGED
data/lib/switchbot/bot.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Switchbot
|
4
|
-
class Bot
|
4
|
+
class Bot
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :status, :commands, :on, :off, :on?, :off?
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
5
13
|
def press
|
6
14
|
commands(command: 'press')
|
7
15
|
end
|
data/lib/switchbot/client.rb
CHANGED
data/lib/switchbot/color_bulb.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Switchbot
|
4
|
-
class ColorBulb
|
4
|
+
class ColorBulb
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :status, :commands, :on, :off, :on?, :off?
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
5
13
|
def toggle
|
6
14
|
commands(command: 'toggle')
|
7
15
|
end
|
data/lib/switchbot/humidifier.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Switchbot
|
4
|
-
class Humidifier
|
4
|
+
class Humidifier
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :status, :commands, :on, :off, :on?, :off?
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
5
13
|
def mode(value)
|
6
14
|
commands(command: 'setMode', parameter: value.to_s)
|
7
15
|
end
|
data/lib/switchbot/light.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Switchbot
|
4
|
-
class Light
|
4
|
+
class Light
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :commands, :on, :off
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
5
13
|
def brightness_up
|
6
14
|
commands(command: 'brightnessUp')
|
7
15
|
end
|
data/lib/switchbot/lock.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Switchbot
|
4
|
-
class Lock
|
4
|
+
class Lock
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :status, :commands
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
5
13
|
def lock
|
6
14
|
commands(command: 'lock')
|
7
15
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Switchbot
|
4
|
+
class PlugMini
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@device, :status, :commands, :on, :off, :on?, :off?
|
8
|
+
|
9
|
+
def initialize(client:, device_id:)
|
10
|
+
@device = Device.new(client: client, device_id: device_id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def toggle
|
14
|
+
commands(command: 'toggle')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/switchbot/version.rb
CHANGED
data/lib/switchbot.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiki Takagi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/switchbot/humidifier.rb
|
151
151
|
- lib/switchbot/light.rb
|
152
152
|
- lib/switchbot/lock.rb
|
153
|
+
- lib/switchbot/plug_mini.rb
|
153
154
|
- lib/switchbot/scene.rb
|
154
155
|
- lib/switchbot/version.rb
|
155
156
|
- switchbot.gemspec
|