Class: TimeTree::Calendar
- Defined in:
- lib/timetree/models/calendar.rb
Overview
Model for TimeTree calendar.
Constant Summary collapse
- TIME_FIELDS =
%i[created_at].freeze
- RELATIONSHIPS =
%i[labels members].freeze
Instance Attribute Summary collapse
- #color ⇒ String
- #created_at ⇒ Time
- #description ⇒ String
- #image_url ⇒ String
- #name ⇒ String
- #order ⇒ Integer
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#event(event_id) ⇒ TimeTree::Event
Get the event’s information.
-
#labels ⇒ Array<TimeTree::Label>
Get a calendar’s label information used in event.
-
#members ⇒ Array<TimeTree::User>
Get a calendar’s member information.
-
#upcoming_events(days: 7, timezone: 'UTC') ⇒ Array<TimeTree::Event>
Get the events’ information after a request date.
Methods inherited from BaseModel
#initialize, #inspect, to_model
Constructor Details
This class inherits a constructor from TimeTree::BaseModel
Instance Attribute Details
#color ⇒ String
13 14 15 |
# File 'lib/timetree/models/calendar.rb', line 13 def color @color end |
#created_at ⇒ Time
19 20 21 |
# File 'lib/timetree/models/calendar.rb', line 19 def created_at @created_at end |
#description ⇒ String
11 12 13 |
# File 'lib/timetree/models/calendar.rb', line 11 def description @description end |
#image_url ⇒ String
17 18 19 |
# File 'lib/timetree/models/calendar.rb', line 17 def image_url @image_url end |
#name ⇒ String
9 10 11 |
# File 'lib/timetree/models/calendar.rb', line 9 def name @name end |
#order ⇒ Integer
15 16 17 |
# File 'lib/timetree/models/calendar.rb', line 15 def order @order end |
Instance Method Details
#event(event_id) ⇒ TimeTree::Event
Get the event’s information.
event’s id.
33 34 35 36 |
# File 'lib/timetree/models/calendar.rb', line 33 def event(event_id) check_client get_event(event_id) end |
#labels ⇒ Array<TimeTree::Label>
Get a calendar’s label information used in event.
75 76 77 78 79 80 |
# File 'lib/timetree/models/calendar.rb', line 75 def labels return @labels if defined? @labels check_client @labels = get_labels end |
#members ⇒ Array<TimeTree::User>
Get a calendar’s member information.
61 62 63 64 65 66 |
# File 'lib/timetree/models/calendar.rb', line 61 def members return @members if defined? @members check_client @members = get_members end |
#upcoming_events(days: 7, timezone: 'UTC') ⇒ Array<TimeTree::Event>
Get the events’ information after a request date.
The number of days to get. Timezone.
49 50 51 52 |
# File 'lib/timetree/models/calendar.rb', line 49 def upcoming_events(days: 7, timezone: 'UTC') check_client get_upcoming_event(days, timezone) end |