Class: ICalPal::Calendar

Inherits:
Object
  • Object
show all
Includes:
ICalPal
Defined in:
lib/calendar.rb

Overview

Class representing items from the Calendar table

Constant Summary collapse

QUERY =
<<~SQL.freeze
SELECT DISTINCT

s1.name AS account,

c1.UUID,
c1.title AS calendar,

c1.shared_owner_name,
c1.shared_owner_address,

json_group_array(i1.display_name) AS sharees,

c1.published_URL,
c1.self_identity_email,
c1.owner_identity_email,
c1.notes,
c1.subcal_account_id,
c1.subcal_url,
c1.locale

FROM #{self.name.split('::').last} c1

JOIN Store s1 ON c1.store_id = s1.rowid
LEFT OUTER JOIN Sharee s2 ON c1.rowid = s2.owner_id
LEFT OUTER JOIN Identity i1 ON s2.identity_id = i1.rowid

WHERE s1.disabled IS NOT 1
AND s1.display_order IS NOT -1
AND c1.flags IS NOT 519

GROUP BY c1.title
SQL

Constants included from ICalPal

DOW, ITIME, NAME, VERSION

Instance Attribute Summary

Attributes included from ICalPal

#self

Instance Method Summary collapse

Methods included from ICalPal

#<=>, #[]=, call, #dump, #keys, load_data, nth, #to_csv, #to_xml, #values

Constructor Details

#initialize(obj) ⇒ Calendar

Returns a new instance of Calendar.



15
16
17
18
19
# File 'lib/calendar.rb', line 15

def initialize(obj)
  super

  @self['sharees'] = JSON.parse(obj['sharees'])
end

Instance Method Details

#[](k) ⇒ Object



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

def [](k)
  case k
  when 'name', 'title'      # Aliases
    @self['calendar']

  else @self[k]
  end
end