Class: Mattermost::MattermostObject
- Inherits:
-
Object
- Object
- Mattermost::MattermostObject
- Defined in:
- lib/mattermost/mattermost_object.rb
Overview
:nodoc: all
Class Method Summary collapse
-
.find(id) ⇒ Object
Return the user that has an id of @param id.
-
.find_by(opts = {}) ⇒ Object
Return an object that matches a given attribute.
-
.method_missing(method_id, *args) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize ⇒ MattermostObject
constructor
A new instance of MattermostObject.
Constructor Details
#initialize ⇒ MattermostObject
4 5 |
# File 'lib/mattermost/mattermost_object.rb', line 4 def initialize end |
Class Method Details
.find(id) ⇒ Object
Return the user that has an id of @param id
14 15 16 |
# File 'lib/mattermost/mattermost_object.rb', line 14 def self.find(id) find_by(:id => id) end |
.find_by(opts = {}) ⇒ Object
Return an object that matches a given attribute. Return nil if no matches
9 10 11 |
# File 'lib/mattermost/mattermost_object.rb', line 9 def self.find_by(opts = {}) all.select { |obj| obj.send(opts.keys.first) == opts.values.first }.first end |
.method_missing(method_id, *args) ⇒ Object
:nodoc:
19 20 21 22 23 24 |
# File 'lib/mattermost/mattermost_object.rb', line 19 def method_missing(method_id, *args) #:nodoc: o = self.new o.send(method_id, *args) rescue HTTParty::UnsupportedURIScheme raise "You must set Mattermost.connect before calling #{self.inspect}##{method_id}" end |