class Dimma::Channel
Missing method calls are delegated to the underlying RestClient::Resource
Attributes
name[R]
@return [String]
Public Class Methods
new(name, resource)
click to toggle source
Create a new Channel
resource.
@param [#to_s] name @param [RestClient::Resource] resource An object conformant with the RestClient API.
# File lib/dimma.rb, line 124 def initialize(name, resource) __setobj__ resource["channels/#{@name = name.to_s}"] end
Public Instance Methods
message(message)
click to toggle source
Sends a message to all users in the channel.
@param [#to_json] message Data to send to the channel. @return [RestClient::Response] @raise [RestClient::Exception]
# File lib/dimma.rb, line 133 def message(message) post message.to_json end
users()
click to toggle source
Retrieve all users in the channel.
@return [Array<User>] Array of users.
# File lib/dimma.rb, line 140 def users JSON.parse(get.body)["users"].map { |user| User.new(user, __getobj__) } end