ordrin-api
v1.0.2
Published
A node library for the ordr.in food ordering API
Downloads
33
Readme
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
- Usage
- Guest Order (
order_guest
) - User Order (
order_user
)
- Guest Order (
- Delivery Check (
delivery_check
) - Delivery List (
delivery_list
) - Fee (
fee
) - Restaurant Details (
restaurant_details
)
- Delivery Check (
- Change Password (
change_password
) - Create Account (
create_account
) - Create Address (
create_addr
) - Create Credit Card (
create_cc
) - Remove address (
delete_addr
) - Remove Credit Card (
delete_cc
) - Get Account Information (
get_account_info
) - Get All Saved Addresses (
get_all_saved_addrs
) - Get all saved credit cards (
get_all_saved_ccs
) - Get an Order (
get_order
) - Get Order History (
get_order_history
) - Get a single saved address (
get_saved_addr
) - Get a single saved credit card (
get_saved_cc
)
- Change Password (
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 addressargs.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 centsargs.first_name
: The customer's first nameargs.last_name
: The customer's last nameargs.phone
: The customer's phone numberargs.zip
: The zip code part of the address (5 digits)args.addr
: The street addressargs.addr2
: The second part of the street address, if neededargs.city
: The city part of the addressargs.state
: The state part of the address (Two letters)args.card_name
: Full name as it appears on the credit cardargs.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 addressargs.card_bill_addr2
: The second part of the credit card's biling street address.args.card_bill_city
: The credit card's billing cityargs.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 centsargs.first_name
: The customer's first nameargs.last_name
: The customer's last nameargs.email
: The user's email addressargs.current_password
: The user's current password
Either
args.phone
: The customer's phone numberargs.zip
: The zip code part of the address (5 digits)args.addr
: The street addressargs.addr2
: The second part of the street address, if neededargs.city
: The city part of the addressargs.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 cardargs.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 addressargs.card_bill_addr2
: The second part of the credit card's biling street address.args.card_bill_city
: The credit card's billing cityargs.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 addressargs.city
: Delivery location cityargs.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 addressargs.city
: Delivery location cityargs.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 addressargs.city
: Delivery location cityargs.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 addressargs.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 addressargs.pw
: The user's passwordargs.first_name
: The user's first nameargs.last_name
: The user's last name
Create Address (API Reference)
ordrin_api.create_addr(args, callback)
Arguments
args.email
: The user's email addressargs.nick
: The nickname of this addressargs.phone
: The customer's phone numberargs.zip
: The zip code part of the address (5 digits)args.addr
: The street addressargs.addr2
: The second part of the street address, if neededargs.city
: The city part of the addressargs.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 addressargs.nick
: The nickname of this addressargs.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 addressargs.bill_addr2
: The second part of the credit card's biling street address.args.bill_city
: The credit card's billing cityargs.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 numberargs.current_password
: The user's current password
Remove address (API Reference)
ordrin_api.delete_addr(args, callback)
Arguments
args.email
: The user's email addressargs.nick
: The nickname of this addressargs.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 addressargs.nick
: The nickname of this addressargs.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 addressargs.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 addressargs.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 addressargs.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 addressargs.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 addressargs.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 addressargs.nick
: The nickname of this addressargs.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 addressargs.nick
: The nickname of this addressargs.current_password
: The user's current password