Skip to content

zuppler/zuppler-ruby

Repository files navigation

Stories in Ready Build Status Code Climate Test Coverage Dependency Status PullReview stats security

Zuppler

Ruby wrapper for Zuppler API.

Installation

Add this line to your application's Gemfile:

gem 'zuppler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zuppler

Usage

Zuppler.config do |config|
  config.channel_key = 'ccc',
  config.api_key = 'aaa',
  config.test = true
end
@restaurant = Zuppler::Restaurant.new name: 'Oscar Pizza', address: '21 Wall St, New York'
@restaurant.save
@restaurant = Zuppler::Restaurant.find 'oscarpizza'
@restaurant.publish only_profile: true # updates only restaurant profile and configuration data
@restaurant.publish # publishes restaurant and menus
@menu = Zuppler::Menu.new restaurant: @restaurant, name: 'pizzas special'
@menu.save
@category = Zuppler::Category.new menu: @menu, name: 'pizzas'
@category.save
@item = Zuppler::Item.new category: @category, name: 'margerita', price: 9.99
@item.save
@choice = Zuppler::Choice.new category: @category, name: 'toppings', multiple: true, min_qty: 2, max_qty: 5, priority: 1
@choice.save
@modifier = Zuppler::Modifier.new choice: @choice, name: 'cheese', price: 0.99
@modifier.save

Order:

@order = Zuppler::Order.find 'abcd-1234-efgh-5678'
@order.details.customer.name
@order.details.carts.first.items.first.name
@order.details.totals.tax

Order actions:

@order = Zuppler::Order.find 'abcd-1234-efgh-5678'
@order.confirm duration: 30, sender: 'tablet app'
@order.cancel reason: 'too busy'
@order.miss reason: 'restaurant does not respond'

Order notifications:

notification = @order.notification :email
notification.execute sender: 'control panel'
notification.confirm sender: 'control panel'

User:

user = Zuppler::User.find 'user_token'
user.details.name
user.details.name

User search:

users = Zuppler::User.search 'application_token', role: 'driver'
users.size
users.first.name

User vaults:

user = Zuppler::User.find 'user_token'
user.create_vault name: 'John', brand: 'visa', number: '1234', expiration_date: '11/2016', uid: 'abcd'
user.vaults.size

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request