oura 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -1
- data/lib/oura/apis/activity.rb +1 -1
- data/lib/oura/apis/readiness.rb +1 -1
- data/lib/oura/apis/sleep_period.rb +1 -1
- data/lib/oura/model/readiness.rb +33 -0
- data/lib/oura/version.rb +1 -1
- data/oura.gemspec +0 -1
- metadata +3 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc0cb134fcdedad75e27f75a7329befdd0c5a4755e6b5c565691231ecb60b2ba
|
4
|
+
data.tar.gz: 63b6ff856e32217808920bd8ab5d73e63074f732499206d25ba16dfeaa261b18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167ee71201bfbb1b11718d7eb59b115800e63aeb1c5a83203f7bab75013884267c3b8ff4c32d421e307c5182b64bea334831b52882f6ee7e1a757848011bc3d0
|
7
|
+
data.tar.gz: e25478db494ffbb831cd2628d172c0cfd9f73f47894a299fafca2c0769d8e13dea41dbf3d062ba0e3c2e2300406c3147214971a53b07cc90f33132146b2970e4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/oura/apis/activity.rb
CHANGED
@@ -17,7 +17,7 @@ module Oura
|
|
17
17
|
# "activity": [{"summary_date": "2016-10-11", ...}, {"summary_date": "2016-10-12", ...}, ...]
|
18
18
|
# }
|
19
19
|
# @return [Oura::Model::Activity]
|
20
|
-
def activity(start_date:, end_date:)
|
20
|
+
def activity(start_date:, end_date: Time.current.to_date)
|
21
21
|
sdate, edate = [start_date, end_date].map { |date| transform_date(date) }
|
22
22
|
response_body = get(REQUEST_PATH, params: { start: sdate, end: edate }).body
|
23
23
|
symbolized_json = JSON.parse(response_body).deep_symbolize_keys
|
data/lib/oura/apis/readiness.rb
CHANGED
@@ -32,7 +32,7 @@ module Oura
|
|
32
32
|
# "readiness": [{"summary_date": "2016-10-11", ...}, {"summary_date": "2016-10-12", ...}, ...]
|
33
33
|
# }
|
34
34
|
# @return [Oura::Model::Readiness]
|
35
|
-
def readiness(start_date:, end_date:)
|
35
|
+
def readiness(start_date:, end_date: Time.current.to_date)
|
36
36
|
sdate, edate = [start_date, end_date].map { |date| transform_date(date) }
|
37
37
|
response_body = get(REQUEST_PATH, params: { start: sdate, end: edate }).body
|
38
38
|
symbolized_json = JSON.parse(response_body).deep_symbolize_keys
|
@@ -17,7 +17,7 @@ module Oura
|
|
17
17
|
# "sleep": [{"summary_date": "2016-10-11", ...}, {"summary_date": "2016-10-12", ...}, ...]
|
18
18
|
# }
|
19
19
|
# @return [Oura::Model::SleepPeriod]
|
20
|
-
def sleep_period(start_date:, end_date:)
|
20
|
+
def sleep_period(start_date:, end_date: Time.current.to_date)
|
21
21
|
sdate, edate = [start_date, end_date].map { |date| transform_date(date) }
|
22
22
|
response_body = get(REQUEST_PATH, params: { start: sdate, end: edate }).body
|
23
23
|
symbolized_json = JSON.parse(response_body).deep_symbolize_keys
|
data/lib/oura/model/readiness.rb
CHANGED
@@ -6,6 +6,39 @@ module Oura
|
|
6
6
|
# Oura::Mode::Readiness is Readiness Model.
|
7
7
|
class Readiness < ::Oura::Model::Base
|
8
8
|
attr_reader :readiness
|
9
|
+
|
10
|
+
ATTRIBUTES = %i[
|
11
|
+
score_activity_balance
|
12
|
+
score_resting_hr
|
13
|
+
score
|
14
|
+
period_id
|
15
|
+
score_temperature
|
16
|
+
score_sleep_balance
|
17
|
+
summary_date
|
18
|
+
score_previous_day
|
19
|
+
score_previous_night
|
20
|
+
score_recovery_index
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
ATTRIBUTES.map { |k| k.to_s.pluralize }.each.with_index do |pluralized_name, index|
|
24
|
+
define_method pluralized_name do
|
25
|
+
readiness.map { |h| h[ATTRIBUTES[index]] }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def average_score
|
30
|
+
average_by_array(scores)
|
31
|
+
end
|
32
|
+
|
33
|
+
def average_resting_hr
|
34
|
+
average_by_array(score_resting_hrs)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def average_by_array(array)
|
40
|
+
array.sum.to_f / array.size
|
41
|
+
end
|
9
42
|
end
|
10
43
|
end
|
11
44
|
end
|
data/lib/oura/version.rb
CHANGED
data/oura.gemspec
CHANGED
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_dependency 'oauth2'
|
28
28
|
spec.add_development_dependency 'activesupport'
|
29
|
-
spec.add_development_dependency 'bundler', '~> 1.17'
|
30
29
|
spec.add_development_dependency 'codecov'
|
31
30
|
spec.add_development_dependency 'danger'
|
32
31
|
spec.add_development_dependency 'danger-junit'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oura
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Ikezawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.17'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.17'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: codecov
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -317,8 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
303
|
- !ruby/object:Gem::Version
|
318
304
|
version: '0'
|
319
305
|
requirements: []
|
320
|
-
|
321
|
-
rubygems_version: 2.7.6
|
306
|
+
rubygems_version: 3.0.3
|
322
307
|
signing_key:
|
323
308
|
specification_version: 4
|
324
309
|
summary: unofficial API client of oura-cloud.
|