Skip to content

Instantly share code, notes, and snippets.

@laser laser/batch.rb
Last active Aug 29, 2015

What would you like to do?
Batch Client - Ruby
#!/usr/bin/env ruby
require 'barrister'
trans ="http://localhost:3000/v1/todos")
client =
batch = client.start_batch()
batch.TodoManager.createTodo({ 'title' => 'Call Mom', 'completed' => false })
batch.TodoManager.createTodo({ 'title' => 'Call Dad', 'completed' => false })
batch.TodoManager.createTodo({ 'title' => 'Wash car', 'completed' => false })
batch.TodoManager.createTodo({ 'title' => 'Eat Ham', 'completed' => false })
result = batch.send
result.each do |r|
# either r.error or r.result will be set
if r.error
# r.error is a Barrister::RpcException, so you can raise it if desired
puts "err.code=#{r.error.code}"
# result from a successful call
puts r.result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.