lita-kegbot 0.1.0 → 0.2.0
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/lib/lita/handlers/kegbot.rb +22 -28
- data/lita-kegbot.gemspec +1 -1
- data/locales/en.yml +2 -2
- data/spec/files/drinks.json +219 -29
- data/spec/files/drinks_empty.json +3 -7
- data/spec/files/keg.json +47 -47
- data/spec/files/keg_missing.json +10 -0
- data/spec/files/kegs.json +97 -23
- data/spec/files/kegs_empty.json +3 -2
- data/spec/files/tap.json +27 -19
- data/spec/files/tap_missing.json +10 -0
- data/spec/files/taps.json +55 -23
- data/spec/files/taps_empty.json +3 -3
- data/spec/lita/handlers/kegbot_spec.rb +8 -8
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbe0e8c14e5b7b7a03a5c41d347e047a90c4addb
|
4
|
+
data.tar.gz: 6fc87df5733ba261d0ac1f5cd4f00d71d8d193c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc63abe6ef50aa448ceb159cf86076c05ead14f010dc717486e73194c874b6d5653c4c6f85364d16f2ccf9e35a159d7d42ccfebc18960dc2fe5eba3237790a00
|
7
|
+
data.tar.gz: 05b18f5f48934e07824988d76abc2e4a32fef542fdbd905d9fdc8c29e89cc0f3b3564eabe2374c9620300ed5a6952a144f748a3dc25076fd07daa983755d90a6
|
data/.gitignore
CHANGED
data/lib/lita/handlers/kegbot.rb
CHANGED
@@ -62,12 +62,13 @@ module Lita
|
|
62
62
|
|
63
63
|
def drink_list_all(response)
|
64
64
|
result = api_request('get', 'drinks/')
|
65
|
-
if result && result['
|
66
|
-
drinks = result['
|
65
|
+
if result && result['objects']
|
66
|
+
drinks = result['objects']
|
67
67
|
response.reply(t('drinks.none')) unless drinks.count > 0
|
68
68
|
drinks.each do |drink|
|
69
|
+
session = drink['session']
|
69
70
|
response.reply(t('drinks.info', user: drink['user_id'],
|
70
|
-
date:
|
71
|
+
date: session['start_time']))
|
71
72
|
end
|
72
73
|
else
|
73
74
|
response.reply(t('error.request'))
|
@@ -95,14 +96,11 @@ module Lita
|
|
95
96
|
|
96
97
|
def tap_status_all(response)
|
97
98
|
result = api_request('get', 'taps/')
|
98
|
-
if result && result['
|
99
|
-
taps = result['
|
99
|
+
if result && result['objects']
|
100
|
+
taps = result['objects']
|
100
101
|
response.reply(t('taps.none')) unless taps.count > 0
|
101
102
|
taps.each do |tap|
|
102
|
-
|
103
|
-
response.reply(t('taps.info', id: tap['tap']['id'],
|
104
|
-
desc: tap['keg']['description'],
|
105
|
-
pct: pct))
|
103
|
+
response.reply(t('taps.info', id: tap['id'], name: tap['name']))
|
106
104
|
end
|
107
105
|
else
|
108
106
|
response.reply(t('error.request'))
|
@@ -112,13 +110,9 @@ module Lita
|
|
112
110
|
def tap_status_id(response)
|
113
111
|
id = response.matches[0][0].to_i
|
114
112
|
result = api_request('get', "taps/#{id}")
|
115
|
-
if result && result['
|
116
|
-
tap = result['
|
117
|
-
|
118
|
-
pct = format('%3.2f', (keg['percent_full'] * 100))
|
119
|
-
response.reply(t('taps.info', id: tap['id'],
|
120
|
-
desc: keg['description'],
|
121
|
-
pct: pct))
|
113
|
+
if result && result['object']
|
114
|
+
tap = result['object']
|
115
|
+
response.reply(t('taps.info', id: tap['id'], name: tap['name']))
|
122
116
|
else
|
123
117
|
response.reply(t('error.request'))
|
124
118
|
end
|
@@ -126,15 +120,15 @@ module Lita
|
|
126
120
|
|
127
121
|
def keg_status_all(response)
|
128
122
|
result = api_request('get', 'kegs/')
|
129
|
-
if result && result['
|
130
|
-
kegs = result['
|
123
|
+
if result && result['objects']
|
124
|
+
kegs = result['objects']
|
131
125
|
response.reply(t('kegs.none')) unless kegs.count > 0
|
132
126
|
kegs.each do |keg|
|
133
|
-
|
127
|
+
keg['status'] ? status = 'offline' : status = 'online'
|
134
128
|
response.reply(t('kegs.info', id: keg['id'],
|
135
|
-
|
136
|
-
status:
|
137
|
-
pct:
|
129
|
+
beer: keg['beverage']['name'],
|
130
|
+
status: status,
|
131
|
+
pct: keg['percent_full']))
|
138
132
|
end
|
139
133
|
else
|
140
134
|
response.reply(t('error.request'))
|
@@ -144,13 +138,13 @@ module Lita
|
|
144
138
|
def keg_status_id(response)
|
145
139
|
id = response.matches[0][0].to_i
|
146
140
|
result = api_request('get', "kegs/#{id}")
|
147
|
-
if result && result['
|
148
|
-
keg = result['
|
149
|
-
|
141
|
+
if result && result['object']
|
142
|
+
keg = result['object']
|
143
|
+
keg['status'] ? status = 'offline' : status = 'online'
|
150
144
|
response.reply(t('kegs.info', id: keg['id'],
|
151
|
-
|
152
|
-
status:
|
153
|
-
pct:
|
145
|
+
beer: keg['beverage']['name'],
|
146
|
+
status: status,
|
147
|
+
pct: keg['percent_full']))
|
154
148
|
else
|
155
149
|
response.reply(t('error.request'))
|
156
150
|
end
|
data/lita-kegbot.gemspec
CHANGED
data/locales/en.yml
CHANGED
@@ -34,8 +34,8 @@ en:
|
|
34
34
|
syntax: (kegbot|kb) keg status <id>
|
35
35
|
desc: Shows status of keg <id>
|
36
36
|
kegs:
|
37
|
-
info: "Keg #%{id}: %{
|
37
|
+
info: "Keg #%{id}: %{beer}, status: %{status}, %{pct}% remaining"
|
38
38
|
none: No kegs have been configured
|
39
39
|
taps:
|
40
|
-
info: "Tap #%{id}: %{
|
40
|
+
info: "Tap #%{id}: %{name}"
|
41
41
|
none: No taps have been configured
|
data/spec/files/drinks.json
CHANGED
@@ -1,33 +1,223 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"
|
2
|
+
"objects": [
|
3
|
+
{
|
4
|
+
"volume_ml": 118.294118256447,
|
5
|
+
"user_id": "guest",
|
6
|
+
"url": "/drinks/3",
|
7
|
+
"ticks": 0,
|
8
|
+
"session_id": 1,
|
9
|
+
"keg": {
|
10
|
+
"volume_ml_remain": 58200.72352697421,
|
11
|
+
"full_volume_ml": 58673.9,
|
12
|
+
"served_volume_ml": 473.17647302579,
|
13
|
+
"type_id": "1",
|
14
|
+
"spilled_ml": 0.0,
|
15
|
+
"start_time": "2014-04-14T07:23:01+00:00",
|
16
|
+
"percent_full": 99.19354862549483,
|
17
|
+
"size_id": 0,
|
18
|
+
"size_name": "half-barrel",
|
19
|
+
"beverage": {
|
20
|
+
"abv_percent": 7.5,
|
21
|
+
"style": "India Pale Ale",
|
22
|
+
"beverage_type": "beer",
|
23
|
+
"name": "Racer 5",
|
24
|
+
"producer": {
|
25
|
+
"origin_city": "",
|
26
|
+
"name": "Bear Republic Brewing Co.",
|
27
|
+
"url": "http://www.bearrepublic.com/",
|
28
|
+
"country": "USA",
|
29
|
+
"origin_state": "California",
|
30
|
+
"is_homebrew": false,
|
31
|
+
"id": 1,
|
32
|
+
"description": ""
|
33
|
+
},
|
34
|
+
"untappd_id": "1553",
|
35
|
+
"id": 1
|
36
|
+
},
|
37
|
+
"end_time": "2014-04-14T07:23:01+00:00",
|
38
|
+
"keg_type": "half-barrel",
|
39
|
+
"online": true,
|
40
|
+
"remaining_volume_ml": 58200.72352697421,
|
41
|
+
"spilled_volume_ml": 0.0,
|
42
|
+
"type": {
|
43
|
+
"style_id": "0",
|
44
|
+
"brewer_id": "1",
|
45
|
+
"id": "1",
|
46
|
+
"abv": 7.5,
|
47
|
+
"name": "Racer 5"
|
48
|
+
},
|
49
|
+
"id": 1,
|
50
|
+
"size_volume_ml": 58673.9,
|
51
|
+
"size": {
|
52
|
+
"volume_ml": 58673.9,
|
53
|
+
"id": 0,
|
54
|
+
"name": "half-barrel"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"session": {
|
58
|
+
"name": "",
|
59
|
+
"url": "/sessions/2014/4/14/1/",
|
60
|
+
"start_time": "2014-04-14T07:39:01+00:00",
|
61
|
+
"volume_ml": 473.17647302579,
|
62
|
+
"end_time": "2014-04-14T10:39:15+00:00",
|
63
|
+
"id": 1
|
64
|
+
},
|
65
|
+
"user": {
|
66
|
+
"username": "guest",
|
67
|
+
"url": "/drinkers/guest",
|
68
|
+
"is_active": true
|
69
|
+
},
|
70
|
+
"time": "2014-04-14T07:39:15+00:00",
|
71
|
+
"duration": 0,
|
72
|
+
"keg_id": 1,
|
73
|
+
"id": 3
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"volume_ml": 118.294118256447,
|
77
|
+
"user_id": "esigler",
|
78
|
+
"url": "/drinks/2",
|
79
|
+
"ticks": 0,
|
80
|
+
"session_id": 1,
|
81
|
+
"keg": {
|
82
|
+
"volume_ml_remain": 58200.72352697421,
|
83
|
+
"full_volume_ml": 58673.9,
|
84
|
+
"served_volume_ml": 473.17647302579,
|
85
|
+
"type_id": "1",
|
86
|
+
"spilled_ml": 0.0,
|
87
|
+
"start_time": "2014-04-14T07:23:01+00:00",
|
88
|
+
"percent_full": 99.19354862549483,
|
89
|
+
"size_id": 0,
|
90
|
+
"size_name": "half-barrel",
|
91
|
+
"beverage": {
|
92
|
+
"abv_percent": 7.5,
|
93
|
+
"style": "India Pale Ale",
|
94
|
+
"beverage_type": "beer",
|
95
|
+
"name": "Racer 5",
|
96
|
+
"producer": {
|
97
|
+
"origin_city": "",
|
98
|
+
"name": "Bear Republic Brewing Co.",
|
99
|
+
"url": "http://www.bearrepublic.com/",
|
100
|
+
"country": "USA",
|
101
|
+
"origin_state": "California",
|
102
|
+
"is_homebrew": false,
|
103
|
+
"id": 1,
|
104
|
+
"description": ""
|
105
|
+
},
|
106
|
+
"untappd_id": "1553",
|
107
|
+
"id": 1
|
108
|
+
},
|
109
|
+
"end_time": "2014-04-14T07:23:01+00:00",
|
110
|
+
"keg_type": "half-barrel",
|
111
|
+
"online": true,
|
112
|
+
"remaining_volume_ml": 58200.72352697421,
|
113
|
+
"spilled_volume_ml": 0.0,
|
114
|
+
"type": {
|
115
|
+
"style_id": "0",
|
116
|
+
"brewer_id": "1",
|
117
|
+
"id": "1",
|
118
|
+
"abv": 7.5,
|
119
|
+
"name": "Racer 5"
|
120
|
+
},
|
121
|
+
"id": 1,
|
122
|
+
"size_volume_ml": 58673.9,
|
123
|
+
"size": {
|
124
|
+
"volume_ml": 58673.9,
|
125
|
+
"id": 0,
|
126
|
+
"name": "half-barrel"
|
127
|
+
}
|
128
|
+
},
|
129
|
+
"session": {
|
130
|
+
"name": "",
|
131
|
+
"url": "/sessions/2014/4/14/1/",
|
132
|
+
"start_time": "2014-04-14T07:39:01+00:00",
|
133
|
+
"volume_ml": 473.17647302579,
|
134
|
+
"end_time": "2014-04-14T10:39:15+00:00",
|
135
|
+
"id": 1
|
136
|
+
},
|
137
|
+
"user": {
|
138
|
+
"username": "esigler",
|
139
|
+
"url": "/drinkers/esigler",
|
140
|
+
"is_active": true
|
141
|
+
},
|
142
|
+
"time": "2014-04-14T07:39:11+00:00",
|
143
|
+
"duration": 0,
|
144
|
+
"keg_id": 1,
|
145
|
+
"id": 2
|
7
146
|
},
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
|
20
|
-
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
147
|
+
{
|
148
|
+
"volume_ml": 236.588236512895,
|
149
|
+
"user_id": "esigler",
|
150
|
+
"url": "/drinks/1",
|
151
|
+
"ticks": 0,
|
152
|
+
"session_id": 1,
|
153
|
+
"keg": {
|
154
|
+
"volume_ml_remain": 58200.72352697421,
|
155
|
+
"full_volume_ml": 58673.9,
|
156
|
+
"served_volume_ml": 473.17647302579,
|
157
|
+
"type_id": "1",
|
158
|
+
"spilled_ml": 0.0,
|
159
|
+
"start_time": "2014-04-14T07:23:01+00:00",
|
160
|
+
"percent_full": 99.19354862549483,
|
161
|
+
"size_id": 0,
|
162
|
+
"size_name": "half-barrel",
|
163
|
+
"beverage": {
|
164
|
+
"abv_percent": 7.5,
|
165
|
+
"style": "India Pale Ale",
|
166
|
+
"beverage_type": "beer",
|
167
|
+
"name": "Racer 5",
|
168
|
+
"producer": {
|
169
|
+
"origin_city": "",
|
170
|
+
"name": "Bear Republic Brewing Co.",
|
171
|
+
"url": "http://www.bearrepublic.com/",
|
172
|
+
"country": "USA",
|
173
|
+
"origin_state": "California",
|
174
|
+
"is_homebrew": false,
|
175
|
+
"id": 1,
|
176
|
+
"description": ""
|
177
|
+
},
|
178
|
+
"untappd_id": "1553",
|
179
|
+
"id": 1
|
180
|
+
},
|
181
|
+
"end_time": "2014-04-14T07:23:01+00:00",
|
182
|
+
"keg_type": "half-barrel",
|
183
|
+
"online": true,
|
184
|
+
"remaining_volume_ml": 58200.72352697421,
|
185
|
+
"spilled_volume_ml": 0.0,
|
186
|
+
"type": {
|
187
|
+
"style_id": "0",
|
188
|
+
"brewer_id": "1",
|
189
|
+
"id": "1",
|
190
|
+
"abv": 7.5,
|
191
|
+
"name": "Racer 5"
|
192
|
+
},
|
193
|
+
"id": 1,
|
194
|
+
"size_volume_ml": 58673.9,
|
195
|
+
"size": {
|
196
|
+
"volume_ml": 58673.9,
|
197
|
+
"id": 0,
|
198
|
+
"name": "half-barrel"
|
199
|
+
}
|
200
|
+
},
|
201
|
+
"session": {
|
202
|
+
"name": "",
|
203
|
+
"url": "/sessions/2014/4/14/1/",
|
204
|
+
"start_time": "2014-04-14T07:39:01+00:00",
|
205
|
+
"volume_ml": 473.17647302579,
|
206
|
+
"end_time": "2014-04-14T10:39:15+00:00",
|
207
|
+
"id": 1
|
208
|
+
},
|
209
|
+
"user": {
|
210
|
+
"username": "esigler",
|
211
|
+
"url": "/drinkers/esigler",
|
212
|
+
"is_active": true
|
213
|
+
},
|
214
|
+
"time": "2014-04-14T07:39:01+00:00",
|
215
|
+
"duration": 0,
|
216
|
+
"keg_id": 1,
|
217
|
+
"id": 1
|
218
|
+
}
|
219
|
+
],
|
220
|
+
"meta": {
|
221
|
+
"result": "ok"
|
32
222
|
}
|
33
223
|
}
|
data/spec/files/keg.json
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
"object": {
|
3
|
+
"volume_ml_remain": 58673.9,
|
4
|
+
"full_volume_ml": 58673.9,
|
5
|
+
"served_volume_ml": 0.0,
|
6
|
+
"type_id": "1",
|
7
|
+
"spilled_ml": 0.0,
|
8
|
+
"start_time": "2014-04-14T07:23:01+00:00",
|
9
|
+
"percent_full": 100.0,
|
10
|
+
"size_id": 0,
|
11
|
+
"size_name": "half-barrel",
|
12
|
+
"beverage": {
|
13
|
+
"abv_percent": 7.5,
|
14
|
+
"style": "India Pale Ale",
|
15
|
+
"beverage_type": "beer",
|
16
|
+
"name": "Racer 5",
|
17
|
+
"producer": {
|
18
|
+
"origin_city": "",
|
19
|
+
"name": "Bear Republic Brewing Co.",
|
20
|
+
"url": "http://www.bearrepublic.com/",
|
21
|
+
"country": "USA",
|
22
|
+
"origin_state": "California",
|
23
|
+
"is_homebrew": false,
|
24
|
+
"id": 1,
|
25
|
+
"description": ""
|
26
|
+
},
|
27
|
+
"untappd_id": "1553",
|
28
|
+
"id": 1
|
13
29
|
},
|
30
|
+
"end_time": "2014-04-14T07:23:01+00:00",
|
31
|
+
"keg_type": "half-barrel",
|
32
|
+
"online": true,
|
33
|
+
"remaining_volume_ml": 58673.9,
|
34
|
+
"spilled_volume_ml": 0.0,
|
14
35
|
"type": {
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"abv": 7.
|
19
|
-
"
|
20
|
-
"id": "50ad52bc-35fb-4441-a5bf-f56a55608057"
|
36
|
+
"style_id": "0",
|
37
|
+
"brewer_id": "1",
|
38
|
+
"id": "1",
|
39
|
+
"abv": 7.5,
|
40
|
+
"name": "Racer 5"
|
21
41
|
},
|
42
|
+
"id": 1,
|
43
|
+
"size_volume_ml": 58673.9,
|
22
44
|
"size": {
|
23
|
-
"volume_ml": 58673.
|
24
|
-
"id":
|
25
|
-
"name": "
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"user_id": "scarfjerk",
|
31
|
-
"ticks": 150,
|
32
|
-
"session_id": "390",
|
33
|
-
"is_valid": true,
|
34
|
-
"pour_time": "2009-10-17T19:34:06",
|
35
|
-
"duration": 7,
|
36
|
-
"keg_id": 13,
|
37
|
-
"id": 2054
|
38
|
-
},
|
39
|
-
{
|
40
|
-
"volume_ml": 441.63137438000001,
|
41
|
-
"user_id": null,
|
42
|
-
"ticks": 1190,
|
43
|
-
"session_id": "390",
|
44
|
-
"is_valid": true,
|
45
|
-
"user": null,
|
46
|
-
"pour_time": "2009-10-17T19:02:55",
|
47
|
-
"duration": 11,
|
48
|
-
"keg_id": 13,
|
49
|
-
"id": 2053
|
50
|
-
}
|
51
|
-
]
|
45
|
+
"volume_ml": 58673.9,
|
46
|
+
"id": 0,
|
47
|
+
"name": "half-barrel"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"meta": {
|
51
|
+
"result": "ok"
|
52
52
|
}
|
53
|
-
}
|
53
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"meta": {
|
3
|
+
"result": "error"
|
4
|
+
},
|
5
|
+
"error": {
|
6
|
+
"message": "No Keg matches the given query.",
|
7
|
+
"code": "NotFoundError",
|
8
|
+
"traceback": "Traceback (most recent call last):\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/django/core/handlers/base.py\", line 114, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/pykeg/web/api/views.py\", line 261, in get_keg\n keg = get_object_or_404(models.Keg, id=keg_id)\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/django/shortcuts/__init__.py\", line 115, in get_object_or_404\n raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)\nHttp404: No Keg matches the given query.\n"
|
9
|
+
}
|
10
|
+
}
|
data/spec/files/kegs.json
CHANGED
@@ -1,28 +1,102 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
"objects": [
|
3
|
+
{
|
4
|
+
"volume_ml_remain": 58673.9,
|
5
|
+
"full_volume_ml": 58673.9,
|
6
|
+
"served_volume_ml": 0.0,
|
7
|
+
"type_id": "2",
|
8
|
+
"spilled_ml": 0.0,
|
9
|
+
"start_time": "2014-04-14T07:28:38+00:00",
|
10
|
+
"percent_full": 100.0,
|
11
|
+
"size_id": 0,
|
12
|
+
"size_name": "half-barrel",
|
13
|
+
"beverage": {
|
14
|
+
"abv_percent": 9.0,
|
15
|
+
"style": "India Pale Ale",
|
16
|
+
"beverage_type": "beer",
|
17
|
+
"name": "90 Minute IPA",
|
18
|
+
"producer": {
|
19
|
+
"origin_city": "Milton",
|
20
|
+
"name": "Dogfish Head Craft Brewery",
|
21
|
+
"url": "http://www.dogfish.com/",
|
22
|
+
"country": "USA",
|
23
|
+
"origin_state": "Delaware",
|
24
|
+
"is_homebrew": false,
|
25
|
+
"id": 2,
|
26
|
+
"description": ""
|
27
|
+
},
|
28
|
+
"id": 2
|
14
29
|
},
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
30
|
+
"end_time": "2014-04-14T07:28:38+00:00",
|
31
|
+
"keg_type": "half-barrel",
|
32
|
+
"online": true,
|
33
|
+
"remaining_volume_ml": 58673.9,
|
34
|
+
"spilled_volume_ml": 0.0,
|
35
|
+
"type": {
|
36
|
+
"style_id": "0",
|
37
|
+
"brewer_id": "2",
|
38
|
+
"id": "2",
|
39
|
+
"abv": 9.0,
|
40
|
+
"name": "90 Minute IPA"
|
41
|
+
},
|
42
|
+
"id": 2,
|
43
|
+
"size_volume_ml": 58673.9,
|
44
|
+
"size": {
|
45
|
+
"volume_ml": 58673.9,
|
46
|
+
"id": 0,
|
47
|
+
"name": "half-barrel"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"volume_ml_remain": 58673.9,
|
52
|
+
"full_volume_ml": 58673.9,
|
53
|
+
"served_volume_ml": 0.0,
|
54
|
+
"type_id": "1",
|
55
|
+
"spilled_ml": 0.0,
|
56
|
+
"start_time": "2014-04-14T07:23:01+00:00",
|
57
|
+
"percent_full": 100.0,
|
58
|
+
"size_id": 0,
|
59
|
+
"size_name": "half-barrel",
|
60
|
+
"beverage": {
|
61
|
+
"abv_percent": 7.5,
|
62
|
+
"style": "India Pale Ale",
|
63
|
+
"beverage_type": "beer",
|
64
|
+
"name": "Racer 5",
|
65
|
+
"producer": {
|
66
|
+
"origin_city": "",
|
67
|
+
"name": "Bear Republic Brewing Co.",
|
68
|
+
"url": "http://www.bearrepublic.com/",
|
69
|
+
"country": "USA",
|
70
|
+
"origin_state": "California",
|
71
|
+
"is_homebrew": false,
|
72
|
+
"id": 1,
|
73
|
+
"description": ""
|
74
|
+
},
|
75
|
+
"untappd_id": "1553",
|
76
|
+
"id": 1
|
77
|
+
},
|
78
|
+
"end_time": "2014-04-14T07:23:01+00:00",
|
79
|
+
"keg_type": "half-barrel",
|
80
|
+
"online": true,
|
81
|
+
"remaining_volume_ml": 58673.9,
|
82
|
+
"spilled_volume_ml": 0.0,
|
83
|
+
"type": {
|
84
|
+
"style_id": "0",
|
85
|
+
"brewer_id": "1",
|
86
|
+
"id": "1",
|
87
|
+
"abv": 7.5,
|
88
|
+
"name": "Racer 5"
|
89
|
+
},
|
90
|
+
"id": 1,
|
91
|
+
"size_volume_ml": 58673.9,
|
92
|
+
"size": {
|
93
|
+
"volume_ml": 58673.9,
|
94
|
+
"id": 0,
|
95
|
+
"name": "half-barrel"
|
25
96
|
}
|
26
|
-
|
97
|
+
}
|
98
|
+
],
|
99
|
+
"meta": {
|
100
|
+
"result": "ok"
|
27
101
|
}
|
28
102
|
}
|
data/spec/files/kegs_empty.json
CHANGED
data/spec/files/tap.json
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"
|
9
|
-
"
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
"object": {
|
3
|
+
"meter_name": "kegboard.flow0",
|
4
|
+
"name": "Main Tap",
|
5
|
+
"ml_per_tick": 0.18518518518518517,
|
6
|
+
"relay_name": "kegboard.relay0",
|
7
|
+
"meter": {
|
8
|
+
"ticks_per_ml": 5.4,
|
9
|
+
"controller": {
|
10
|
+
"id": 1,
|
11
|
+
"name": "kegboard"
|
12
|
+
},
|
13
|
+
"port_name": "flow0",
|
14
|
+
"id": 1,
|
15
|
+
"name": "kegboard.flow0"
|
13
16
|
},
|
14
|
-
"
|
15
|
-
"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
"
|
20
|
-
"id":
|
21
|
-
|
17
|
+
"toggle": {
|
18
|
+
"controller": {
|
19
|
+
"id": 1,
|
20
|
+
"name": "kegboard"
|
21
|
+
},
|
22
|
+
"port_name": "relay0",
|
23
|
+
"id": 1,
|
24
|
+
"name": "kegboard.relay0"
|
25
|
+
},
|
26
|
+
"id": 1
|
27
|
+
},
|
28
|
+
"meta": {
|
29
|
+
"result": "ok"
|
22
30
|
}
|
23
31
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"meta": {
|
3
|
+
"result": "error"
|
4
|
+
},
|
5
|
+
"error": {
|
6
|
+
"message": "KegTap matching query does not exist.",
|
7
|
+
"code": "NotFoundError",
|
8
|
+
"traceback": "Traceback (most recent call last):\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/django/core/handlers/base.py\", line 114, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/django/views/decorators/csrf.py\", line 57, in wrapped_view\n return view_func(*args, **kwargs)\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/pykeg/web/api/views.py\", line 462, in tap_detail\n tap = get_tap_from_meter_name_or_404(meter_name_or_id)\n File \"/home/ubuntu/kb/local/lib/python2.7/site-packages/pykeg/web/api/views.py\", line 684, in get_tap_from_meter_name_or_404\n raise Http404(str(e))\nHttp404: KegTap matching query does not exist.\n"
|
9
|
+
}
|
10
|
+
}
|
data/spec/files/taps.json
CHANGED
@@ -1,27 +1,59 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"percent_full": 0.0051001891001911156,
|
14
|
-
"id": 17
|
2
|
+
"objects": [
|
3
|
+
{
|
4
|
+
"meter_name": "kegboard.flow0",
|
5
|
+
"name": "Main Tap",
|
6
|
+
"ml_per_tick": 0.18518518518518517,
|
7
|
+
"relay_name": "kegboard.relay0",
|
8
|
+
"meter": {
|
9
|
+
"ticks_per_ml": 5.4,
|
10
|
+
"controller": {
|
11
|
+
"id": 1,
|
12
|
+
"name": "kegboard"
|
15
13
|
},
|
16
|
-
"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"id":
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
"port_name": "flow0",
|
15
|
+
"id": 1,
|
16
|
+
"name": "kegboard.flow0"
|
17
|
+
},
|
18
|
+
"toggle": {
|
19
|
+
"controller": {
|
20
|
+
"id": 1,
|
21
|
+
"name": "kegboard"
|
22
|
+
},
|
23
|
+
"port_name": "relay0",
|
24
|
+
"id": 1,
|
25
|
+
"name": "kegboard.relay0"
|
26
|
+
},
|
27
|
+
"id": 1
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"meter_name": "kegboard.flow1",
|
31
|
+
"name": "Second Tap",
|
32
|
+
"ml_per_tick": 0.18518518518518517,
|
33
|
+
"relay_name": "kegboard.relay1",
|
34
|
+
"meter": {
|
35
|
+
"ticks_per_ml": 5.4,
|
36
|
+
"controller": {
|
37
|
+
"id": 1,
|
38
|
+
"name": "kegboard"
|
39
|
+
},
|
40
|
+
"port_name": "flow1",
|
41
|
+
"id": 2,
|
42
|
+
"name": "kegboard.flow1"
|
43
|
+
},
|
44
|
+
"toggle": {
|
45
|
+
"controller": {
|
46
|
+
"id": 1,
|
47
|
+
"name": "kegboard"
|
48
|
+
},
|
49
|
+
"port_name": "relay1",
|
50
|
+
"id": 2,
|
51
|
+
"name": "kegboard.relay1"
|
52
|
+
},
|
53
|
+
"id": 2
|
54
|
+
}
|
55
|
+
],
|
56
|
+
"meta": {
|
57
|
+
"result": "ok"
|
26
58
|
}
|
27
59
|
}
|
data/spec/files/taps_empty.json
CHANGED
@@ -83,8 +83,8 @@ describe Lita::Handlers::Kegbot, lita_handler: true do
|
|
83
83
|
it 'shows a list of drinks if there are any' do
|
84
84
|
grab_request('get', 200, drinks)
|
85
85
|
send_command('kegbot drink list')
|
86
|
-
expect(replies.last).to eq('
|
87
|
-
'
|
86
|
+
expect(replies.last).to eq('esigler poured a glass at ' \
|
87
|
+
'2014-04-14T07:39:01+00:00')
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'shows an empty list if there arent any' do
|
@@ -118,7 +118,7 @@ describe Lita::Handlers::Kegbot, lita_handler: true do
|
|
118
118
|
it 'shows the status of all of the taps if there are any' do
|
119
119
|
grab_request('get', 200, taps)
|
120
120
|
send_command('kegbot tap status')
|
121
|
-
expect(replies.last).to eq('Tap #
|
121
|
+
expect(replies.last).to eq('Tap #2: Second Tap')
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'shows an empty list if there arent any' do
|
@@ -138,7 +138,7 @@ describe Lita::Handlers::Kegbot, lita_handler: true do
|
|
138
138
|
it 'shows the status of a specific tap' do
|
139
139
|
grab_request('get', 200, tap)
|
140
140
|
send_command('kegbot tap status 1')
|
141
|
-
expect(replies.last).to eq('Tap #1:
|
141
|
+
expect(replies.last).to eq('Tap #1: Main Tap')
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'shows a warning if that tap does not exist' do
|
@@ -158,8 +158,8 @@ describe Lita::Handlers::Kegbot, lita_handler: true do
|
|
158
158
|
it 'shows the status of all of the kegs if there are any' do
|
159
159
|
grab_request('get', 200, kegs)
|
160
160
|
send_command('kegbot keg status')
|
161
|
-
expect(replies.last).to eq('Keg #
|
162
|
-
'
|
161
|
+
expect(replies.last).to eq('Keg #1: Racer 5, status: online, 100.0% ' \
|
162
|
+
'remaining')
|
163
163
|
end
|
164
164
|
|
165
165
|
it 'shows an empty list if there arent any' do
|
@@ -179,8 +179,8 @@ describe Lita::Handlers::Kegbot, lita_handler: true do
|
|
179
179
|
it 'shows the status of a specific keg' do
|
180
180
|
grab_request('get', 200, keg)
|
181
181
|
send_command('kegbot keg status 1')
|
182
|
-
expect(replies.last).to eq('Keg #
|
183
|
-
'
|
182
|
+
expect(replies.last).to eq('Keg #1: Racer 5, status: online, 100.0% ' \
|
183
|
+
'remaining')
|
184
184
|
end
|
185
185
|
|
186
186
|
it 'shows a warning if that keg does not exist' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-kegbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Sigler
|
@@ -129,9 +129,11 @@ files:
|
|
129
129
|
- spec/files/drinks.json
|
130
130
|
- spec/files/drinks_empty.json
|
131
131
|
- spec/files/keg.json
|
132
|
+
- spec/files/keg_missing.json
|
132
133
|
- spec/files/kegs.json
|
133
134
|
- spec/files/kegs_empty.json
|
134
135
|
- spec/files/tap.json
|
136
|
+
- spec/files/tap_missing.json
|
135
137
|
- spec/files/taps.json
|
136
138
|
- spec/files/taps_empty.json
|
137
139
|
- spec/lita/handlers/kegbot_spec.rb
|
@@ -165,9 +167,11 @@ test_files:
|
|
165
167
|
- spec/files/drinks.json
|
166
168
|
- spec/files/drinks_empty.json
|
167
169
|
- spec/files/keg.json
|
170
|
+
- spec/files/keg_missing.json
|
168
171
|
- spec/files/kegs.json
|
169
172
|
- spec/files/kegs_empty.json
|
170
173
|
- spec/files/tap.json
|
174
|
+
- spec/files/tap_missing.json
|
171
175
|
- spec/files/taps.json
|
172
176
|
- spec/files/taps_empty.json
|
173
177
|
- spec/lita/handlers/kegbot_spec.rb
|