Build Status Inline docs Code Climate

Color Wheel

A ruby client for the Colore document storage and conversion service. See the Colore documentation for a more detailed description of what Colore does and its API methods.


Add this line to your application's Gemfile:

gem 'colore-client', github: 'ifad/colore-client'

And then execute:



base_uri = 'http://localhost:9240/'
app = 'myapp'
client = base_uri: base_uri, app: app or abort "No connection to Colore"

doc_id = client.generate_doc_id
file ='foo.jpg')
content =

# Store a file
conversion_callback = 'http:/localhost:10000/foo' # you should have a listener on this port
resp = client.create_document(
  doc_id:       doc_id,
  filename:     file.path,
  content:      content,
  author:       'mrbloggs',
  actions:      ['pdf'],
  callback_url: conversion_callback )
puts resp.path

# Convert a file on the fly
pdf = client.convert content:, action: 'pdf' 'foo.pdf', 'wb' ) { |f| f.write(pdf) }

Available Methods

client.create_document doc_id:, filename:, content:, title:, author:, actions:[], callback_url
client.update_document doc_id:, version:, filename:, content:, title:, author:, actions:[], callback_url:
client.request_conversion doc_id:, version:, filename:, action: callback_url:
client.delete_document doc_id:
client.delete_version doc_id:, version:
client.get_document doc_id:, version:, filename:
client.get_document_info doc_id:
client.convert content:, action:, language:

See the YARD doc for more details


The client takes an optional Logger as an initialization parameter:

client = base_uri: base_uri, app: app, logger:

This can also be set at any time:

client.logger =