Class: PlaylyfeClient::V2::TeamEvent::Base
- Defined in:
- lib/playlyfe_client/v2/event/team_event.rb,
lib/playlyfe_client/v2/event/team_event.rb
Direct Known Subclasses
ChangeOfRolesAcceptedEvent, ChangeOfRolesRejectedEvent, InviteAcceptedEvent, InviteRejectedEvent, InviteSendEvent, JoinAcceptedEvent, JoinRejectedEvent, JoinedEvent, KickedOutEvent, LeavedEvent, RequestForChangeOfRolesEvent, RequestToJoinEvent, RolesChangedEvent, TeamCreatedEvent, TeamDeletedEvent, TeamOwnershipTransferredEvent
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#from_player_alias ⇒ Object
(also: #actor_alias)
readonly
who trigger event (player or admin).
-
#from_player_id ⇒ Object
(also: #actor_id)
readonly
who trigger event (player or admin).
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#target_player_alias ⇒ Object
(also: #inviter_alias, #invitee_alias, #new_owner_alias, #player_alias)
readonly
who recieve effects of event.
-
#target_player_id ⇒ Object
(also: #inviter_id, #invitee_id, #new_owner_id, #player_id)
readonly
who recieve effects of event.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
-
#team_name ⇒ Object
readonly
Returns the value of attribute team_name.
Attributes inherited from Event
Class Method Summary collapse
Instance Method Summary collapse
- #from_player ⇒ Object (also: #actor)
- #target_player ⇒ Object (also: #inviter, #invitee, #new_owner, #player)
- #team ⇒ Object
- #two_player_event? ⇒ Boolean
Methods inherited from Event
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
8 9 10 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 8 def changes @changes end |
#from_player_alias ⇒ Object (readonly) Also known as: actor_alias
who trigger event (player or admin)
5 6 7 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 5 def from_player_alias @from_player_alias end |
#from_player_id ⇒ Object (readonly) Also known as: actor_id
who trigger event (player or admin)
5 6 7 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 5 def from_player_id @from_player_id end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
8 9 10 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 8 def roles @roles end |
#target_player_alias ⇒ Object (readonly) Also known as: inviter_alias, invitee_alias, new_owner_alias, player_alias
who recieve effects of event
6 7 8 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 6 def target_player_alias @target_player_alias end |
#target_player_id ⇒ Object (readonly) Also known as: inviter_id, invitee_id, new_owner_id, player_id
who recieve effects of event
6 7 8 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 6 def target_player_id @target_player_id end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id.
7 8 9 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 7 def team_id @team_id end |
#team_name ⇒ Object (readonly)
Returns the value of attribute team_name.
7 8 9 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 7 def team_name @team_name end |
Class Method Details
.build(ev_hash, game, player = nil) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 150 def self.build(ev_hash, game, player=nil) case ev_hash["event"] when "create" klass= TeamCreatedEvent when "delete" klass= TeamDeletedEvent when "join" klass= JoinedEvent when "join:request" klass= RequestToJoinEvent when "leave" klass= LeavedEvent when "role:change","role:assign" klass= RolesChangedEvent when "role:request" klass= RequestForChangeOfRolesEvent when "join:request:accept" klass= JoinAcceptedEvent when "role:request:accept" klass= ChangeOfRolesAcceptedEvent when "join:request:reject" klass= JoinRejectedEvent when "invite" klass= InviteSendEvent when "invite:accept" klass= InviteAcceptedEvent when "invite:reject" klass= InviteRejectedEvent when "kick" klass= KickedOutEvent when "transfer" klass= TeamOwnershipTransferredEvent else return nil end return klass.new(ev_hash, game, player) end |
Instance Method Details
#from_player ⇒ Object Also known as: actor
10 11 12 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 10 def from_player @from_player ||= (from_player_id.nil? ? nil : game.players.find(from_player_id) ) end |
#target_player ⇒ Object Also known as: inviter, invitee, new_owner, player
17 18 19 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 17 def target_player @tagert_player||= (target_player_id.nil? ? nil : game.players.find(target_player_id) ) end |
#team ⇒ Object
35 36 37 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 35 def team @team ||=(team_id.nil? ? nil : game.teams.find(team_id)) end |
#two_player_event? ⇒ Boolean
189 190 191 |
# File 'lib/playlyfe_client/v2/event/team_event.rb', line 189 def two_player_event? [JoinAcceptedEvent,ChangeOfRolesAcceptedEvent,InviteSendEvent,InviteAcceptedEvent,InviteRejectedEvent, KickedOutEvent,RolesChangedEvent,TeamOwnershipTransferredEvent].include?(self.class) end |