lita-zerocater 0.8.0 → 0.9.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: 577202ef0f7bac17a9db41bd81336971813d4351
4
- data.tar.gz: b445f765b77ee22cfe216e22c6f982e43357835c
3
+ metadata.gz: bd73969399e9104ad95a27cf34eb660c0ff974b4
4
+ data.tar.gz: 46bf7c205b50a0f6f6dc4c91df01c1717cc64bf6
5
5
  SHA512:
6
- metadata.gz: 472ee00c40025487f833146a42f72d076fa0c5846948c8d572e8dbcf87f68b3cc693e38350a4a9dc7da0ac4ddba8bc0a1b4376792f138e528387de00af54eb88
7
- data.tar.gz: 52c04b88725ba64191443cc5265026a74fd70f10b61190c51a1f51a995ae25b5022b48d8815243c7537e5158753f7cda6daddcbbd67b094e879f119cc9b5e3d6
6
+ metadata.gz: 65ca4bcaea136c763213473513d3051cdb28482b786737b232350ecab124dabf15127041c7147ede77bfe84819d63f3203fbe7274b93aaee7100f4cec940dc80
7
+ data.tar.gz: 7bd00b8c7f2a8344f342f8c3bd6933e4c6b503001ddd9151f88d9207925334fa4465c098fb396da7370883af542fbe5770cc3865f60f7343181e5bf8fecfb2ef
@@ -4,9 +4,6 @@ Lita.load_locales Dir[File.expand_path(
4
4
  File.join('..', '..', 'locales', '*.yml'), __FILE__
5
5
  )]
6
6
 
7
- require 'nokogiri'
8
- require 'unidecoder'
9
-
10
7
  require 'lita/handlers/zerocater'
11
8
 
12
9
  Lita::Handlers::Zerocater.template_root File.expand_path(
@@ -31,7 +31,7 @@ module Lita
31
31
  )
32
32
 
33
33
  route(
34
- /^lunch$/,
34
+ /^lunch$/i,
35
35
  :today,
36
36
  command: true,
37
37
  help: {
@@ -60,18 +60,15 @@ module Lita
60
60
  private
61
61
 
62
62
  def fetch(location)
63
- http.get('https://zerocater.com/m/' + location)
63
+ http.get("https://api.zerocater.com/v3/companies/#{location}/meals")
64
64
  end
65
65
 
66
66
  def extract(menu_text, search_date)
67
- # NOTE: This is horrible. No, really. Curse you Zerocater.
68
67
  results = []
69
- page = Nokogiri::HTML(menu_text.body)
70
- menu = page.css("div.menu[data-date='" + search_date + "']")
71
- menu.css('.meal-label').each do |meal|
72
- meal.css('.order-name').each do |order|
73
- results.push order.text.strip.to_ascii
74
- end
68
+ content = JSON.parse(menu_text.body)
69
+ content.each do |item|
70
+ date = DateTime.strptime(item['time'].to_s, '%s').strftime('%Y-%m-%d')
71
+ results << item['name'] if date == search_date
75
72
  end
76
73
  results
77
74
  end
@@ -82,25 +79,23 @@ module Lita
82
79
  cache_key = "#{location}_#{search_date}"
83
80
  return redis.get(cache_key) if redis.exists(cache_key)
84
81
 
85
- begin
86
- menu = extract(fetch(config.locations[location]), search_date)
87
- rescue
88
- return t('error.retrieve')
89
- end
90
-
91
- return t('error.empty') unless menu.size > 0
82
+ menu = extract(fetch(config.locations[location]), search_date)
83
+ return t('error.empty') if menu.empty?
92
84
 
93
85
  t = render_template('menu',
94
86
  menu: menu,
95
87
  locale: t('menu.locale', location: location))
88
+
96
89
  redis.set(cache_key, t)
97
90
  t
91
+ rescue
92
+ t('error.retrieve')
98
93
  end
99
94
  # rubocop:enable Metrics/AbcSize
100
95
  # rubocop:enable Metrics/MethodLength
101
96
 
102
97
  def menu_today(location)
103
- menu(location, (Date.today).to_s)
98
+ menu(location, Date.today.to_s)
104
99
  end
105
100
 
106
101
  def menu_yesterday(location)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-zerocater'
3
- spec.version = '0.8.0'
3
+ spec.version = '0.9.0'
4
4
  spec.authors = ['Eric Sigler']
5
5
  spec.email = ['me@esigler.com']
6
6
  spec.description = 'A ZeroCater menu lookup plugin for Lita'
@@ -15,8 +15,6 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ['lib']
16
16
 
17
17
  spec.add_runtime_dependency 'lita', '>= 4.4'
18
- spec.add_runtime_dependency 'nokogiri'
19
- spec.add_runtime_dependency 'unidecoder'
20
18
 
21
19
  spec.add_development_dependency 'bundler'
22
20
  spec.add_development_dependency 'coveralls'
@@ -0,0 +1 @@
1
+ [{"id":525377,"url":"https://api.zerocater.com/v3/meals/525377","name":"Peruvian Fare","vendor_name":"Lima Peruvian Food","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520588/yyqv7lfoykdk01o4a2h4.jpg","vendor_description":"Lima Peruvian Food combines the freshest, local ingredients with fair trade Peruvian spices to create authentic and delicious Peruvian food.","time":1454097000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/525377/ratings"},{"id":529016,"url":"https://api.zerocater.com/v3/meals/529016","name":"Vietnamese Bowls","vendor_name":"Bun Mee","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520097/rau7jau80hvhpkvdyfih.jpg","vendor_description":"Bun Mee is a gourmet Vietnamese eatery that modernizes street food and specializes in banh-mi inspired sandwiches, rice bowls, salads and appetizers.","time":1454356200,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/529016/ratings"},{"id":529017,"url":"https://api.zerocater.com/v3/meals/529017","name":"Taco Tuesday!","vendor_name":"Southwest Grill","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520960/wehxx339x0xj7ja6c7bf.jpg","vendor_description":"Mexican and Southwestern food in the South Bay and Peninsula! ","time":1454442600,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/529017/ratings"},{"id":549823,"url":"https://api.zerocater.com/v3/meals/549823","name":"European Breakfast!","vendor_name":"Sweet and Natural","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520995/edwsuuemizgr2gdy8d9a.jpg","vendor_description":"Chef Fumie Ito uses the freshest local ingredients to create healthy, home-cooked style meals that span a wide array of world cuisines.","time":1454517000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/549823/ratings"},{"id":530218,"url":"https://api.zerocater.com/v3/meals/530218","name":"Salad Bar Extravaganza","vendor_name":"Gourmet Catering Bay Area","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520411/kut0q3i4ndfnaarkcrgt.jpg","vendor_description":"Gourmet Catering Bay Area is known for Italian cuisine featuring high quality seasonal, organic and sustainably farmed meats, produce and seafood.","time":1454529000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/530218/ratings"},{"id":529018,"url":"https://api.zerocater.com/v3/meals/529018","name":"Sausage Bar","vendor_name":"Mr. Nice","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520694/x432bgzwk5n2wusy3nra.jpg","vendor_description":"Mr. Nice's colorful food truck and restaurant, located at 320 11th street, serves local, organic sausages and sides with homemade condiments. ","time":1454529000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/529018/ratings"},{"id":529019,"url":"https://api.zerocater.com/v3/meals/529019","name":"Tandoori Feast","vendor_name":"Tandoori Paradise","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439521017/txv0gekjwco2lggniob0.png","vendor_description":"Our food is made with homemade ingredients used extensively in Indian homes.","time":1454615400,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/529019/ratings"},{"id":529020,"url":"https://api.zerocater.com/v3/meals/529020","name":"Pan Latin!","vendor_name":"Jardin","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520474/mvhau8jp3saoqzjq0kdm.jpg","vendor_description":"James uses the highest quality locally sourced and organic produce authentic Latin cuisine to delight your tastebuds.","time":1454701800,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/529020/ratings"},{"id":532323,"url":"https://api.zerocater.com/v3/meals/532323","name":"Chinese New Year!","vendor_name":"Heaven's Kitchen Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520437/muxqg07xqaxnzggrqjnm.jpg","vendor_description":"Authentic pan-asian cuisine.","time":1454961000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532323/ratings"},{"id":551731,"url":"https://api.zerocater.com/v3/meals/551731","name":"Eggrolls","vendor_name":"KRUA Thai","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520549/xayxctgra6ggsbnhrniw.jpg","vendor_description":"Fresh, modern Thai food in San Francisco's Mission District. ","time":1454961000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/551731/ratings"},{"id":532324,"url":"https://api.zerocater.com/v3/meals/532324","name":"Spanish Chicken & Mushrooms","vendor_name":"Jen Milton Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520478/jqwrz3dohrnqysdt7t6w.jpg","vendor_description":"A local caterer who specializes in comfort food with local and seasonal ingredients.","time":1455047400,"location_hash":"498541","is_mindful":true,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532324/ratings"},{"id":532328,"url":"https://api.zerocater.com/v3/meals/532328","name":"Southern-Style Breakfast","vendor_name":"CatHead's BBQ","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520150/rqjdswwirtbg6yayakj2.jpg","vendor_description":"Founded by two chefs with a love of garden to table style eating, CatHead's revives deep-rooted traditional recipes with a fresh twist.","time":1455121800,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532328/ratings"},{"id":533175,"url":"https://api.zerocater.com/v3/meals/533175","name":"Paella Feast","vendor_name":"Nora Spanish Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520716/xpinbzdeyejrczclc8iq.jpg","vendor_description":"Ñora combines old world traditions of Spanish cuisine with the fresh flavors of the Bay Area.","time":1455133800,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/533175/ratings"},{"id":532325,"url":"https://api.zerocater.com/v3/meals/532325","name":"Salad Bar Extravaganza","vendor_name":"Gourmet Catering Bay Area","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520411/kut0q3i4ndfnaarkcrgt.jpg","vendor_description":"Gourmet Catering Bay Area is known for Italian cuisine featuring high quality seasonal, organic and sustainably farmed meats, produce and seafood.","time":1455133800,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532325/ratings"},{"id":532326,"url":"https://api.zerocater.com/v3/meals/532326","name":"Sandwiches and Salads","vendor_name":"Breaking Bread Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520084/nnjmrhjioki2hvcno3x3.jpg","vendor_description":"Breaking Bread was founded with a simple goal: to bring back the art of sandwich making. Great success!","time":1455220200,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532326/ratings"},{"id":532327,"url":"https://api.zerocater.com/v3/meals/532327","name":"Thai Time","vendor_name":"Baan Restaurant & Wine Bar","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439519995/s7bd5epa11myd2xnadd4.jpg","vendor_description":"A Thai restaurant specializing in authentic Thai cuisine.","time":1455306600,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/532327/ratings"},{"id":534651,"url":"https://api.zerocater.com/v3/meals/534651","name":"Taco Tuesday!","vendor_name":"Southwest Grill","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520960/wehxx339x0xj7ja6c7bf.jpg","vendor_description":"Mexican and Southwestern food in the South Bay and Peninsula! ","time":1455652200,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/534651/ratings"},{"id":534655,"url":"https://api.zerocater.com/v3/meals/534655","name":"Biscuits and Gravy!","vendor_name":"SSB Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520973/t5onh7r6cod2opcirxui.jpg","vendor_description":"Chef and owner Brian Tu focuses on serving only the freshest prepared foods to clients, offering a variety of options to meet any dietary needs.","time":1455726600,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/534655/ratings"},{"id":534652,"url":"https://api.zerocater.com/v3/meals/534652","name":"Composed Salads & Pasta Bar!","vendor_name":"Gourmet Catering Bay Area","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520411/kut0q3i4ndfnaarkcrgt.jpg","vendor_description":"Gourmet Catering Bay Area is known for Italian cuisine featuring high quality seasonal, organic and sustainably farmed meats, produce and seafood.","time":1455738600,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/534652/ratings"},{"id":556056,"url":"https://api.zerocater.com/v3/meals/556056","name":"Vietnamese Sautés","vendor_name":"A Taste of Vietnam Noodle Bar & Grill ","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439519986/ouafnn1i5nlwmfwuletj.jpg","vendor_description":"You'll get more than a taste of authentic Vietnamese flavors here!","time":1455825000,"location_hash":"498541","is_mindful":false,"was_delivered":true,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/556056/ratings"},{"id":534654,"url":"https://api.zerocater.com/v3/meals/534654","name":"Specialty Sandwiches","vendor_name":"Americano Deli and Grill","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439519949/u7gy0jj2d2bwqeg89i3q.jpg","vendor_description":"Fusing American cuisine with traditional European flavors, Americano's recipes have been passed down for generations to become community favorites.","time":1455911400,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/534654/ratings"},{"id":536623,"url":"https://api.zerocater.com/v3/meals/536623","name":"Week of Stuphin: Limon","vendor_name":"Limon Rotisserie","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520590/nercq8gjxsj7jkni67gx.jpg","vendor_description":"Limon, offers traditional Peruvian food, including their famous rotisserie chicken. ","time":1456170600,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/536623/ratings"},{"id":536625,"url":"https://api.zerocater.com/v3/meals/536625","name":"Week of Stuphin: Ike's Feast","vendor_name":"Ike's Place San Mateo","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520457/rzmdjjopvmzyne0hdfvp.jpg","vendor_description":"Handcrafted sandwiches that are hearty, unique, and flavorful delights!","time":1456257000,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/536625/ratings"},{"id":536628,"url":"https://api.zerocater.com/v3/meals/536628","name":"Week of Stuphin: On-Site Crepes!","vendor_name":"Crepe Madame","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520227/dzrbr3ndpau4icvoygh4.jpg","vendor_description":"Laetitia's traditional French buckwheat and sweet crepes are prepared and served on-site, with love. ","time":1456331400,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/536628/ratings"},{"id":537781,"url":"https://api.zerocater.com/v3/meals/537781","name":"Week of Stupin: On-Site Belly Burgers!","vendor_name":"Big Chef Tom's Belly Burgers","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520049/sndh9t7eg46sjyjntjjx.jpg","vendor_description":"Chef Tom Pizzica cooks up carefully curated pork, chicken and veggie burgers!","time":1456342200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/537781/ratings"},{"id":536626,"url":"https://api.zerocater.com/v3/meals/536626","name":"Week of Stuphin: Mediterranean Fare","vendor_name":"SAJJ Falafel Shawarma","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520899/ip5o25myfjhqni8vdqpl.jpg","vendor_description":"Sajj offers build your own style meals using fresh, healthy ingredients. ","time":1456429800,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/536626/ratings"},{"id":536627,"url":"https://api.zerocater.com/v3/meals/536627","name":"Chicken & Meatballs","vendor_name":"Cafe Sud","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520129/ukpqcczmpmyi8vain8ro.jpg","vendor_description":"With a background in catering to paleo clientele, Chef Katia Sabbah brings healthy, clean food to companies throughout the Bay Area.","time":1456516200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/536627/ratings"},{"id":539632,"url":"https://api.zerocater.com/v3/meals/539632","name":"Back Yard Sammies","vendor_name":"Back Yard Kitchen","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520000/s7ugdxpm5wns5etalg0x.jpg","vendor_description":"Local restaurant that prides themselves on unpretentious gourmet sandwiches and salads, made from local produce.","time":1456775400,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539632/ratings"},{"id":539633,"url":"https://api.zerocater.com/v3/meals/539633","name":"Taco Tuesday!","vendor_name":"Southwest Grill","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520960/wehxx339x0xj7ja6c7bf.jpg","vendor_description":"Mexican and Southwestern food in the South Bay and Peninsula! ","time":1456861800,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539633/ratings"},{"id":539637,"url":"https://api.zerocater.com/v3/meals/539637","name":"Eggs, Bacon & Sausage","vendor_name":"SSB Catering","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520973/t5onh7r6cod2opcirxui.jpg","vendor_description":"Chef and owner Brian Tu focuses on serving only the freshest prepared foods to clients, offering a variety of options to meet any dietary needs.","time":1456936200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539637/ratings"},{"id":539634,"url":"https://api.zerocater.com/v3/meals/539634","name":"Salad Bar Extravaganza","vendor_name":"Gourmet Catering Bay Area","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520411/kut0q3i4ndfnaarkcrgt.jpg","vendor_description":"Gourmet Catering Bay Area is known for Italian cuisine featuring high quality seasonal, organic and sustainably farmed meats, produce and seafood.","time":1456948200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539634/ratings"},{"id":556133,"url":"https://api.zerocater.com/v3/meals/556133","name":"Sausage Bar for 60","vendor_name":"Mr. Nice","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520694/x432bgzwk5n2wusy3nra.jpg","vendor_description":"Mr. Nice's colorful food truck and restaurant, located at 320 11th street, serves local, organic sausages and sides with homemade condiments. ","time":1456948200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/556133/ratings"},{"id":539635,"url":"https://api.zerocater.com/v3/meals/539635","name":"Gurkha Chicken & Pork Choila","vendor_name":"Bini's Kitchen","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520055/c870hvjkdusli8hmmodr.jpg","vendor_description":"Binis Kitchen combines home ground spices with local ingredients and delivers recipes passed down through generations. ","time":1457034600,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539635/ratings"},{"id":539636,"url":"https://api.zerocater.com/v3/meals/539636","name":"Mindful Menu: Chicken & Salmon","vendor_name":"Fleur de Sel","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520372/puzch9qtnxe9dkcduann.jpg","vendor_description":"Chef Stephane Gregoire opened Fleur de Sel to focus on providing natural, fresh prepared meals, using seasonal and mostly organic ingredients. ","time":1457121000,"location_hash":"498541","is_mindful":true,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/539636/ratings"},{"id":543533,"url":"https://api.zerocater.com/v3/meals/543533","name":"Jerk Chicken and Brown Stewed Beef","vendor_name":"Scotch Bonnet","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520481/w5binldga6jojjbdrilz.jpg","vendor_description":"Add a little Caribbean flavor to your life through the authentic Jamaican creations of Chef O'Brian Matterson.","time":1457380200,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/543533/ratings"},{"id":543534,"url":"https://api.zerocater.com/v3/meals/543534","name":"Banh Mi","vendor_name":"Dinosaurs Sandwiches","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520291/clx6q0ygthrwtmioaoic.jpg","vendor_description":"With multiple locations throughout San Francisco, Dinosaurs offers a fantastic range of authentic Vietnamese banh mi, fresh spring rolls, and salads","time":1457466600,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/543534/ratings"},{"id":543538,"url":"https://api.zerocater.com/v3/meals/543538","name":"Hash Breakfast","vendor_name":"Nueve Mexican Bar & Grill","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1443458477/gmrtsd2l8ppsztvzptwn.jpg","vendor_description":"Fresh Mexican food.","time":1457541000,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/543538/ratings"},{"id":543535,"url":"https://api.zerocater.com/v3/meals/543535","name":"Salad Bar Extravaganza","vendor_name":"Gourmet Catering Bay Area","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520411/kut0q3i4ndfnaarkcrgt.jpg","vendor_description":"Gourmet Catering Bay Area is known for Italian cuisine featuring high quality seasonal, organic and sustainably farmed meats, produce and seafood.","time":1457553000,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/543535/ratings"},{"id":556134,"url":"https://api.zerocater.com/v3/meals/556134","name":"Paella!","vendor_name":"Patatas","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520760/uhanodjudpopbberwynn.jpg","vendor_description":"Chef Marcos Quezada cooks traditional Spanish dishes inspired by his Grandmother's recipes. ","time":1457553000,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/556134/ratings"},{"id":543536,"url":"https://api.zerocater.com/v3/meals/543536","name":"Deep Dish!","vendor_name":"Patxi's","vendor_image_url":"https://res.cloudinary.com/zerocater/image/upload/v1439520762/biuqpuxe6vgsirtjdpwu.jpg","vendor_description":"Whether you are in the mood for an authentic Chicago-style deep dish, or thin crust pizza, Patxi's is the right choice.","time":1457639400,"location_hash":"498541","is_mindful":false,"was_delivered":false,"is_sample":false,"ratings_url":"https://api.zerocater.com/v3/meals/543536/ratings"}]
@@ -9,21 +9,27 @@ describe Lita::Handlers::Zerocater, lita_handler: true do
9
9
  it { is_expected.to route_command('zerocater tomorrow').to(:tomorrow) }
10
10
  it { is_expected.to route_command('zerocater yesterday').to(:yesterday) }
11
11
  it { is_expected.to route_command('lunch').to(:today) }
12
+ it { is_expected.to route_command('Lunch').to(:today) }
12
13
 
13
14
  let(:menu) do
14
- File.read('spec/files/menu.html')
15
+ File.read('spec/files/meals.json')
15
16
  end
16
17
 
17
18
  describe '#today' do
18
19
  it 'shows the menu for today' do
19
- Timecop.travel(Time.local(2015, 9, 29, 8, 0, 0))
20
+ Timecop.travel(Time.local(2016, 2, 23, 8, 0, 0))
20
21
  grab_request('get', 200, menu)
21
22
  send_command('zerocater today')
22
- expect(replies.last).to eq("Menu for foo:\n\nTaco Tuesday\n")
23
+ expect(replies.last).to eq(<<-MENU
24
+ Menu for foo:
25
+
26
+ Week of Stuphin: Ike's Feast
27
+ MENU
28
+ )
23
29
  end
24
30
 
25
31
  it 'shows nothing if there are no menu items' do
26
- Timecop.travel(Time.local(2015, 9, 7, 8, 0, 0))
32
+ Timecop.travel(Time.local(2016, 1, 1, 8, 0, 0))
27
33
  grab_request('get', 200, menu)
28
34
  send_command('zerocater today')
29
35
  expect(replies.last).to eq('There are no menu items found for today')
@@ -38,14 +44,14 @@ describe Lita::Handlers::Zerocater, lita_handler: true do
38
44
 
39
45
  describe '#tomorrow' do
40
46
  it 'shows the menu for tomorrow' do
41
- Timecop.travel(Time.local(2015, 9, 29, 8, 0, 0))
47
+ Timecop.travel(Time.local(2016, 2, 23, 8, 0, 0))
42
48
  grab_request('get', 200, menu)
43
49
  send_command('zerocater tomorrow')
44
50
  expect(replies.last).to eq(<<-MENU
45
51
  Menu for foo:
46
52
 
47
- Breakfast Sandwich Bar
48
- Salad & Pasta Bar!
53
+ Week of Stuphin: On-Site Crepes!
54
+ Week of Stupin: On-Site Belly Burgers!
49
55
  MENU
50
56
  )
51
57
  end
@@ -53,10 +59,10 @@ MENU
53
59
 
54
60
  describe '#yesterday' do
55
61
  it 'shows the menu for yesterday' do
56
- Timecop.travel(Time.local(2015, 9, 29, 8, 0, 0))
62
+ Timecop.travel(Time.local(2016, 2, 23, 8, 0, 0))
57
63
  grab_request('get', 200, menu)
58
64
  send_command('zerocater yesterday')
59
- expect(replies.last).to eq("Menu for foo:\n\nJapanese Fried Chicken\n")
65
+ expect(replies.last).to eq("Menu for foo:\n\nWeek of Stuphin: Limon\n")
60
66
  end
61
67
  end
62
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-zerocater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sigler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -24,34 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.4'
27
- - !ruby/object:Gem::Dependency
28
- name: nokogiri
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: unidecoder
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: bundler
57
29
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +170,7 @@ files:
198
170
  - lib/lita/handlers/zerocater.rb
199
171
  - lita-zerocater.gemspec
200
172
  - locales/en.yml
173
+ - spec/files/meals.json
201
174
  - spec/files/menu.html
202
175
  - spec/lita/handlers/zerocater_spec.rb
203
176
  - spec/spec_helper.rb
@@ -229,6 +202,7 @@ signing_key:
229
202
  specification_version: 4
230
203
  summary: A ZeroCater menu lookup plugin for Lita
231
204
  test_files:
205
+ - spec/files/meals.json
232
206
  - spec/files/menu.html
233
207
  - spec/lita/handlers/zerocater_spec.rb
234
208
  - spec/spec_helper.rb