Class: Google::CalendarListEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/google/calendar_list_entry.rb

Overview

Represents a Google Calendar List Entry

See developers.google.com/google-apps/calendar/v3/reference/calendarList#resource

Attributes

  • id - The Google assigned id of the calendar. Read only.

  • summary - Title of the calendar. Read-only.

  • time_zone - The time zone of the calendar. Optional. Read-only.

  • access_role - The effective access role that the authenticated user has on the calendar. Read-only.

  • primary? - Whether the calendar is the primary calendar of the authenticated user. Read-only.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, connection) ⇒ CalendarListEntry

Returns a new instance of CalendarListEntry.


20
21
22
23
24
25
26
27
# File 'lib/google/calendar_list_entry.rb', line 20

def initialize(params, connection)
  @id = params['id']
  @summary = params['summary']
  @time_zone = params['timeZone']
  @access_role = params['accessRole']
  @primary = params.fetch('primary', false)
  @connection = connection
end

Instance Attribute Details

#access_roleObject (readonly)

Returns the value of attribute access_role


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def access_role
  @access_role
end

#connectionObject (readonly)

Returns the value of attribute connection


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def connection
  @connection
end

#idObject (readonly)

Returns the value of attribute id


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def id
  @id
end

#primaryObject (readonly) Also known as: primary?

Returns the value of attribute primary


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def primary
  @primary
end

#summaryObject (readonly)

Returns the value of attribute summary


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def summary
  @summary
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone


17
18
19
# File 'lib/google/calendar_list_entry.rb', line 17

def time_zone
  @time_zone
end

Class Method Details

.build_from_google_feed(response, connection) ⇒ Object


33
34
35
36
# File 'lib/google/calendar_list_entry.rb', line 33

def self.build_from_google_feed(response, connection)
  items = response['items']
  items.collect { |item| CalendarListEntry.new(item, connection) }
end

Instance Method Details

#to_calendarObject


29
30
31
# File 'lib/google/calendar_list_entry.rb', line 29

def to_calendar
  Calendar.new({:calendar => @id}, @connection)
end