Class: TimeTree::Calendar

Inherits:
BaseModel show all
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

Attributes inherited from BaseModel

#id, #relationships, #type

Instance Method Summary collapse

Methods inherited from BaseModel

#initialize, #inspect, to_model

Constructor Details

This class inherits a constructor from TimeTree::BaseModel

Instance Attribute Details

#colorString

Returns:

  • (String)


13
14
15
# File 'lib/timetree/models/calendar.rb', line 13

def color
  @color
end

#created_atTime

Returns:

  • (Time)


19
20
21
# File 'lib/timetree/models/calendar.rb', line 19

def created_at
  @created_at
end

#descriptionString

Returns:

  • (String)


11
12
13
# File 'lib/timetree/models/calendar.rb', line 11

def description
  @description
end

#image_urlString

Returns:

  • (String)


17
18
19
# File 'lib/timetree/models/calendar.rb', line 17

def image_url
  @image_url
end

#nameString

Returns:

  • (String)


9
10
11
# File 'lib/timetree/models/calendar.rb', line 9

def name
  @name
end

#orderInteger

Returns:

  • (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.

Parameters:

  • event_id (String)

Returns:

Raises:

Since:

  • 0.0.1



33
34
35
36
# File 'lib/timetree/models/calendar.rb', line 33

def event(event_id)
  check_client
  get_event(event_id)
end

#labelsArray<TimeTree::Label>

Get a calendar’s label information used in event.

Returns:

Raises:

Since:

  • 0.0.1



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

#membersArray<TimeTree::User>

Get a calendar’s member information.

Returns:

Raises:

Since:

  • 0.0.1



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.

Parameters:

  • days (Integer) (defaults to: 7)
  • timezone (String) (defaults to: 'UTC')

Returns:

Raises:

Since:

  • 0.0.1



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