Class: Twitch::UserBan
- Inherits:
-
Object
- Object
- Twitch::UserBan
- Defined in:
- lib/twitch/user_ban.rb
Overview
Ban information for a user.
Constant Summary collapse
- DATE_ATTRIBUTES =
Fields to be converted from ISO 8601 string to a typed date.
%i[expires_at].freeze
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
readonly
Date of when the time-out will expire (nil for permanent bans).
-
#user_id ⇒ Object
readonly
ID of the banned/timed-out user.
-
#user_name ⇒ Object
readonly
Username of the banned/timed-out user.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ UserBan
constructor
A new instance of UserBan.
Constructor Details
#initialize(attributes = {}) ⇒ UserBan
Returns a new instance of UserBan.
16 17 18 19 20 21 22 23 24 |
# File 'lib/twitch/user_ban.rb', line 16 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
#expires_at ⇒ Object (readonly)
Date of when the time-out will expire (nil for permanent bans)
14 15 16 |
# File 'lib/twitch/user_ban.rb', line 14 def expires_at @expires_at end |
#user_id ⇒ Object (readonly)
ID of the banned/timed-out user.
10 11 12 |
# File 'lib/twitch/user_ban.rb', line 10 def user_id @user_id end |
#user_name ⇒ Object (readonly)
Username of the banned/timed-out user.
12 13 14 |
# File 'lib/twitch/user_ban.rb', line 12 def user_name @user_name end |