Class: MPXJ::Calendar

Inherits:
Container show all
Defined in:
lib/mpxj/calendar.rb

Overview

Represents a calendar

Instance Attribute Summary collapse

Attributes inherited from Container

#attribute_values, #parent_project

Instance Method Summary collapse

Constructor Details

#initialize(parent_project, attribute_values) ⇒ Calendar

Returns a new instance of Calendar.



8
9
10
11
12
13
# File 'lib/mpxj/calendar.rb', line 8

def initialize(parent_project, attribute_values)
  super(parent_project, attribute_values.slice('unique_id', 'guid', 'parent_unique_id', 'name', 'type', 'personal', 'minutes_per_day', 'minutes_per_week', 'minutes_per_month', 'minutes_per_year'))
  process_days(attribute_values)
  process_weeks(attribute_values)
  process_exceptions(attribute_values)
end

Instance Attribute Details

#daysObject (readonly)

Returns the value of attribute days.



4
5
6
# File 'lib/mpxj/calendar.rb', line 4

def days
  @days
end

#exceptionsObject (readonly)

Returns the value of attribute exceptions.



6
7
8
# File 'lib/mpxj/calendar.rb', line 6

def exceptions
  @exceptions
end

#weeksObject (readonly)

Returns the value of attribute weeks.



5
6
7
# File 'lib/mpxj/calendar.rb', line 5

def weeks
  @weeks
end

Instance Method Details

#guidString

Retrieve the calendar GUID

Returns:

  • (String)

    the calendar GUID



25
26
27
# File 'lib/mpxj/calendar.rb', line 25

def guid
  attribute_values['guid']
end

#minutes_per_dayInteger?

Retrieve the number of minutes per day

Returns:

  • (Integer)

    the number of minutes per day

  • (nil)

    if this calendar does not provide a value for minutes per day



70
71
72
# File 'lib/mpxj/calendar.rb', line 70

def minutes_per_day
  get_nillable_integer_value(attribute_values['minutes_per_day'])
end

#minutes_per_monthInteger?

Retrieve the number of minutes per month

Returns:

  • (Integer)

    the number of minutes per month

  • (nil)

    if this calendar does not provide a value for minutes per month



86
87
88
# File 'lib/mpxj/calendar.rb', line 86

def minutes_per_month
  get_nillable_integer_value(attribute_values['minutes_per_month'])
end

#minutes_per_weekInteger?

Retrieve the number of minutes per week

Returns:

  • (Integer)

    the number of minutes per week

  • (nil)

    if this calendar does not provide a value for minutes per week



78
79
80
# File 'lib/mpxj/calendar.rb', line 78

def minutes_per_week
  get_nillable_integer_value(attribute_values['minutes_per_week'])
end

#minutes_per_yearInteger?

Retrieve the number of minutes per year

Returns:

  • (Integer)

    the number of minutes per year

  • (nil)

    if this calendar does not provide a value for minutes per year



94
95
96
# File 'lib/mpxj/calendar.rb', line 94

def minutes_per_year
  get_nillable_integer_value(attribute_values['minutes_per_year'])
end

#nameString

Retrieve the calendar name

Returns:

  • (String)

    the calendar name



48
49
50
# File 'lib/mpxj/calendar.rb', line 48

def name
  attribute_values['name']
end

#parent_calendarCalendar?

Retrieve the parent calendar of this calendar

Returns:

  • (Calendar)

    if this calendar is the child of another calendar

  • (nil)

    if this is a base calendar



41
42
43
# File 'lib/mpxj/calendar.rb', line 41

def parent_calendar
  parent_project.get_calendar_by_unique_id(attribute_values['parent_unique_id']&.to_i)
end

#parent_unique_idInteger?

Retrieve the parent calendar unique ID

Returns:

  • (Integer)

    the parent calendar unique ID

  • (nil)

    if the calendar does not have a parent



33
34
35
# File 'lib/mpxj/calendar.rb', line 33

def parent_unique_id
  get_nillable_integer_value(attribute_values['parent_unique_id'])
end

#personalBoolean

Retrieve the personal flag

Returns:

  • (Boolean)

    true if this is a personal calendar



62
63
64
# File 'lib/mpxj/calendar.rb', line 62

def personal
  get_boolean_value(attribute_values['personal'])
end

#typeString

Retrieve the calendar type

Returns:

  • (String)

    the calendar type



55
56
57
# File 'lib/mpxj/calendar.rb', line 55

def type
  attribute_values['type']
end

#unique_idInteger

Retrieve the calendar unique ID

Returns:

  • (Integer)

    the calendar unique ID



18
19
20
# File 'lib/mpxj/calendar.rb', line 18

def unique_id
  get_integer_value(attribute_values['unique_id'])
end