Class: Candle::EventLoaderModel

Inherits:
Object
  • Object
show all
Defined in:
lib/candle/event_loader_model.rb

Class Method Summary collapse

Class Method Details

.Event(dtstart, dtend, summary, description, location, uid) ⇒ Object



7
8
9
# File 'lib/candle/event_loader_model.rb', line 7

def self.Event(dtstart, dtend, summary, description, location, uid)
  Event.new(:dtstart, :dtend, :summary, :description, :location, :uid)
end

.get_agenda_events(google_calendar_base_path, calendar_id, api_key, from, to) ⇒ Object

load events prepared for agenda view



12
13
14
15
16
17
18
19
# File 'lib/candle/event_loader_model.rb', line 12

def self.get_agenda_events(google_calendar_base_path, calendar_id, api_key, from, to)
  events = parse_calendar(google_calendar_base_path, calendar_id, api_key, from, to)
  spreaded_events = spread_multiday_events(events, from, to)

  sorted_events = (events + spreaded_events.to_a).sort_by do |el|
    [el.dtstart, el.summary]
  end
end

.get_month_events(google_calendar_base_path, calendar_id, api_key, from, to) ⇒ Object

load events for month view



22
23
24
25
26
27
28
# File 'lib/candle/event_loader_model.rb', line 22

def self.get_month_events(google_calendar_base_path, calendar_id, api_key, from, to)
  events = parse_calendar(google_calendar_base_path, calendar_id, api_key, from, to)

  sorted_events = (events).sort_by do |el|
    [el.dtstart, el.summary]
  end
end