lita-kegbot 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 2d74d86f47568b6cb26fcf32d1b250235c3c44bf
4
- data.tar.gz: 1d7dd6489c04d0c019c7afeea3d51e00a1cc0a57
3
+ metadata.gz: dbe0e8c14e5b7b7a03a5c41d347e047a90c4addb
4
+ data.tar.gz: 6fc87df5733ba261d0ac1f5cd4f00d71d8d193c5
5
5
  SHA512:
6
- metadata.gz: 9515ff91fa64205be86cb7034b91f93d8ef26b0e8b648cbf3840237742da40d2cd250dba87eadba053078b91d85a2d48c7cb8bc83b3326cd4f2a13d4bb0f444b
7
- data.tar.gz: 91f8be5a3e132ba2c9c90e0a3cfa37d1a80bd093e6ce3750081f6ee7473696ea376525a4dc3ab221eb2a73a29f9f7fe75bb4d3889d21da1a24def886e81ee214
6
+ metadata.gz: cc63abe6ef50aa448ceb159cf86076c05ead14f010dc717486e73194c874b6d5653c4c6f85364d16f2ccf9e35a159d7d42ccfebc18960dc2fe5eba3237790a00
7
+ data.tar.gz: 05b18f5f48934e07824988d76abc2e4a32fef542fdbd905d9fdc8c29e89cc0f3b3564eabe2374c9620300ed5a6952a144f748a3dc25076fd07daa983755d90a6
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.swp
3
4
  .bundle
4
5
  .config
5
6
  .yardoc
@@ -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['result'] && result['result']['drinks']
66
- drinks = result['result']['drinks']
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: drink['pour_time']))
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['result'] && result['result']['taps']
99
- taps = result['result']['taps']
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
- pct = format('%3.2f', (tap['keg']['percent_full'] * 100))
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['result'] && result['result']['tap']
116
- tap = result['result']['tap']
117
- keg = result['result']['keg']
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['result'] && result['result']['kegs']
130
- kegs = result['result']['kegs']
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
- pct = format('%3.2f', (keg['percent_full'] * 100))
127
+ keg['status'] ? status = 'offline' : status = 'online'
134
128
  response.reply(t('kegs.info', id: keg['id'],
135
- desc: keg['description'],
136
- status: keg['status'],
137
- pct: 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['result'] && result['result']['keg']
148
- keg = result['result']['keg']
149
- pct = format('%3.2f', (keg['percent_full'] * 100))
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
- desc: keg['description'],
152
- status: keg['status'],
153
- pct: 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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-kegbot'
3
- spec.version = '0.1.0'
3
+ spec.version = '0.2.0'
4
4
  spec.authors = ['Eric Sigler']
5
5
  spec.email = ['me@esigler.com']
6
6
  spec.description = %q{A Kegbot handler for Lita.io}
@@ -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}: %{desc}, status: %{status}, %{pct}% remaining"
37
+ info: "Keg #%{id}: %{beer}, status: %{status}, %{pct}% remaining"
38
38
  none: No kegs have been configured
39
39
  taps:
40
- info: "Tap #%{id}: %{desc}, %{pct}% remaining"
40
+ info: "Tap #%{id}: %{name}"
41
41
  none: No taps have been configured
@@ -1,33 +1,223 @@
1
1
  {
2
- "result": {
3
- "paging": {
4
- "total": 2716,
5
- "limit": 100,
6
- "pos": 2000
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
- "drinks": [
9
- {
10
- "volume_ml": 490.24793744200002,
11
- "user_id": "capn",
12
- "ticks": 1321,
13
- "session_id": "386",
14
- "is_valid": true,
15
- "pour_time": "2009-10-03T17:13:16",
16
- "duration": 15,
17
- "keg_id": 13,
18
- "id": 2000
19
- },
20
- {
21
- "volume_ml": 451.651582034,
22
- "user_id": "boysdontcall",
23
- "ticks": 1217,
24
- "session_id": "386",
25
- "is_valid": true,
26
- "pour_time": "2009-10-03T17:12:27",
27
- "duration": 14,
28
- "keg_id": 13,
29
- "id": 1999
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
  }
@@ -1,10 +1,6 @@
1
1
  {
2
- "result": {
3
- "paging": {
4
- "total": 2716,
5
- "limit": 100,
6
- "pos": 2000
7
- },
8
- "drinks": []
2
+ "objects": [],
3
+ "meta": {
4
+ "result": "ok"
9
5
  }
10
6
  }
@@ -1,53 +1,53 @@
1
1
  {
2
- "result": {
3
- "keg": {
4
- "status": "offline",
5
- "volume_ml_remain": 590.74554188041657,
6
- "finished_time": "2009-10-17T19:34:06",
7
- "description": "Racer 5",
8
- "type_id": "50ad52bc-35fb-4441-a5bf-f56a55608057",
9
- "started_time": "2009-09-06T14:46:00",
10
- "size_id": 1,
11
- "percent_full": 0.010068330147789123,
12
- "id": 13
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
- "name": "Racer 5",
16
- "style_id": "8afc60f5-2ee0-40a2-a53a-39c6f43ed4bf",
17
- "calories_oz": 12.5,
18
- "abv": 7.2000000000000002,
19
- "brewer_id": "4360bae4-5522-4fca-8e3a-0edebfc457a5",
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.636363636397,
24
- "id": 1,
25
- "name": "15.5 gallon keg"
26
- },
27
- "drinks": [
28
- {
29
- "volume_ml": 55.667820300000002,
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
+ }
@@ -1,28 +1,102 @@
1
1
  {
2
- "result": {
3
- "kegs": [
4
- {
5
- "status": "online",
6
- "volume_ml_remain": 299.24664065039542,
7
- "finished_time": "2010-06-11T23:25:16",
8
- "description": "Celebrating the World Cup, and international relations, with a beer that's part Austria / part Berkeley.",
9
- "type_id": "20bd3f32-75eb-11df-80f2-00304833977c",
10
- "started_time": "2010-06-11T23:25:16",
11
- "size_id": 1,
12
- "percent_full": 0.0051001891001911156,
13
- "id": 17
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
- "status": "offline",
17
- "volume_ml_remain": -13363.120936177656,
18
- "finished_time": "2010-05-29T13:01:20",
19
- "description": "Racer 5",
20
- "type_id": "e29a5d90-6b5c-11df-bcbc-00304833977c",
21
- "started_time": "2010-05-29T13:01:20",
22
- "size_id": 1,
23
- "percent_full": -0.22775341302110927,
24
- "id": 16
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
  }
@@ -1,5 +1,6 @@
1
1
  {
2
- "result": {
3
- "kegs": []
2
+ "objects": [],
3
+ "meta": {
4
+ "result": "ok"
4
5
  }
5
6
  }
@@ -1,23 +1,31 @@
1
1
  {
2
- "result": {
3
- "keg": {
4
- "status": "online",
5
- "volume_ml_remain": 299.24664065039542,
6
- "finished_time": "2010-06-11T23:25:16",
7
- "description": "Racer 5",
8
- "type_id": "20bd3f32-75eb-11df-80f2-00304833977c",
9
- "started_time": "2010-06-11T23:25:16",
10
- "size_id": 1,
11
- "percent_full": 0.0051001891001911156,
12
- "id": 17
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
- "tap": {
15
- "meter_name": "kegboard.flow0",
16
- "name": "main tap",
17
- "ml_per_tick": 0.37111880200000003,
18
- "thermo_sensor_id": "1",
19
- "current_keg_id": 17,
20
- "id": "1"
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
+ }
@@ -1,27 +1,59 @@
1
1
  {
2
- "result": {
3
- "taps": [
4
- {
5
- "keg": {
6
- "status": "online",
7
- "volume_ml_remain": 299.24664065039542,
8
- "finished_time": "2010-06-11T23:25:16",
9
- "description": "Racer 5",
10
- "type_id": "20bd3f32-75eb-11df-80f2-00304833977c",
11
- "started_time": "2010-06-11T23:25:16",
12
- "size_id": 1,
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
- "tap": {
17
- "meter_name": "kegboard.flow0",
18
- "name": "main tap",
19
- "ml_per_tick": 0.37111880200000003,
20
- "thermo_sensor_id": "1",
21
- "current_keg_id": 17,
22
- "id": "1"
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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "result": {
3
- "taps": [
4
- ]
2
+ "objects": [],
3
+ "meta": {
4
+ "result": "ok"
5
5
  }
6
6
  }
@@ -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('boysdontcall poured a glass at ' \
87
- '2009-10-03T17:12:27')
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 #1: Racer 5, 0.51% remaining')
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: Racer 5, 0.51% remaining')
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 #16: Racer 5, status: offline, ' \
162
- '-22.78% remaining')
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 #13: Racer 5, status: offline, ' \
183
- '1.01% remaining')
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.1.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