ordrin-api

1.0.2 • Public • Published

Ordr.in Node Library

A node library for the ordr.in API. See full API documentation at http://hackfood.ordr.in

Table of Contents

Installation

This library can be installed with npm:

npm install ordrin-api

Usage

Callbacks

Because node is async, every function call you make to the ordrin api includes a callback. This callback will be called when the API has finished processing the request. This callback takes two arguments, error and data. If the request fails, then error will be an Error object; otherwise it will be falsy. The data argument contains the JavaScript object returned by the API.

Initialization

var ordrin = require("ordrin-api");
// Initialize with your application secret key
var ordrin_api = new  ordrin.APIs(api_secret_key, servers);

In the initializer, the second argument sets the servers that API requests will be sent to, and must be set to either ordrin.PRODUCTION or ordrin.TEST (defaults to ordrin.TEST).

Order Endpoints (API Reference)

Guest Order (API Reference)

ordrin_api.order_guest(args, callback)
Arguments
  • args.rid : Ordr.in's unique restaurant identifier for the restaurant. (A number)
  • args.em : The customer's email address
  • args.tray : Represents a tray of menu items in the format '[menu item id]/[qty],[option id],...,[option id]'
  • args.tip : Tip amount in dollars and cents
  • args.first_name : The customer's first name
  • args.last_name : The customer's last name
  • args.phone : The customer's phone number
  • args.zip : The zip code part of the address (5 digits)
  • args.addr : The street address
  • args.addr2 : The second part of the street address, if needed
  • args.city : The city part of the address
  • args.state : The state part of the address (Two letters)
  • args.card_name : Full name as it appears on the credit card
  • args.card_number : Credit card number (16 digits)
  • args.card_cvc : 3 or 4 digit security code (3 or 4 digits)
  • args.card_expiry : The credit card expiration date. (mm/yyyy)
  • args.card_bill_addr : The credit card's billing street address
  • args.card_bill_addr2 : The second part of the credit card's biling street address.
  • args.card_bill_city : The credit card's billing city
  • args.card_bill_state : The credit card's billing state (2 letters)
  • args.card_bill_zip : The credit card's billing zip code (5 digits)
  • args.card_bill_phone : The credit card's billing phone number
Either
  • args.delivery_date : Delivery date (mm-dd)
  • args.delivery_time : Delivery time (HH:MM)
Or
  • args.delivery_date : Delivery date (ASAP)

User Order (API Reference)

ordrin_api.order_user(args, callback)
Arguments
  • args.rid : Ordr.in's unique restaurant identifier for the restaurant. (A number)
  • args.tray : Represents a tray of menu items in the format '[menu item id]/[qty],[option id],...,[option id]'
  • args.tip : Tip amount in dollars and cents
  • args.first_name : The customer's first name
  • args.last_name : The customer's last name
  • args.email : The user's email address
  • args.current_password : The user's current password
Either
  • args.phone : The customer's phone number
  • args.zip : The zip code part of the address (5 digits)
  • args.addr : The street address
  • args.addr2 : The second part of the street address, if needed
  • args.city : The city part of the address
  • args.state : The state part of the address (Two letters)
Or
  • args.nick : The delivery location nickname. (From the user's addresses)
Either
  • args.card_name : Full name as it appears on the credit card
  • args.card_number : Credit card number (16 digits)
  • args.card_cvc : 3 or 4 digit security code (3 or 4 digits)
  • args.card_expiry : The credit card expiration date. (mm/yyyy)
  • args.card_bill_addr : The credit card's billing street address
  • args.card_bill_addr2 : The second part of the credit card's biling street address.
  • args.card_bill_city : The credit card's billing city
  • args.card_bill_state : The credit card's billing state (2 letters)
  • args.card_bill_zip : The credit card's billing zip code (5 digits)
  • args.card_bill_phone : The credit card's billing phone number
Or
  • args.card_nick : The credit card nickname. (From the user's credit cards)
Either
  • args.delivery_date : Delivery date (mm-dd)
  • args.delivery_time : Delivery time (HH:MM)
Or
  • args.delivery_date : Delivery date (ASAP)

Restaurant Endpoints (API Reference)

Delivery Check (API Reference)

ordrin_api.delivery_check(args, callback)
Arguments
  • args.datetime : Delivery date and time (ASAP or mm-dd+HH:MM)
  • args.rid : Ordr.in's unique restaurant identifier for the restaurant. (A number)
  • args.addr : Delivery location street address
  • args.city : Delivery location city
  • args.zip : The zip code part of the address (5 digits)

Delivery List (API Reference)

ordrin_api.delivery_list(args, callback)
Arguments
  • args.datetime : Delivery date and time (ASAP or mm-dd+HH:MM)
  • args.addr : Delivery location street address
  • args.city : Delivery location city
  • args.zip : The zip code part of the address (5 digits)

Fee (API Reference)

ordrin_api.fee(args, callback)
Arguments
  • args.datetime : Delivery date and time (ASAP or mm-dd+HH:MM)
  • args.rid : Ordr.in's unique restaurant identifier for the restaurant. (A number)
  • args.subtotal : The cost of all items in the tray in dollars and cents.
  • args.tip : The tip in dollars and cents.
  • args.addr : Delivery location street address
  • args.city : Delivery location city
  • args.zip : The zip code part of the address (5 digits)

Restaurant Details (API Reference)

ordrin_api.restaurant_details(args, callback)
Arguments
  • args.rid : Ordr.in's unique restaurant identifier for the restaurant. (A number)

User Endpoints (API Reference)

Change Password (API Reference)

ordrin_api.change_password(args, callback)
Arguments
  • args.email : The user's email address
  • args.password : The user's new password (SHA256 hex encoded)
  • args.current_password : The user's current password

Create Account (API Reference)

ordrin_api.create_account(args, callback)
Arguments
  • args.email : The user's email address
  • args.pw : The user's password
  • args.first_name : The user's first name
  • args.last_name : The user's last name

Create Address (API Reference)

ordrin_api.create_addr(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.phone : The customer's phone number
  • args.zip : The zip code part of the address (5 digits)
  • args.addr : The street address
  • args.addr2 : The second part of the street address, if needed
  • args.city : The city part of the address
  • args.state : The state part of the address (Two letters)
  • args.current_password : The user's current password

Create Credit Card (API Reference)

ordrin_api.create_cc(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.card_number : Credit card number (16 digits)
  • args.card_cvc : 3 or 4 digit security code (3 or 4 digits)
  • args.card_expiry : The credit card expiration date. (Two digits/Four digits)
  • args.bill_addr : The credit card's billing street address
  • args.bill_addr2 : The second part of the credit card's biling street address.
  • args.bill_city : The credit card's billing city
  • args.bill_state : The credit card's billing state (2 letters)
  • args.bill_zip : The credit card's billing zip code (5 digits)
  • args.bill_phone : The credit card's billing phone number
  • args.current_password : The user's current password

Remove address (API Reference)

ordrin_api.delete_addr(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.current_password : The user's current password

Remove Credit Card (API Reference)

ordrin_api.delete_cc(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.current_password : The user's current password

Get Account Information (API Reference)

ordrin_api.get_account_info(args, callback)
Arguments
  • args.email : The user's email address
  • args.current_password : The user's current password

Get All Saved Addresses (API Reference)

ordrin_api.get_all_saved_addrs(args, callback)
Arguments
  • args.email : The user's email address
  • args.current_password : The user's current password

Get all saved credit cards (API Reference)

ordrin_api.get_all_saved_ccs(args, callback)
Arguments
  • args.email : The user's email address
  • args.current_password : The user's current password

Get an Order (API Reference)

ordrin_api.get_order(args, callback)
Arguments
  • args.email : The user's email address
  • args.oid : Ordr.in's unique order id number. (A number)
  • args.current_password : The user's current password

Get Order History (API Reference)

ordrin_api.get_order_history(args, callback)
Arguments
  • args.email : The user's email address
  • args.current_password : The user's current password

Get a single saved address (API Reference)

ordrin_api.get_saved_addr(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.current_password : The user's current password

Get a single saved credit card (API Reference)

ordrin_api.get_saved_cc(args, callback)
Arguments
  • args.email : The user's email address
  • args.nick : The nickname of this address
  • args.current_password : The user's current password

Readme

Keywords

none

Package Sidebar

Install

npm i ordrin-api

Weekly Downloads

50

Version

1.0.2

License

none

Last publish

Collaborators

  • ordr.in