sleepiq 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/sleepiq/client.rb +10 -5
- data/lib/sleepiq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb40d4f6d384d6598c5eb5ec58b75ccfb0a13fec9c97afe70a12aa5acdc3e39c
|
4
|
+
data.tar.gz: 90c08cbb707980e1945bb2e624e8fe824263b46079a5b2adb84c1f15f8c337a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae787bccb1cbfa093871ef2b4272786dd3bdc43eb810daf27cfb18cc18800b6a49b717dd51d4fd599695200bfa0eb9ecc127596af10320c47fa994b7d4c8aff
|
7
|
+
data.tar.gz: d7dfce0803af55ccc512aa069332622c7ad24a38450024e3bf547010cb020a5d858190032e140dd9153e4d033e3b87ef8cb6b857f99c57534a48f82593c76d5c
|
data/CHANGELOG.md
CHANGED
data/lib/sleepiq/client.rb
CHANGED
@@ -11,11 +11,16 @@ module SleepIQ
|
|
11
11
|
include SleepIQ::Pump
|
12
12
|
include SleepIQ::Sleeper
|
13
13
|
|
14
|
-
def initialize(**opts)
|
14
|
+
def initialize(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
15
15
|
@username = opts[:username].nil? ? ENV['sleepiq_username'] : opts[:username]
|
16
16
|
@password = opts[:password].nil? ? ENV['sleepiq_password'] : opts[:password]
|
17
|
+
@key = opts[:key]
|
18
|
+
@awsalb = opts[:awsalb]
|
19
|
+
@sessid = opts[:sessid]
|
20
|
+
@bedid = opts[:bedid]
|
21
|
+
|
22
|
+
login if @key.nil? || @awsalb.nil? || @sessid.nil?
|
17
23
|
|
18
|
-
login
|
19
24
|
@conn = Faraday.new(
|
20
25
|
url: 'https://api.sleepiq.sleepnumber.com',
|
21
26
|
headers: default_headers,
|
@@ -26,7 +31,7 @@ module SleepIQ
|
|
26
31
|
conn.adapter :net_http
|
27
32
|
end
|
28
33
|
|
29
|
-
@bedid = family_status['beds'][0]['bedId']
|
34
|
+
@bedid = family_status['beds'][0]['bedId'] if @bedid.nil?
|
30
35
|
end
|
31
36
|
|
32
37
|
def login(username = @username, password = @password) # rubocop:disable Metrics/AbcSize
|
@@ -50,8 +55,8 @@ module SleepIQ
|
|
50
55
|
raise "status code was #{result.status}" unless result.status == 200
|
51
56
|
|
52
57
|
result.headers['set-cookie'].split(' ').each do |k, _v|
|
53
|
-
@sessid = k.split('=')[1].delete_suffix(';')
|
54
|
-
@awsalb = k.split('=')[1].delete_suffix(';')
|
58
|
+
@sessid = k.split('=')[1].delete_suffix(';') if k.include? 'JSESSIONID'
|
59
|
+
@awsalb = k.split('=')[1].delete_suffix(';') if k.include? 'AWSALB'
|
55
60
|
end
|
56
61
|
@key = result.body['key']
|
57
62
|
end
|
data/lib/sleepiq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleepiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- esity
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|