Ruby

Start by downloading the most recent version of our Ruby API on Github. You can also check out our Ruby Gem on Github or RubyGems. You may also use gem to install the Leftronic package with gem install leftronicapi.

Create a class instance with your Access Key:

require 'rubygems'
require 'leftronic'
update = Leftronic.new "YOUR_ACCESS_KEY"

Try pushing to your dashboard with some of these functions, substituting the names of your custom widgets.

# Example: push a number to a widget
update.push_number "yourNumberStream", 14600
 
# Example: push a location to a map widget
update.push_geo "yourGeoStream", 37.8, -122.6
 
# Or choose a color for your map point (red, blue, green,
# purple, and yellow only)
update.push_geo "yourGeoStream", 37.8, -122.6, :blue
 
# Example: push a title and message to a text feed widget
update.push_text "yourTextStream", "This is my title.",
    "Hello World!"
 
# Example: push an array to a leaderboard widget
# the leaderboard requires a name => value hash
update.push_leaderboard "yourBoardStream", some_hash
update.push_leaderboard "yourBoardStream", 'Johnny' => 84,
    'Jamie' => 75, 'Lance' => 62
 
# Example: push an array to a list widget
update.push_list "yourListStream",'Elizabeth', 'Marshall',
    'Claire', 'Nolan'
 
# Example: push to an HTML widget
update.push_html "yourHtmlStream", "<html><body>Ruby rocks!</body><html>"
 
# Example: push to a table widget
header_row = ["Name", "City", "Country"]
table_rows = [["Lionel", "Rosario", "Argentina"],
    ["Andres", "Albacete", "Spain"]]
update.push_table "yourTableStream", header_row, table_rows
 
# Example: push to an image widget
update.push_image "yourImageStream", "http://goo.gl/uqHsk"
 
# Example: push to a label widget
update.push_label "yourLabelStream", "This is your label!"
 
# Example: push to an XY graph widget
x = [1, 2, 3]
y = [4, 5, 6]
update.push_pair "yourXYStream", x, y
 
# Example: clear a widget
update.clear "yourStreamName"