Class: Mattermost::Channel
- Inherits:
-
MattermostObject
- Object
- MattermostObject
- Mattermost::Channel
- Defined in:
- lib/mattermost/channel.rb
Class Method Summary collapse
-
.all(force_refresh = false) ⇒ Object
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).
-
.counts ⇒ Object
Returns a hash of counts This is mostly useless because fetching a channel will return the counts for you.
- .create_direct(attributes = {}) ⇒ Object
-
.more ⇒ Object
Returns all of the channels for the current team Unlike self.all which only returns the channels the user has joined.
- .new(attributes = {}) ⇒ Object
Methods inherited from MattermostObject
find, find_by, #initialize, method_missing
Constructor Details
This class inherits a constructor from Mattermost::MattermostObject
Class Method Details
.all(force_refresh = false) ⇒ Object
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)
15 16 17 18 |
# File 'lib/mattermost/channel.rb', line 15 def self.all(force_refresh = false) @channels = nil if force_refresh @channels ||= all_channels end |
.counts ⇒ Object
Returns a hash of counts This is mostly useless because fetching a channel will return the counts for you. “yckjbepc4frbmmq9in6tap1dwa”=>32,
"update_times"=>{"ps6kdfuk9p8mjx6pkr3krgq3by"=>1463180151709, "yckjbepc4frbmmq9in6tap1dwa"=>1457216806189}}
35 36 37 |
# File 'lib/mattermost/channel.rb', line 35 def self.counts Mattermost.get("/channels/counts") end |
.create_direct(attributes = {}) ⇒ Object
39 40 41 42 |
# File 'lib/mattermost/channel.rb', line 39 def self.create_direct(attributes = {}) raise NotImplementedError Mattermost.post("/channels/create_direct") end |
.more ⇒ Object
Returns all of the channels for the current team Unlike self.all which only returns the channels the user has joined
22 23 24 25 26 27 28 29 |
# 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 = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/mattermost/channel.rb', line 4 def self.new(attributes = {}) if attributes.empty? return ::Channel.default_attributes end ::Channel.new(attributes) end |