Class: PlaylyfeClient::V2::ProcessEvent::Base
- Inherits:
-
Event
- Object
- Event
- PlaylyfeClient::V2::ProcessEvent::Base
show all
- Defined in:
- lib/playlyfe_client/v2/event/process_event.rb,
lib/playlyfe_client/v2/event/process_event.rb
Direct Known Subclasses
ChangeOfRolesAcceptedEvent, ChangeOfRolesRejectedEvent, InviteAcceptedEvent, InviteRejectedEvent, InviteSendEvent, JoinAcceptedEvent, JoinRejectedEvent, JoinedEvent, KickedOutEvent, LeavedEvent, ProcessCreatedEvent, ProcessDeletedEvent, ProcessOwnershipTransferredEvent, ProgressEvent, RequestForChangeOfRolesEvent, RequestToJoinEvent, ResolutionEvent, RolesChangedEvent
Instance Attribute Summary
Attributes inherited from Event
#event, #game, #timestamp
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Event
#created_at
Class Method Details
.build(ev_hash, game, process = nil) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/playlyfe_client/v2/event/process_event.rb', line 36
def self.build(ev_hash, game, process=nil)
case ev_hash["event"]
when "create"
klass= ProcessCreatedEvent
when "delete"
klass= ProcessDeletedEvent
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= ProcessOwnershipTransferredEvent
when "progress"
klass=ProgressEvent
when "resolution"
klass=ResolutionEvent
else
return nil
end
return klass.new(ev_hash, game, player)
end
|
Instance Method Details
#two_player_event? ⇒ Boolean
79
80
81
|
# File 'lib/playlyfe_client/v2/event/process_event.rb', line 79
def two_player_event?
[JoinAcceptedEvent,ChangeOfRolesAcceptedEvent,InviteSendEvent,InviteAcceptedEvent,InviteRejectedEvent, KickedOutEvent,RolesChangedEvent,TeamOwnershipTransferredEvent].include?(self.class)
end
|