Class: Line::Bot::Event
- Inherits:
-
Object
- Object
- Line::Bot::Event
- Defined in:
- lib/line/bot/event.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
-
#from_channel_id ⇒ Object
readonly
Returns the value of attribute from_channel_id.
-
#from_mid ⇒ Object
readonly
Returns the value of attribute from_mid.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#to_channel_id ⇒ Object
readonly
Returns the value of attribute to_channel_id.
-
#to_mid ⇒ Object
readonly
Returns the value of attribute to_mid.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Event
constructor
A new instance of Event.
- #valid? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Event
Returns a new instance of Event.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/line/bot/event.rb', line 7 def initialize( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end @id ||= @data['id'] @from_mid ||= @data['from'] @to_mid ||= @data['to'] @content = parse_content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def content @content end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def event_type @event_type end |
#from_channel_id ⇒ Object (readonly)
Returns the value of attribute from_channel_id.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def from_channel_id @from_channel_id end |
#from_mid ⇒ Object (readonly)
Returns the value of attribute from_mid.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def from_mid @from_mid end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def id @id end |
#to_channel_id ⇒ Object (readonly)
Returns the value of attribute to_channel_id.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def to_channel_id @to_channel_id end |
#to_mid ⇒ Object (readonly)
Returns the value of attribute to_mid.
5 6 7 |
# File 'lib/line/bot/event.rb', line 5 def to_mid @to_mid end |
Instance Method Details
#valid? ⇒ Boolean
19 20 21 |
# File 'lib/line/bot/event.rb', line 19 def valid? !@event_type.nil? && !@content.nil? end |