lita-diabetter 1.2.6 → 1.3.0.alpha.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/lita/handlers/diabetter.rb +26 -1
- data/lita-diabetter.gemspec +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0855de08cc21389d6ccfaa64a46a869df3550806
|
4
|
+
data.tar.gz: 371fc412de4044a37ab4c7bc7319e683802fedba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a38f5924556f1c3fd2dd5005685dd5c4c9c34b7811d0936b8ced0a23d3f70c47496ddc176f07820c878c82920b1642ec395e6bca1f1c97ba5ae6b1c124b39624
|
7
|
+
data.tar.gz: 924cfd79a40b2e5ef202165ad8169b507f807289fc1b10b5452c696f16d1ca8c2ecb2b603466e99a1d51940ca62b4613932aa89507560212b3ec16818604deeb
|
data/.gitignore
CHANGED
@@ -6,10 +6,19 @@ module Lita
|
|
6
6
|
@@upper = 50.0 # Upper limit for mmol/L - mg/dL cutoff
|
7
7
|
|
8
8
|
route(/(?:^|_)(\d{1,3}|\d{1,2}\.\d+)(?:$|_)/, :convert, command: false, help: {
|
9
|
-
'<number>' => 'Convert glucose between mass/molar concentration units.',
|
9
|
+
'<number>' => 'Convert glucose between mass/molar concentration units. Attempts to guess which way you want to convert',
|
10
10
|
'_<number>_' => 'Convert glucose between mass/molar concentration units inline. E.g "I started at _125_ today"'
|
11
11
|
})
|
12
12
|
|
13
|
+
route(/(\d{1,3}\.?\d?)\s?(mmol\/?l?)/i, :convert_mmol, command: false, help: {
|
14
|
+
'<number> mmol' => 'Convert glucose from mmol/L to mg/dL, works inline or on its own. E.g "My BG is 5.7 mmol/L"'
|
15
|
+
})
|
16
|
+
|
17
|
+
route(/(\d{1,3}\.?\d?)\s?(mg\/?(dl)?)/i, :convert_mgdl, command: false, help: {
|
18
|
+
'<number> mgdl' => 'Convert glucose from mg/dL to mmol/L, works inline or on its own. E.g "My BG is 110 mg/dL"'
|
19
|
+
})
|
20
|
+
|
21
|
+
|
13
22
|
route(/estimate a1c(?: from average)?\s+(\d{1,3}|\d{1,2}\.\d+)$/i, :estimate_a1c, command: true, help: {
|
14
23
|
'estimate a1c [from average] <glucose level>' => 'Estimates A1C based on average BG level'
|
15
24
|
})
|
@@ -40,6 +49,22 @@ module Lita
|
|
40
49
|
end
|
41
50
|
end
|
42
51
|
|
52
|
+
def convert_mmol(response)
|
53
|
+
if response.message.body.match(URI.regexp(%w(http https))).nil?
|
54
|
+
input = response.matches[0][0]
|
55
|
+
Lita.logger.debug('Converting BG for input "' + input + '" from mmol/L to mg/dL')
|
56
|
+
response.reply("#{input} mmol/L is #{mmol_to_mgdl(input).to_s} mg/dL")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def convert_mgdl(response)
|
61
|
+
if response.message.body.match(URI.regexp(%w(http https))).nil?
|
62
|
+
input = response.matches[0][0]
|
63
|
+
Lita.logger.debug('Converting BG for input "' + input + '" from mg/dL to mmol/L')
|
64
|
+
response.reply("#{input} mg/dL is #{mgdl_to_mmol(input).to_s} mmol/L")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
43
68
|
def estimate_a1c(response)
|
44
69
|
input = response.matches[0][0]
|
45
70
|
Lita.logger.debug('Estimating a1c for input "' + input + '"')
|
data/lita-diabetter.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-diabetter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.alpha.87
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cas Eliëns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -104,7 +104,6 @@ files:
|
|
104
104
|
- ".gitignore"
|
105
105
|
- ".travis.yml"
|
106
106
|
- Gemfile
|
107
|
-
- Gemfile.lock
|
108
107
|
- README.md
|
109
108
|
- Rakefile
|
110
109
|
- lib/lita-diabetter.rb
|
@@ -131,9 +130,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
130
|
version: 2.0.0
|
132
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
132
|
requirements:
|
134
|
-
- - "
|
133
|
+
- - ">"
|
135
134
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
135
|
+
version: 1.3.1
|
137
136
|
requirements: []
|
138
137
|
rubyforge_project:
|
139
138
|
rubygems_version: 2.4.5
|
data/Gemfile.lock
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
lita-diabetter (1.2.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
byebug (9.0.6)
|
10
|
-
coderay (1.1.1)
|
11
|
-
diff-lcs (1.2.5)
|
12
|
-
faraday (0.10.1)
|
13
|
-
multipart-post (>= 1.2, < 3)
|
14
|
-
http_router (0.11.2)
|
15
|
-
rack (>= 1.0.0)
|
16
|
-
url_mount (~> 0.2.1)
|
17
|
-
i18n (0.7.0)
|
18
|
-
ice_nine (0.11.2)
|
19
|
-
lita (4.7.1)
|
20
|
-
bundler (>= 1.3)
|
21
|
-
faraday (>= 0.8.7)
|
22
|
-
http_router (>= 0.11.2)
|
23
|
-
i18n (>= 0.6.9)
|
24
|
-
ice_nine (>= 0.11.0)
|
25
|
-
multi_json (>= 1.7.7)
|
26
|
-
puma (>= 2.7.1)
|
27
|
-
rack (>= 1.5.2, < 2.0.0)
|
28
|
-
rb-readline (>= 0.5.1)
|
29
|
-
redis-namespace (>= 1.3.0)
|
30
|
-
thor (>= 0.18.1)
|
31
|
-
method_source (0.8.2)
|
32
|
-
multi_json (1.12.1)
|
33
|
-
multipart-post (2.0.0)
|
34
|
-
pry (0.10.4)
|
35
|
-
coderay (~> 1.1.0)
|
36
|
-
method_source (~> 0.8.1)
|
37
|
-
slop (~> 3.4)
|
38
|
-
pry-byebug (3.4.2)
|
39
|
-
byebug (~> 9.0)
|
40
|
-
pry (~> 0.10)
|
41
|
-
puma (3.6.2)
|
42
|
-
rack (1.6.5)
|
43
|
-
rack-test (0.6.3)
|
44
|
-
rack (>= 1.0)
|
45
|
-
rake (10.4.2)
|
46
|
-
rb-readline (0.5.3)
|
47
|
-
redis (3.3.2)
|
48
|
-
redis-namespace (1.5.2)
|
49
|
-
redis (~> 3.0, >= 3.0.4)
|
50
|
-
rspec (3.0.0)
|
51
|
-
rspec-core (~> 3.0.0)
|
52
|
-
rspec-expectations (~> 3.0.0)
|
53
|
-
rspec-mocks (~> 3.0.0)
|
54
|
-
rspec-core (3.0.4)
|
55
|
-
rspec-support (~> 3.0.0)
|
56
|
-
rspec-expectations (3.0.4)
|
57
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
-
rspec-support (~> 3.0.0)
|
59
|
-
rspec-mocks (3.0.4)
|
60
|
-
rspec-support (~> 3.0.0)
|
61
|
-
rspec-support (3.0.4)
|
62
|
-
slop (3.6.0)
|
63
|
-
thor (0.19.4)
|
64
|
-
url_mount (0.2.1)
|
65
|
-
rack
|
66
|
-
|
67
|
-
PLATFORMS
|
68
|
-
x64-mingw32
|
69
|
-
|
70
|
-
DEPENDENCIES
|
71
|
-
bundler (~> 1.3)
|
72
|
-
lita (~> 4.7)
|
73
|
-
lita-diabetter!
|
74
|
-
pry-byebug
|
75
|
-
rack-test
|
76
|
-
rake (~> 10.4.2)
|
77
|
-
rspec (~> 3.0.0)
|
78
|
-
|
79
|
-
BUNDLED WITH
|
80
|
-
1.13.7
|