Module: Gecko::Pusher

Defined in:
lib/gecko-pusher.rb,
lib/gecko-pusher/version.rb,
lib/gecko-pusher/channel/map.rb,
lib/gecko-pusher/channel/rag.rb,
lib/gecko-pusher/channel/base.rb,
lib/gecko-pusher/channel/text.rb,
lib/gecko-pusher/channel/number.rb,
lib/gecko-pusher/channel/rag_col.rb,
lib/gecko-pusher/channel/line_chart.rb,
lib/gecko-pusher/channel/gecko_meter.rb

Defined Under Namespace

Modules: Channel Classes: NotInitializedError

Constant Summary collapse

CHANNEL_TYPES =
[
  :text, :map, :number, :rag, :rag_col, :line_chart,
  :pie_chart, :gecko_meter, :funnel, :bullet
]
TEXT_NONE =
0
TEXT_ALERT =
1
TEXT_INFO =
2
TEXT_TYPES =
[TEXT_NONE, TEXT_ALERT, TEXT_INFO]
VERSION =
"0.0.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



24
25
26
# File 'lib/gecko-pusher.rb', line 24

def api_key
  @api_key
end

Class Method Details

.channel(widget_type, widget_key) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/gecko-pusher.rb', line 26

def channel(widget_type, widget_key)
  raise NotInitializedError if api_key.nil?
  raise ArgumentError.new("widget_key cannot be nil") if widget_key.nil?
  raise ArgumentError unless CHANNEL_TYPES.include?(widget_type)

  "Gecko::Pusher::Channel::#{widget_type.to_s.camelize}".constantize.new(widget_key)
end

.connectionObject



34
35
36
37
38
# File 'lib/gecko-pusher.rb', line 34

def connection
  @connection ||= Faraday.new(:url => "https://push.geckoboard.com") do |builder|
    builder.adapter :net_http
  end
end