Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Latest commit 393ab01 @nybble73 nybble73 Merge pull request #9 from ordrin/dev_polina
Trim extra whitespaces in address input

JavaScript API Wrapper

This JavaScript exposes the parts of the API that do not require user authentication and puts the API into ordrin.api. Every API function takes a callback function as the last argument, and finishes by calling callback(error, data)

It is initialized with ordrin.restaurantUrl (the URL to which restaurant API requests should be sent) and ordrin.orderUrl (the URL to which order API requests should be sent).

Data Classes


Represents a street address for delivery and billing

new Address(addr, city, state, zip, phone, [addr2])


  1. addr: The street address
  2. addr2: The second line of the street address
  3. city: The city the address is in
  4. state: The state the address is in
  5. zip: The zip code of the city
  6. phone: The phone number associated with the address


Represents all of the useful information associated with a credit card

new CreditCard(name, expiryMonth, expiryYear, billAddress, number, cvc)


  1. name: The name on the card
  2. expriyMonth: The month in which the card expires
  3. expiryYear: The year in which the card expires
  4. billAddress: The billing address
  5. number: The credit card number
  6. cvc: The card verification code


Represents an option on an item in the tray

new Option(id, [name], [price])


  1. id: The menu id of the option
  2. name: The name of the option
  3. price: The price of the option in cents
  4. totalPrice: the price of the option multiplied by the item quantity in dollars


Represents an item in the tray

new TrayItem(id, quantity, options, [name], [price])


  1. trayItemId: The tray id of the item (used for uniquely identifying items in the tray
  2. itemId: The menu id of the item
  3. itemName: The name of the item
  4. quantity: The selected quantity for the item in the tray
  5. options: The selected options for the item in the tray
  6. price: The base price of the item in cents
  7. quantityPrice: the price of the item (excluding options) in dollars


  1. buildItemString(): Returns the part of the API query string corresponding to this item
  2. hasOptionSelected(optionId): Returns true if this item has an option selected with this optionId and false otherwise
  3. getTotalPrice(): Returns the total price of this tray item, taking into account selected options and quantity


Represents a tray of food to be ordered.

new Tray([items])


  1. items: A hash mapping tray item ids to items in the tray


  1. addItem(item): Adds item to the tray
  2. removeItem(id): Removes the item with the tray id id from the tray
  3. buildTrayString(): Returns the part of the API query string corresponding to the tray
  4. getSubtotal(): Returns the total price of all items in the tray

Restaurant API

This API is for retreiving information about restaurants. The documentation for the underlying API calls can be found at the Restaurant API documentation. All of these functions are in the restaurant object (

// Get the list of restaurants that will deliver to that address
getDeliveryList(dateTime, address, callback)

// Check whether the restaurant will deliver to that address at that
// time
getDeliveryCheck(restaurantId, dateTime, address, callback)

// Get the fee and tax for an order with the given price, as well as
// delivery check information
getFee(restaurantId, subtotal, tip, dateTime, address, callback)

// Get all information about the restaurant, including their menu
getDetails(restaurantId, callback)

Order API

This API is for placing orders. The documentation for the underlying API calls can be found at the Order API documentation. This function is in the order object (ordrin.api.order).

// Place an order
placeOrder(restaurantId, tray, tip, deliveryTime, firstName, lastName, address, creditCard, email, callback)
Something went wrong with that request. Please try again.