class Mattermost::Channel
Public Class Methods
all(force_refresh = false)
click to toggle source
Returns channels for the current team _that the logged in user has joined_ call Mattermost::Channel.more
to get a list of all the channels (like, actually)
@param force_refresh [boolean] to recache the channels
# File lib/mattermost/channel.rb, line 15 def self.all(force_refresh = false) @channels = nil if force_refresh @channels ||= all_channels end
counts()
click to toggle source
Returns a hash of counts This is mostly useless because fetching a channel will return the counts for you. {“counts”=>{“ps6kdfuk9p8mjx6pkr3krgq3by”=>58334, “yckjbepc4frbmmq9in6tap1dwa”=>32},
"update_times"=>{"ps6kdfuk9p8mjx6pkr3krgq3by"=>1463180151709, "yckjbepc4frbmmq9in6tap1dwa"=>1457216806189}}
# File lib/mattermost/channel.rb, line 35 def self.counts Mattermost.get("/channels/counts") end
create_direct(attributes = {})
click to toggle source
# File lib/mattermost/channel.rb, line 39 def self.create_direct(attributes = {}) raise NotImplementedError Mattermost.post("/channels/create_direct") end
more()
click to toggle source
Returns all of the channels for the current team Unlike self.all which only returns the channels the user has joined
# File lib/mattermost/channel.rb, line 22 def self.more channels = [] request = Mattermost.get("/teams/#{Mattermost.team.id}/channels/more") request.parsed_response['channels'].each do |channel| channels << self.new(channel) end return channels end
new(attributes = {})
click to toggle source
# File lib/mattermost/channel.rb, line 4 def self.new(attributes = {}) if attributes.empty? return ::Channel.default_attributes end ::Channel.new(attributes) end
Protected Class Methods
all_channels()
click to toggle source
# File lib/mattermost/channel.rb, line 45 def self.all_channels channels = [] request = Mattermost.get("/teams/#{Mattermost.team.id}/channels/") request.parsed_response['channels'].each do |channel| channels << self.new(channel) end return channels end