netatmo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netatmo/administrative.rb +1 -7
- data/lib/netatmo/battery_status/battery_status.rb +1 -2
- data/lib/netatmo/client.rb +5 -1
- data/lib/netatmo/dashboard_data/co2.rb +1 -3
- data/lib/netatmo/dashboard_data/health_index.rb +1 -3
- data/lib/netatmo/dashboard_data/humidity.rb +1 -3
- data/lib/netatmo/dashboard_data/noise.rb +1 -3
- data/lib/netatmo/dashboard_data/pressure.rb +1 -5
- data/lib/netatmo/dashboard_data/rain.rb +1 -4
- data/lib/netatmo/dashboard_data/temperature.rb +1 -8
- data/lib/netatmo/dashboard_data/wind.rb +1 -9
- data/lib/netatmo/place.rb +1 -5
- data/lib/netatmo/user.rb +1 -2
- data/lib/netatmo/version.rb +1 -1
- data/lib/netatmo/weather/base_station.rb +2 -19
- data/lib/netatmo/weather/battery_device.rb +1 -3
- data/lib/netatmo/weather/device.rb +2 -12
- data/lib/netatmo/weather/indoor_module.rb +1 -3
- data/lib/netatmo/weather/outdoor_module.rb +1 -3
- data/lib/netatmo/weather/station_data.rb +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ef266bbbacba6b1ff49e39751806a2a9fb53d311e514a78a27e9733c88e279
|
4
|
+
data.tar.gz: '08b52dceec23cbbad2fdcd1290e6afaeda3f28ddc1e2066835536c142773c059'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61bc4b416a962fee5d797f09bec2a427b700b5e7e1634b12f4c15beed23ed5983bbb0e0ca251fca62a650235cdedd6e0c9f38098e0d45e4a6ae807e66d8a610
|
7
|
+
data.tar.gz: aff153b8ee47833d3f93e33be068c1c9e54575c9f9fbd2ec11b28adcc5c188c877026e177304695e2113c99e9c0e1d36b0083c96fd83681bf47370d1b941268b
|
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
module Netatmo
|
4
4
|
class Administrative
|
5
|
-
attr_accessor :unit
|
6
|
-
attr_accessor :windunit
|
7
|
-
attr_accessor :pressureunit
|
8
|
-
attr_accessor :lang
|
9
|
-
attr_accessor :reg_locale
|
10
|
-
attr_accessor :country
|
11
|
-
attr_accessor :feel_like
|
5
|
+
attr_accessor :unit, :windunit, :pressureunit, :lang, :reg_locale, :country, :feel_like
|
12
6
|
|
13
7
|
def initialize(data)
|
14
8
|
self.unit = Netatmo::Util::Unit.value(data['unit'])
|
data/lib/netatmo/client.rb
CHANGED
@@ -7,6 +7,7 @@ module Netatmo
|
|
7
7
|
class Client
|
8
8
|
BASE_URL = 'https://api.netatmo.net'
|
9
9
|
attr_accessor :access_token, :refresh_token, :expires_at
|
10
|
+
|
10
11
|
Config = Struct.new(:client_id, :client_secret, :username, :password, :base_url)
|
11
12
|
|
12
13
|
def initialize(&config_block)
|
@@ -69,9 +70,11 @@ module Netatmo
|
|
69
70
|
|
70
71
|
# rubocop:disable Naming/AccessorMethodName
|
71
72
|
def get_station_data
|
73
|
+
raise 'Unauthenticated' unless authenticate
|
74
|
+
|
72
75
|
response = connection.get('/api/getstationsdata', access_token: @access_token)
|
73
76
|
|
74
|
-
raise '
|
77
|
+
raise 'Got unsuccessful response' unless response.status == 200
|
75
78
|
|
76
79
|
Netatmo::Weather::StationData.new(JSON.parse(response.body)['body'])
|
77
80
|
end
|
@@ -93,6 +96,7 @@ module Netatmo
|
|
93
96
|
@access_token = data['access_token']
|
94
97
|
@refresh_token = data['refresh_token']
|
95
98
|
@expires_at = Time.now + data['expires_in']
|
99
|
+
puts "successfully stored new access_token: #{@access_token} - expires at #{@expires_at}"
|
96
100
|
end
|
97
101
|
end
|
98
102
|
end
|
@@ -7,11 +7,7 @@ module Netatmo
|
|
7
7
|
class Pressure
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
attr_accessor :time
|
11
|
-
attr_accessor :value
|
12
|
-
attr_accessor :absolute_pressure
|
13
|
-
attr_accessor :trend
|
14
|
-
attr_accessor :unit
|
10
|
+
attr_accessor :time, :value, :absolute_pressure, :trend, :unit
|
15
11
|
|
16
12
|
def initialize(data)
|
17
13
|
self.time = Time.at(data['time_utc'])
|
@@ -3,10 +3,7 @@
|
|
3
3
|
module Netatmo
|
4
4
|
module DashboardData
|
5
5
|
class Rain
|
6
|
-
attr_accessor :time
|
7
|
-
attr_accessor :value
|
8
|
-
attr_accessor :sum_rain_1
|
9
|
-
attr_accessor :sum_rain_24
|
6
|
+
attr_accessor :time, :value, :sum_rain_1, :sum_rain_24
|
10
7
|
|
11
8
|
def initialize(data)
|
12
9
|
self.time = Time.at(data['time_utc'])
|
@@ -3,14 +3,7 @@
|
|
3
3
|
module Netatmo
|
4
4
|
module DashboardData
|
5
5
|
class Temperature
|
6
|
-
attr_accessor :time
|
7
|
-
attr_accessor :value
|
8
|
-
attr_accessor :min
|
9
|
-
attr_accessor :max
|
10
|
-
attr_accessor :min_date
|
11
|
-
attr_accessor :max_date
|
12
|
-
attr_accessor :trend
|
13
|
-
attr_accessor :unit
|
6
|
+
attr_accessor :time, :value, :min, :max, :min_date, :max_date, :trend, :unit
|
14
7
|
|
15
8
|
def initialize(data)
|
16
9
|
self.time = Time.at(data['time_utc'])
|
@@ -3,15 +3,7 @@
|
|
3
3
|
module Netatmo
|
4
4
|
module DashboardData
|
5
5
|
class Wind
|
6
|
-
attr_accessor :time
|
7
|
-
attr_accessor :wind_strength
|
8
|
-
attr_accessor :max_wind_strength
|
9
|
-
attr_accessor :max_wind_strength_date
|
10
|
-
attr_accessor :wind_angle
|
11
|
-
attr_accessor :gust_strength
|
12
|
-
attr_accessor :gust_angle
|
13
|
-
attr_accessor :wind_historic
|
14
|
-
attr_accessor :unit
|
6
|
+
attr_accessor :time, :wind_strength, :max_wind_strength, :max_wind_strength_date, :wind_angle, :gust_strength, :gust_angle, :wind_historic, :unit
|
15
7
|
|
16
8
|
def initialize(data)
|
17
9
|
self.time = Time.at(data['time_utc'])
|
data/lib/netatmo/place.rb
CHANGED
@@ -4,11 +4,7 @@ require 'geocoder'
|
|
4
4
|
|
5
5
|
module Netatmo
|
6
6
|
class Place
|
7
|
-
attr_accessor :altitude
|
8
|
-
attr_accessor :city
|
9
|
-
attr_accessor :country
|
10
|
-
attr_accessor :location
|
11
|
-
attr_accessor :timezone
|
7
|
+
attr_accessor :altitude, :city, :country, :location, :timezone
|
12
8
|
|
13
9
|
def initialize(data)
|
14
10
|
self.altitude = data['altitude']
|
data/lib/netatmo/user.rb
CHANGED
data/lib/netatmo/version.rb
CHANGED
@@ -3,25 +3,8 @@
|
|
3
3
|
module Netatmo
|
4
4
|
module Weather
|
5
5
|
class BaseStation < Device
|
6
|
-
attr_accessor :cipher_id
|
7
|
-
|
8
|
-
attr_accessor :last_status_store
|
9
|
-
attr_accessor :last_upgrade
|
10
|
-
attr_accessor :co2_calibrating
|
11
|
-
attr_accessor :station_name
|
12
|
-
attr_accessor :friend_users
|
13
|
-
attr_accessor :read_only
|
14
|
-
|
15
|
-
attr_accessor :temperature
|
16
|
-
attr_accessor :co2
|
17
|
-
attr_accessor :humidity
|
18
|
-
attr_accessor :noise
|
19
|
-
attr_accessor :pressure
|
20
|
-
|
21
|
-
attr_accessor :wifi_status
|
22
|
-
attr_accessor :place
|
23
|
-
|
24
|
-
attr_accessor :modules
|
6
|
+
attr_accessor :cipher_id, :date_setup, :last_status_store, :last_upgrade, :co2_calibrating, :station_name, :place,
|
7
|
+
:friend_users, :read_only, :temperature, :co2, :humidity, :noise, :pressure, :wifi_status, :modules
|
25
8
|
|
26
9
|
# DeviceType: NAMain
|
27
10
|
def initialize(data)
|
@@ -7,18 +7,7 @@ module Netatmo
|
|
7
7
|
class Device
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
attr_accessor :id
|
11
|
-
attr_accessor :type
|
12
|
-
attr_accessor :data_types
|
13
|
-
attr_accessor :module_name
|
14
|
-
attr_accessor :code
|
15
|
-
attr_accessor :reachable
|
16
|
-
attr_accessor :dashboard_data
|
17
|
-
attr_accessor :firmware
|
18
|
-
attr_accessor :last_setup
|
19
|
-
attr_accessor :last_message
|
20
|
-
attr_accessor :last_seen
|
21
|
-
attr_accessor :rf_status
|
10
|
+
attr_accessor :id, :type, :data_types, :module_name, :code, :reachable, :dashboard_data, :firmware, :last_setup, :last_message, :last_seen, :rf_status
|
22
11
|
|
23
12
|
def_delegators :type, :base_station?, :outdoor_module?, :wind_gauge?, :rain_gauge?, :indoor_module?, :health_coach?
|
24
13
|
|
@@ -110,6 +99,7 @@ module Netatmo
|
|
110
99
|
d
|
111
100
|
end
|
112
101
|
|
102
|
+
# REWORK
|
113
103
|
def values
|
114
104
|
h = {}
|
115
105
|
h[:co2] = co2 if co2?
|
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.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: easy_enum
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0.
|
159
|
+
version: '0.87'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0.
|
166
|
+
version: '0.87'
|
167
167
|
description: Ruby Wrapper for the Netatmo HTTP API
|
168
168
|
email:
|
169
169
|
- marco.roth@intergga.ch
|