module CUI8Tracks::Thing

Attributes

session[RW]

Public Class Methods

new(data = nil) click to toggle source
# File lib/cui8tracks/thing.rb, line 4
def initialize(data = nil)
  @data = data
end

Public Instance Methods

api() click to toggle source
# File lib/cui8tracks/thing.rb, line 12
def api
  session.api
end
data() click to toggle source
# File lib/cui8tracks/thing.rb, line 28
def data
  @data
end
id() click to toggle source
# File lib/cui8tracks/thing.rb, line 38
def id
  @data['id']
end
info(data = self.data) click to toggle source
# File lib/cui8tracks/thing.rb, line 32
def info(data = self.data)
  data.each_key{ |key|
    logger.info "#{self.class.to_s}::#{key} = #{data[key]}"
  }
end
logger() click to toggle source
# File lib/cui8tracks/thing.rb, line 8
def logger
  session.logger
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/cui8tracks/thing.rb, line 20
def method_missing(name, *args, &block)
  if data && data.has_key?(name.to_s)
    data[name.to_s]
  else
    super
  end
end
notify(title, message) click to toggle source
# File lib/cui8tracks/thing.rb, line 49
def notify(title, message)
  Notify.notify(title, message)
  # Thread.new {
  #   @@notifier = Growl.new 'localhost', 'ruby', ['notify']
  #   @@notifier.notify 'notify', title, message
  # }
end
path(method = '') click to toggle source
# File lib/cui8tracks/thing.rb, line 42
def path(method = '')
  classname = self.class.to_s.split(/::/).last.downcase
  classname += 'e' if classname =~ /x$/
  classname += 's'
  "/#{classname}/#{self.id}/" + method
end
set() click to toggle source
# File lib/cui8tracks/thing.rb, line 16
def set
  session.set
end