Class: Miu::Resources::TextContent

Inherits:
Content show all
Defined in:
lib/miu/resources/text_content.rb

Instance Attribute Summary collapse

Attributes inherited from Content

#meta, #raw

Instance Method Summary collapse

Methods inherited from Base

#to_msgpack

Constructor Details

#initialize(options = {}) ⇒ TextContent

Returns a new instance of TextContent.



8
9
10
11
12
13
# File 'lib/miu/resources/text_content.rb', line 8

def initialize(options = {})
  @room = Miu::Utility.adapt(Room, options[:room] || {})
  @user = Miu::Utility.adapt(User, options[:user] || {})
  @text = options[:text]
  super options
end

Instance Attribute Details

#roomObject

Returns the value of attribute room.



6
7
8
# File 'lib/miu/resources/text_content.rb', line 6

def room
  @room
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/miu/resources/text_content.rb', line 6

def text
  @text
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/miu/resources/text_content.rb', line 6

def user
  @user
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
# File 'lib/miu/resources/text_content.rb', line 15

def to_h
  super.merge({
    :room => @room.to_h,
    :user => @user.to_h,
    :text => @text
  })
end