Class: Hipmost::Hipchat::Room
- Inherits:
-
Object
- Object
- Hipmost::Hipchat::Room
- Defined in:
- lib/hipmost/hipchat/room.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#team ⇒ Object
Returns the value of attribute team.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Room
constructor
A new instance of Room.
- #method_missing(method) ⇒ Object
- #posts ⇒ Object
- #private? ⇒ Boolean
- #users ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Room
Returns a new instance of Room.
29 30 31 32 33 34 35 |
# File 'lib/hipmost/hipchat/room.rb', line 29 def initialize(attrs) @id = attrs["id"] @name = attrs["name"].gsub(/\s/, "-").downcase @display_name = attrs["name"] @topic = attrs["topic"] @attrs = attrs end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
51 52 53 |
# File 'lib/hipmost/hipchat/room.rb', line 51 def method_missing(method) attrs[method.to_s] end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
36 37 38 |
# File 'lib/hipmost/hipchat/room.rb', line 36 def attrs @attrs end |
#channel ⇒ Object
Returns the value of attribute channel.
37 38 39 |
# File 'lib/hipmost/hipchat/room.rb', line 37 def channel @channel end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
36 37 38 |
# File 'lib/hipmost/hipchat/room.rb', line 36 def display_name @display_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36 37 38 |
# File 'lib/hipmost/hipchat/room.rb', line 36 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
36 37 38 |
# File 'lib/hipmost/hipchat/room.rb', line 36 def name @name end |
#team ⇒ Object
Returns the value of attribute team.
37 38 39 |
# File 'lib/hipmost/hipchat/room.rb', line 37 def team @team end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
36 37 38 |
# File 'lib/hipmost/hipchat/room.rb', line 36 def topic @topic end |
Instance Method Details
#posts ⇒ Object
47 48 49 |
# File 'lib/hipmost/hipchat/room.rb', line 47 def posts @posts ||= PostRepository.for_room(self) end |
#private? ⇒ Boolean
39 40 41 |
# File 'lib/hipmost/hipchat/room.rb', line 39 def private? privacy == "private" end |
#users ⇒ Object
43 44 45 |
# File 'lib/hipmost/hipchat/room.rb', line 43 def users @users ||= attrs["members"].map{|uid| Hipchat.users[uid] } end |