Class: Mattermost::Post

Inherits:
MattermostObject show all
Defined in:
lib/mattermost/post.rb

Class Method Summary collapse

Methods inherited from MattermostObject

find, find_by, #initialize, method_missing

Constructor Details

This class inherits a constructor from Mattermost::MattermostObject

Class Method Details

.new(attributes = {}) ⇒ Object



4
5
6
# File 'lib/mattermost/post.rb', line 4

def self.new(attributes = {})
  ::Post.new(attributes)
end

.search(terms) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/mattermost/post.rb', line 8

def self.search(terms)
  request = Mattermost.post("/teams/#{Mattermost.team.id}/posts/search", :body => { :terms => terms }.to_json)
  response = []
  request.parsed_response['posts'].each do |_, post|
    response << self.new(post)
  end
  response 
end