switchbot 0.7.0 → 0.8.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: e5dbe643e1c26eafa1c841dcf3cffb4e42ec799bba387b139fdd9d72e630ec6f
4
- data.tar.gz: 2e243ec43219aab5fdbaf3dd4f20291676d7bdfebd7ee0ccdaee32b6c7cd21a4
3
+ metadata.gz: cc3479417cb8f17cdb727ce13981d7bca88163f75bc14419d7fcb1c446a355a0
4
+ data.tar.gz: a8fb35982f2b10684f89ad3a7bb20604198d24b2966cec99ca81aff5cfc51ce7
5
5
  SHA512:
6
- metadata.gz: '0468a22f7a997c01e036c473e81af30e6832a8e39fdfb0acbd0155904f19459b20d5944247de05eb165cf98b810844adaf554a6224113ad95a5b12f5b518b5ba'
7
- data.tar.gz: 2a434cdcfd1956789526ad7f925871ccae53c7eb9c496b1a909a16cd2f6535b751e1d32abd5a79d3d1c9d4ba05d6306caf0c55d3c40c224bb3b988a227c093f0
6
+ metadata.gz: a6f2df352088e371a871e10c8685139a33320c92254fd8ee9231dfc8927090e8fc3643d1dd706e09ca71ccce64646c0b5fceba7e2404e6c45bf38093dd7edef7
7
+ data.tar.gz: 725ea36d3fedf1f53d383e60dff9fd246865e920d023f98d4978a1f43f0ad68f8c977f28e839d8cc77002bfca9923cf0f7895eb5ff98f7dc8daaf264ca9b78f8
@@ -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@v2
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
@@ -9,3 +9,6 @@ Metrics/BlockLength:
9
9
  Exclude:
10
10
  - switchbot.gemspec
11
11
  - spec/**/*
12
+
13
+ Gemspec/DevelopmentDependencies:
14
+ EnforcedStyle: gemspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/ytkg/switchbot/compare/v0.7.0...main)
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
@@ -1,6 +1,6 @@
1
1
  # Switchbot
2
2
 
3
- [SwichBot API](https://github.com/OpenWonderLabs/SwitchBotAPI) client for Ruby
3
+ [SwitchBot API](https://github.com/OpenWonderLabs/SwitchBotAPI) client for Ruby
4
4
 
5
5
  ## Installation
6
6
 
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 < Device
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
@@ -78,6 +78,10 @@ module Switchbot
78
78
  Lock.new(client: self, device_id: device_id)
79
79
  end
80
80
 
81
+ def plug_mini(device_id)
82
+ PlugMini.new(client: self, device_id: device_id)
83
+ end
84
+
81
85
  private
82
86
 
83
87
  def headers
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchbot
4
- class ColorBulb < Device
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
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchbot
4
- class Humidifier < Device
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
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchbot
4
- class Light < Device
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
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchbot
4
- class Lock < Device
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchbot
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  end
data/lib/switchbot.rb CHANGED
@@ -15,6 +15,7 @@ require_relative 'switchbot/light'
15
15
  require_relative 'switchbot/humidifier'
16
16
  require_relative 'switchbot/color_bulb'
17
17
  require_relative 'switchbot/lock'
18
+ require_relative 'switchbot/plug_mini'
18
19
 
19
20
  module Switchbot
20
21
  class Error < StandardError; end
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.7.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: 2022-10-27 00:00:00.000000000 Z
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