Class: Hipmost::Hipchat::Room

Inherits:
Object
  • Object
show all
Defined in:
lib/hipmost/hipchat/room.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attrsObject (readonly)

Returns the value of attribute attrs.



36
37
38
# File 'lib/hipmost/hipchat/room.rb', line 36

def attrs
  @attrs
end

#channelObject

Returns the value of attribute channel.



37
38
39
# File 'lib/hipmost/hipchat/room.rb', line 37

def channel
  @channel
end

#display_nameObject (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

#idObject (readonly)

Returns the value of attribute id.



36
37
38
# File 'lib/hipmost/hipchat/room.rb', line 36

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



36
37
38
# File 'lib/hipmost/hipchat/room.rb', line 36

def name
  @name
end

#teamObject

Returns the value of attribute team.



37
38
39
# File 'lib/hipmost/hipchat/room.rb', line 37

def team
  @team
end

#topicObject (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

#postsObject



47
48
49
# File 'lib/hipmost/hipchat/room.rb', line 47

def posts
  @posts ||= PostRepository.for_room(self)
end

#private?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/hipmost/hipchat/room.rb', line 39

def private?
  privacy == "private"
end

#usersObject



43
44
45
# File 'lib/hipmost/hipchat/room.rb', line 43

def users
  @users ||= attrs["members"].map{|uid| Hipchat.users[uid] }
end