netatmo 0.1.0 → 0.1.1

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: 5afa0ba31f1da59d10c3b91a68679e21abef496ee5cd34ca0e235f5db43f948d
4
- data.tar.gz: 572df5b1e1fced24e36023d4cf9a210ce057df459942917193dad8331c32bc0c
3
+ metadata.gz: e2acdebb6919008d5b9b76987ffec7b2285ca9231f10705bbd345a7ec7552a95
4
+ data.tar.gz: 56fb133bacffe77f6b53d0318e9229cfe4ad6b5254f57977ba6ee4614e2fbf49
5
5
  SHA512:
6
- metadata.gz: f762ee09437e403a2ec4737a31f933c8c8980b3db8d167383b552f26b6ad26db083565ac1f697b60b7db65a8a7740445f7d12875123df0df7943c9d0f670b4b3
7
- data.tar.gz: 3a1cb2e6420c2b2ba96428d1064f8f3354d77405a88b6452dfcf45a5358bdebf778048a1acf9fbf39c96677b959622b8ce43321b461e46152cb1b2899afb309c
6
+ metadata.gz: 147a22967a1df8528185ecfc759872d25b5a59b95217bb129b54c6681afa5f200a3e8704e8f917bbad66c7ab740e6000497ea87a1d037f97f48a52f1db1b763a
7
+ data.tar.gz: 3b10bf2687314dcd12833f786b816678f1a8ce08001495e15e71e1610085c5312205a5c45ba930c6bb88516f75dd4d644447adb53f493c11a426756ec4d4cfaa
@@ -1,17 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'netatmo/version'
4
- require 'netatmo_inflector'
5
-
6
4
  require 'zeitwerk'
7
- require 'byebug'
8
- require 'dotenv'
9
5
  require 'easy_enum'
10
6
 
11
- Dotenv.load
7
+ inflections = {
8
+ 'na_main' => 'NAMain',
9
+ 'na_module1' => 'NAModule1',
10
+ 'na_module2' => 'NAModule2',
11
+ 'na_module3' => 'NAModule3',
12
+ 'na_module4' => 'NAModule4',
13
+ 'co2' => 'CO2'
14
+ }
12
15
 
13
16
  @loader = Zeitwerk::Loader.for_gem
14
- @loader.inflector = NetatmoInflector.new
17
+ @loader.inflector.inflect(inflections)
15
18
  @loader.enable_reloading
16
19
  @loader.setup
17
20
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Netatmo
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -56,6 +56,30 @@ module Netatmo
56
56
  def name
57
57
  station_name
58
58
  end
59
+
60
+ def outdoor_module
61
+ modules.find(&:outdoor_module?)
62
+ end
63
+
64
+ def rain_gauge
65
+ modules.find(&:rain_gauge?)
66
+ end
67
+
68
+ def wind_gauge
69
+ modules.find(&:wind_gauge?)
70
+ end
71
+
72
+ def health_coach
73
+ modules.find(&:health_coach?)
74
+ end
75
+
76
+ def indoor_modules
77
+ modules.select(&:indoor_module?)
78
+ end
79
+
80
+ def first_indoor_module
81
+ indoor_modules&.first
82
+ end
59
83
  end
60
84
  end
61
85
  end
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'forwardable'
4
+
3
5
  module Netatmo
4
6
  module Weather
5
7
  class Device
8
+ extend Forwardable
9
+
6
10
  attr_accessor :id
7
11
  attr_accessor :type
8
12
  attr_accessor :data_types
@@ -16,6 +20,8 @@ module Netatmo
16
20
  attr_accessor :last_seen
17
21
  attr_accessor :rf_status
18
22
 
23
+ def_delegators :type, :base_station?, :outdoor_module?, :wind_gauge?, :rain_gauge?, :indoor_module?, :health_coach?
24
+
19
25
  def self.parse(data)
20
26
  type = Netatmo::Util::DeviceType.value(data['type'])
21
27
 
@@ -88,7 +94,7 @@ module Netatmo
88
94
  end
89
95
 
90
96
  def battery?
91
- respond_to? :battery_status
97
+ respond_to?(:battery_status)
92
98
  end
93
99
 
94
100
  def data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netatmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_enum
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: 0.1.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: 0.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.2'
61
+ version: '2.3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.2'
68
+ version: '2.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '5.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rake
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +156,14 @@ dependencies:
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0.79'
159
+ version: '0.81'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0.79'
166
+ version: '0.81'
153
167
  description: Ruby Wrapper for the Netatmo HTTP API
154
168
  email:
155
169
  - marco.roth@intergga.ch
@@ -196,7 +210,6 @@ files:
196
210
  - lib/netatmo/weather/station_data.rb
197
211
  - lib/netatmo/weather/wifi_status.rb
198
212
  - lib/netatmo/weather/wind_gauge.rb
199
- - lib/netatmo_inflector.rb
200
213
  homepage: https://github.com/marcoroth/netatmo-ruby
201
214
  licenses:
202
215
  - MIT
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'zeitwerk'
4
-
5
- class NetatmoInflector < Zeitwerk::Inflector
6
- def camelize(basename, _abspath)
7
- case basename
8
- when 'na_main'
9
- 'NAMain'
10
- when 'na_module1'
11
- 'NAModule1'
12
- when 'na_module2'
13
- 'NAModule2'
14
- when 'na_module3'
15
- 'NAModule3'
16
- when 'na_module4'
17
- 'NAModule4'
18
- when 'co2'
19
- 'CO2'
20
- else
21
- super
22
- end
23
- end
24
- end