Sha256: 52027d4ebdd762046e8beebc896ac77743902247a0b531d251d59402c7a644c5
Contents?: true
Size: 1007 Bytes
Versions: 2
Compression:
Stored size: 1007 Bytes
Contents
module Protolink class Channel attr_reader :id, :name, :description def initialize(connection, attributes = {}) @connection = connection @id = attributes['id'] @name = attributes['name'] @description = attributes['description'] @loaded = false end # Post a new message to the chat channel def speak(message, options = {}) send_message(message) end protected def load reload! unless @loaded end # does not work yet def reload! attributes = connection.get("/api/v1/channels/#{@id}.json")['channel'] @id = attributes['id'] @name = attributes['name'] @description = attributes['description'] @loaded = true end def send_message(message) connection.post("/api/v1/meeps/create", {:channel_id => self.id, :message => message}) end def connection @connection end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
protolink-0.1.1 | lib/protolink/channel.rb |
protolink-0.1.0 | lib/protolink/channel.rb |