0.0
No commit activity in last 3 years
No release in over 3 years
Parses the HTML tag soup on the Rice dining homepage to get current servery information
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.8
~> 1.8
 Project Readme

rice-dining

Provides a rice-dining executable that prints servery offerings at Rice, with an API that you can use to extract semi-structured data from the servery menu.

If you don't like Ruby, shell out from nodejs or something.

Installation

gem install rice-dining

Using it in your HackRice party planning app

Everyone loves CSV, right?

require 'rice/dining'
require 'csv'

manifest = Rice::Dining.manifest

CSV.open('dining.csv', 'w') do |csv|
  manifest.locations.each do |loc|
    loc.items.each do |item|
      csv << [loc.name, loc.open?, item.name, item.allergens.map(&:id).join(' ')]
    end
  end
end
<...>

Baker,true,Roasted red potatoes,vegan
Baker,true,Buffalo chicken drumsticks with bleu cheese,milk
Baker,true,Cod loin with roasted asparagus and corn,fish
Baker,true,Grilled tofu steaks with chimichurri,soy vegan
Baker,true,Roasted cauliflower & crispy garbanzos,soy vegan
Baker,true,Margherita pizza,gluten milk soy vegetarian
Baker,true,Pinto bean soup with pico de gallo,soy vegan

Note that this query was performed at like 4AM Houston time and all the locations were "open" according to dining.rice.edu ¯\_(ツ)_/¯

Invocation

Run rice-dining to print status for everything, or rice-dining <regex> to print status for locations matching <regex>.

For example, rice-dining 'baker|seibel' would display information for the Baker and Seibel serveries.

Unicode

If the unicode arrows bug you, export RICE_DINING_NO_UNICODE and they will go away.

Screenshot

Screenshot

Class hierarchy

Rice::Dining::Manifest {
  locations: [Rice::Dining::Location, ...], # Array
  allergens: [Rice::Dining::Allergen, ...]  # Set
}

Rice::Dining::Location {
  name: String,
  items: [Rice::Dining::Item, ...] # Array
}

Rice::Dining::Item {
  name: String,
  allergens: [Rice::Dining::Allergen, ...] # Set
}

Rice::Dining::Allergen {
  id: Symbol,
  shortcode: Symbol
}