Sha256: c25571363e14a97af74d1745a75d0ffc33ab80dd98c05832a99cc6ef3816907d

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

class Databox::Integration < Databox::Client

  attr_accessor :name, :list, :date

  def initialize name, options={date: nil, id: nil}
    super()
    @name = name

    @date   = options[:date]  unless options[:date].nil?
    @token  = options[:id]    unless options[:id].nil?

    @list = []
  end

  def save
    if push(to_data).success?
      @list = []
      true
    else
      false
    end
  end

end

#TODO: Add support for icons
class Databox::Messages < Databox::Integration

  def add message
    @list.push message
  end

  def to_data
    { key: "#{name}", value: list }
  end

end

#TODO: Add support for icons
#TODO: Add support for changes
class Databox::Pipeline < Databox::Integration

  def add message, value
    @list.push [message, value]
  end

  def to_data
    [
      { key: "#{name}@labels", value: list.map(&:first)     },
      { key: "#{name}@values", value: list.map{|e| e[1] }   },
    ]
  end

end

#TODO: Add support for icons
#TODO: Add support for changes
class Databox::Funnel < Databox::Pipeline; end;
class Databox::Pie < Databox:: Pipeline; end;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
databox-0.0.3 lib/databox/integration.rb