Class: TimeTree::Event
Overview
Model for TimeTree event or keep.
Constant Summary
collapse
- TIME_FIELDS =
%i[start_at end_at updated_at created_at].freeze
- RELATIONSHIPS =
%i[creator label attendees].freeze
Instance Attribute Summary collapse
Attributes inherited from BaseModel
#id, #relationships, #type
Instance Method Summary
collapse
Methods inherited from BaseModel
#initialize, #inspect, to_model
Instance Attribute Details
#all_day ⇒ Boolean
13
14
15
|
# File 'lib/timetree/models/event.rb', line 13
def all_day
@all_day
end
|
45
46
47
|
# File 'lib/timetree/models/event.rb', line 45
def attendees
@attendees
end
|
#calendar_id ⇒ String
38
39
40
|
# File 'lib/timetree/models/event.rb', line 38
def calendar_id
@calendar_id
end
|
#category ⇒ Striing
9
10
11
|
# File 'lib/timetree/models/event.rb', line 9
def category
@category
end
|
#created_at ⇒ Time
35
36
37
|
# File 'lib/timetree/models/event.rb', line 35
def created_at
@created_at
end
|
41
42
43
|
# File 'lib/timetree/models/event.rb', line 41
def creator
@creator
end
|
#description ⇒ String
27
28
29
|
# File 'lib/timetree/models/event.rb', line 27
def description
@description
end
|
#end_at ⇒ Time
19
20
21
|
# File 'lib/timetree/models/event.rb', line 19
def end_at
@end_at
end
|
#end_timezone ⇒ String
21
22
23
|
# File 'lib/timetree/models/event.rb', line 21
def end_timezone
@end_timezone
end
|
43
44
45
|
# File 'lib/timetree/models/event.rb', line 43
def label
@label
end
|
#location ⇒ String
29
30
31
|
# File 'lib/timetree/models/event.rb', line 29
def location
@location
end
|
#recurrence ⇒ Array<String>
23
24
25
|
# File 'lib/timetree/models/event.rb', line 23
def recurrence
@recurrence
end
|
#recurring_uuid ⇒ String
25
26
27
|
# File 'lib/timetree/models/event.rb', line 25
def recurring_uuid
@recurring_uuid
end
|
#start_at ⇒ Time
15
16
17
|
# File 'lib/timetree/models/event.rb', line 15
def start_at
@start_at
end
|
#start_timezone ⇒ Striing
17
18
19
|
# File 'lib/timetree/models/event.rb', line 17
def start_timezone
@start_timezone
end
|
#title ⇒ Striing
11
12
13
|
# File 'lib/timetree/models/event.rb', line 11
def title
@title
end
|
#updated_at ⇒ Time
33
34
35
|
# File 'lib/timetree/models/event.rb', line 33
def updated_at
@updated_at
end
|
#url ⇒ String
31
32
33
|
# File 'lib/timetree/models/event.rb', line 31
def url
@url
end
|
Instance Method Details
Creates an event to the associated calendar.
57
58
59
60
|
# File 'lib/timetree/models/event.rb', line 57
def create
check_client
_create_event
end
|
Creates comment to the event.
93
94
95
96
97
98
|
# File 'lib/timetree/models/event.rb', line 93
def (message)
check_client
params = {type: 'activity', attributes: {calendar_id: calendar_id, event_id: id, content: message}}
activity = to_model params
activity.create
end
|
#data_params ⇒ Hash
convert to a TimeTree request body format.
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/timetree/models/event.rb', line 105
def data_params
{
data: {
attributes: {
category: category,
title: title,
all_day: all_day,
start_at: start_at.iso8601,
start_timezone: start_timezone,
end_at: end_at.iso8601,
end_timezone: end_timezone,
description: description,
location: location,
url: url
},
relationships: relationships_params
}
}
end
|
#delete ⇒ true
81
82
83
84
|
# File 'lib/timetree/models/event.rb', line 81
def delete
check_client
_delete_event
end
|
69
70
71
72
|
# File 'lib/timetree/models/event.rb', line 69
def update
check_client
_update_event
end
|