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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40943264dd61ec2ce957a1617899581d73f2a66f2d088a601aae0a0dd1180b52
4
- data.tar.gz: aa10acce28d4aab248794f10f686b1e70ea6c1d852b941c370fb50d36302bd08
3
+ metadata.gz: '02559e1ff1a0ec536843a88cf8b9f09fe1f2883e0539d132e0b6060c570b1c7f'
4
+ data.tar.gz: 0cbd050a073de77dc8682af9ead70733f4dc483847f4355647977dd84a1d6109
5
5
  SHA512:
6
- metadata.gz: 02ecbe4de4148b9bbd39706f861fa17847bb35c7ca3c3fc2e2ef35834dd97701c59f4683b343ec14466e4536fddac8472bce05c1f0435b461ca3dfb6d4644daa
7
- data.tar.gz: b9c8f474f03ea7c342da6193475567ebbbd81d5e2928743bf148c1c4104ee9db84b0c941e1b2bc694d2774b8be6adc4b58908da8a7f0afcb0c868f6dfef092a9
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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DexcomShareApi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dexcom_share_api
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
  - Elliot Dohm