dexcom_share_api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/dexcom_share_api/glucose.rb +22 -0
- data/lib/dexcom_share_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02559e1ff1a0ec536843a88cf8b9f09fe1f2883e0539d132e0b6060c570b1c7f'
|
4
|
+
data.tar.gz: 0cbd050a073de77dc8682af9ead70733f4dc483847f4355647977dd84a1d6109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a53a8003e964c93fe6dec7d3362c9b64a310681568f3bf654ea8c07ee25bb7be220f22071eefefcca96ea8545903807ae9e0da8e5aba1d06b3516e84c0dfea9b
|
7
|
+
data.tar.gz: 0f908a411e42b3c47419f38f1ec5b7f0fae5d2665a7aa5abd05c1cbd14e1ac2207a60d2b00a0690f0c858db3092b588b470e82ebb022d8c095fdcf2638bedaef
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@ TLDR; This is a tiny gem to interact with the Dexcom Share API. The API is
|
|
3
3
|
guarantees. However, it hasn't changed for the past few years so it should be
|
4
4
|
fairly stable. Feel free to report any bugs and I'll fix them!
|
5
5
|
|
6
|
+
https://rubygems.org/gems/dexcom_share_api
|
7
|
+
|
6
8
|
## Usage
|
7
9
|
```ruby
|
8
10
|
require "dexcom_share_api"
|
@@ -27,13 +29,14 @@ glucose.each do |entry|
|
|
27
29
|
puts entry.mmol # => 5.39
|
28
30
|
puts entry.mgdl # => 151.0
|
29
31
|
puts entry.trend # => "flat"
|
32
|
+
puts entry.trend_arrow # => "→"
|
30
33
|
# Timestamp is an iso8601
|
31
34
|
puts entry.timestamp # => "2024-03-06T04:14:53+00:00"
|
32
35
|
end
|
33
36
|
|
34
37
|
# Alternatively, to grab the last entry:
|
35
38
|
glucose = client.last_estimated_glucose
|
36
|
-
puts glucose.to_h # => {:trend=>"flat", :timestamp=>"2024-03-06T04:14:53+00:00", :mmol=>8.39, :mgdl=>151.0}
|
39
|
+
puts glucose.to_h # => {:trend=>"flat", :trend_arrow=>"→", :timestamp=>"2024-03-06T04:14:53+00:00", :mmol=>8.39, :mgdl=>151.0}
|
37
40
|
```
|
38
41
|
|
39
42
|
## History
|
@@ -18,6 +18,7 @@ module DexcomShareApi
|
|
18
18
|
def to_h
|
19
19
|
{
|
20
20
|
trend:,
|
21
|
+
trend_arrow:,
|
21
22
|
timestamp:,
|
22
23
|
mmol:,
|
23
24
|
mgdl:,
|
@@ -37,6 +38,27 @@ module DexcomShareApi
|
|
37
38
|
@raw_glucose_data["Trend"].split(/(?=[A-Z])/).join("-").downcase
|
38
39
|
end
|
39
40
|
|
41
|
+
def trend_arrow
|
42
|
+
case trend
|
43
|
+
when "double-up"
|
44
|
+
"↑↑"
|
45
|
+
when "single-up"
|
46
|
+
"↑"
|
47
|
+
when "forty-five-up"
|
48
|
+
"↗"
|
49
|
+
when "flat"
|
50
|
+
"→"
|
51
|
+
when "forty-five-down"
|
52
|
+
"↘"
|
53
|
+
when "single-down"
|
54
|
+
"↓"
|
55
|
+
when "double-down"
|
56
|
+
"↓↓"
|
57
|
+
else
|
58
|
+
raise StandardError, "Unhandled trend `#{trend}`. This is a bug!"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
40
62
|
# This is parsing out an epoch time from "Date(1709620791000)". It's messy.
|
41
63
|
def timestamp
|
42
64
|
raw_timestamp = @raw_glucose_data["ST"].match(/\d+/)[0]
|