This repository has been archived by the owner on Nov 23, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
calendar.rb
78 lines (64 loc) · 2.07 KB
/
calendar.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
78
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
$LOAD_PATH.unshift(File.dirname(__FILE__))
module Wowr
module Classes
class CommonCalendar
attr_reader :summary, :calendar_type, :start, :icon
def initialize(json, api = nil)
@summary = json["summary"]
@calendar_type = json["calendarType"]
@start = Time.at((json["start"] / 1000).floor)
@icon = json["icon"]
end
end
class WorldCalendar < CommonCalendar
attr_reader :end, :description, :priority
def initialize(json, api = nil)
super(json, api)
@end = Time.at((json["end"] / 1000).floor)
@description = json["description"]
@priority = json["priority"]
end
end
class UserCommonCalendar < CommonCalendar
attr_reader :type, :owner, :moderator, :id
def initialize(json, api = nil)
super(json, api)
@type = json["type"]
@owner = json["owner"]
@moderator = json["moderator"] if json["moderator"]
@id = json["id"]
end
end
class UserCalendar < UserCommonCalendar
attr_reader :inviter, :status
def initialize(json, api = nil)
super(json, api)
@inviter = json["inviter"]
@status = json["status"]
end
end
class UserDetailCalendar < UserCommonCalendar
attr_reader :locked, :description, :invites
def initialize(json, api = nil)
super(json, api)
@locked = json["locked"]
@description = json["description"]
@invites = []
json["invites"].each do |invitee|
@invites << UserDetailInvitee.new(invitee, api)
end
end
end
class UserDetailInvitee
attr_reader :class_id, :status, :moderator, :invitee, :id
def initialize(json, api = nil)
@class_id = json["class_id"]
@status = json["status"]
@moderator = json["moderator"]
@invitee = json["invitee"]
@id = json["id"]
end
end
end
end