Class: DexcomShareApi::Client
- Inherits:
-
Object
- Object
- DexcomShareApi::Client
- Defined in:
- lib/dexcom_share_api/client.rb
Instance Attribute Summary collapse
-
#dexcom_api ⇒ Object
readonly
Returns the value of attribute dexcom_api.
Instance Method Summary collapse
- #estimated_glucose(last: 10) ⇒ Object
-
#initialize(username:, password:, server:) ⇒ Client
constructor
A new instance of Client.
- #last_estimated_glucose ⇒ Object
Constructor Details
#initialize(username:, password:, server:) ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/dexcom_share_api/client.rb', line 10 def initialize(username:, password:, server:) @dexcom_api ||= HttpApi.new(username:, password:, server:) end |
Instance Attribute Details
#dexcom_api ⇒ Object (readonly)
Returns the value of attribute dexcom_api.
8 9 10 |
# File 'lib/dexcom_share_api/client.rb', line 8 def dexcom_api @dexcom_api end |
Instance Method Details
#estimated_glucose(last: 10) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/dexcom_share_api/client.rb', line 14 def estimated_glucose(last: 10) result = dexcom_api.fetch_estimated_glucose!(last:) result .map { |entry| Glucose.new(entry) } .reverse end |
#last_estimated_glucose ⇒ Object
22 23 24 25 26 |
# File 'lib/dexcom_share_api/client.rb', line 22 def last_estimated_glucose result = dexcom_api.fetch_estimated_glucose!(last: 1) Glucose.new(result[0]) end |