class Geckoboard

Constants

VERSION

Public Class Methods

comparison(first, second) click to toggle source
# File lib/geckoboard.rb, line 31
def self.comparison(first, second)
  widget item: [
    gecko_item('', first),
    gecko_item('', second)
  ]
end
funnel(funnel_items, other_attributes = {}) click to toggle source
# File lib/geckoboard.rb, line 58
def self.funnel(funnel_items, other_attributes = {})
  widget({item: funnel_items}.merge(other_attributes))
end
funnel_item(label, value) click to toggle source
# File lib/geckoboard.rb, line 62
def self.funnel_item(label, value)
  gecko_item(nil, value, { label: label })
end
geck_o_meter(value, max, min) click to toggle source
# File lib/geckoboard.rb, line 54
def self.geck_o_meter(value, max, min)
  widget item: value, max: max, min: min
end
gecko_item(text, value, other_attributes = {}) click to toggle source
# File lib/geckoboard.rb, line 6
def self.gecko_item(text, value, other_attributes = {})
  { text: text, value: value }.
    merge(other_attributes).
    reject { |_, attribute_value| attribute_value.nil? }
end
list_item(text, description, other_attributes = {}) click to toggle source
# File lib/geckoboard.rb, line 38
def self.list_item text, description, other_attributes = {}
  other_attributes.merge({title: { text: text }, description: description.to_s})
end
number(text, value) click to toggle source
# File lib/geckoboard.rb, line 19
def self.number(text, value)
  widget item: [
    gecko_item(text, value)
  ]
end
pie(pie_items) click to toggle source
# File lib/geckoboard.rb, line 46
def self.pie pie_items
  widget item: pie_items
end
pie_item(value, label, color = nil) click to toggle source
# File lib/geckoboard.rb, line 50
def self.pie_item(value, label, color = nil)
  gecko_item(nil, value, { label: label, color: color })
end
rag(red, amber, green) click to toggle source
# File lib/geckoboard.rb, line 42
def self.rag(red, amber, green)
  widget item: [red, amber, green]
end
text(text_value, other_attributes = {}) click to toggle source
# File lib/geckoboard.rb, line 25
def self.text(text_value, other_attributes = {})
  widget item: [
    gecko_item(text_value, nil, other_attributes)
  ]
end
trendline(text, value, trendline, gecko_item_attributes = {}) click to toggle source
# File lib/geckoboard.rb, line 12
def self.trendline(text, value, trendline, gecko_item_attributes = {})
  widget item: [
    gecko_item(text, value, gecko_item_attributes),
    trendline
  ]
end

Protected Class Methods

widget(widget) click to toggle source
# File lib/geckoboard.rb, line 68
def self.widget(widget)
  widget.to_json
end