Class: Twitch::ModerationEvent
- Inherits:
-
Object
- Object
- Twitch::ModerationEvent
- Defined in:
- lib/twitch/moderation_event.rb
Overview
Information about a moderation action. The action is determined based on the ‘event_type` field.
Constant Summary collapse
- DATE_ATTRIBUTES =
Fields to be converted from ISO 8601 string to a typed date.
%i[event_timestamp].freeze
Instance Attribute Summary collapse
-
#event_data ⇒ Object
readonly
A hash containing information about the moderation action.
-
#event_timestamp ⇒ Object
readonly
Time at which the event happened.
-
#event_type ⇒ Object
readonly
Event type.
-
#id ⇒ Object
readonly
ID of the moderation event.
-
#version ⇒ Object
readonly
Version of the endpoint the data was retrieved from.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ModerationEvent
constructor
A new instance of ModerationEvent.
Constructor Details
#initialize(attributes = {}) ⇒ ModerationEvent
Returns a new instance of ModerationEvent.
23 24 25 26 27 28 29 30 31 |
# File 'lib/twitch/moderation_event.rb', line 23 def initialize(attributes = {}) attributes.each do |key, value| if DATE_ATTRIBUTES.include?(key.to_sym) instance_variable_set "@#{key}", Time.parse(value) else instance_variable_set "@#{key}", value end end end |
Instance Attribute Details
#event_data ⇒ Object (readonly)
A hash containing information about the moderation action.
21 22 23 |
# File 'lib/twitch/moderation_event.rb', line 21 def event_data @event_data end |
#event_timestamp ⇒ Object (readonly)
Time at which the event happened.
17 18 19 |
# File 'lib/twitch/moderation_event.rb', line 17 def @event_timestamp end |
#event_type ⇒ Object (readonly)
Event type. The ‘moderation.user` prefix is for user bans and unbans in a channel. The `moderation.moderator` prefix is for addition and removal of moderators in a channel.
15 16 17 |
# File 'lib/twitch/moderation_event.rb', line 15 def event_type @event_type end |
#id ⇒ Object (readonly)
ID of the moderation event.
11 12 13 |
# File 'lib/twitch/moderation_event.rb', line 11 def id @id end |
#version ⇒ Object (readonly)
Version of the endpoint the data was retrieved from.
19 20 21 |
# File 'lib/twitch/moderation_event.rb', line 19 def version @version end |