Class: Teamlab::Calendar

Inherits:
Object
  • Object
show all
Defined in:
lib/teamlab/modules/calendar.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ Calendar

Returns a new instance of Calendar.



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

def initialize(config = nil)
  @request = Teamlab::Request.new(config, 'calendar')
end

Instance Method Details

#add_event(calendar_id, name, options = {}) ⇒ Object



57
58
59
# File 'lib/teamlab/modules/calendar.rb', line 57

def add_event(calendar_id, name, options = {})
  @request.post([calendar_id.to_s, 'event'], { name: name }.merge(options))
end

#add_icsevent(calendar_id, ics, options = {}) ⇒ Object



61
62
63
# File 'lib/teamlab/modules/calendar.rb', line 61

def add_icsevent(calendar_id, ics, options = {})
  @request.post(['icsevent'], { calendarId: calendar_id.to_s, ics: ics.to_s }.merge(options))
end

#create_calendar(name, time_zone, options = {}) ⇒ Object



49
50
51
# File 'lib/teamlab/modules/calendar.rb', line 49

def create_calendar(name, time_zone, options = {})
  @request.post('', { name: name, timeZone: time_zone }.merge(options))
end


53
54
55
# File 'lib/teamlab/modules/calendar.rb', line 53

def create_calendar_by_ical_link(ical_url, name, options = {})
  @request.post(%w[calendarurl], { iCalUrl: ical_url, name: name }.merge(options))
end

#delete_calendar(calendar_id) ⇒ Object



93
94
95
# File 'lib/teamlab/modules/calendar.rb', line 93

def delete_calendar(calendar_id)
  @request.delete([calendar_id.to_s])
end

#delete_event(event_id, options = {}) ⇒ Object Also known as: remove_event



101
102
103
# File 'lib/teamlab/modules/calendar.rb', line 101

def delete_event(event_id, options = {})
  @request.delete(['events', event_id.to_s, 'custom'], options)
end

#delete_event_series(event_id) ⇒ Object



97
98
99
# File 'lib/teamlab/modules/calendar.rb', line 97

def delete_event_series(event_id)
  @request.delete(['events', event_id.to_s])
end

#get_access_parameters(calendar_id) ⇒ Object



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

def get_access_parameters(calendar_id)
  @request.get([calendar_id.to_s, 'sharing'])
end

#get_calendar(id) ⇒ Object



13
14
15
# File 'lib/teamlab/modules/calendar.rb', line 13

def get_calendar(id)
  @request.get([id.to_s])
end

#get_calendar_events(start_date, end_date) ⇒ Object



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

def get_calendar_events(start_date, end_date)
  @request.get(['eventdays', start_date.to_s, end_date.to_s])
end

#get_calendars_and_subscriptions(start_date, end_date) ⇒ Object



45
46
47
# File 'lib/teamlab/modules/calendar.rb', line 45

def get_calendars_and_subscriptions(start_date, end_date)
  @request.get(['calendars', start_date.to_s, end_date.to_s])
end

#get_default_accessObject



9
10
11
# File 'lib/teamlab/modules/calendar.rb', line 9

def get_default_access
  @request.get(%w[sharing])
end

#get_event_history_by_id(event_id) ⇒ Object



29
30
31
# File 'lib/teamlab/modules/calendar.rb', line 29

def get_event_history_by_id(event_id)
  @request.get(['events', event_id.to_s, 'historybyid'])
end

#get_event_history_by_uid(event_uid) ⇒ Object



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

def get_event_history_by_uid(event_uid)
  @request.get(['events', event_uid.to_s, 'historybyuid'])
end

#get_icalc_feed(calendar_id, signature) ⇒ Object



37
38
39
# File 'lib/teamlab/modules/calendar.rb', line 37

def get_icalc_feed(calendar_id, signature)
  @request.get([calendar_id.to_s, 'ical', signature.to_s])
end


21
22
23
# File 'lib/teamlab/modules/calendar.rb', line 21

def get_icalc_link(calendar_id)
  @request.get([calendar_id.to_s, 'icalurl'])
end

#get_subscription_listObject



17
18
19
# File 'lib/teamlab/modules/calendar.rb', line 17

def get_subscription_list
  @request.get(%w[subscriptions])
end

#import_events(calendar_id, ical) ⇒ Object



69
70
71
# File 'lib/teamlab/modules/calendar.rb', line 69

def import_events(calendar_id, ical)
  @request.post(['importIcs'], calendarId: calendar_id.to_s, iCalString: ical.to_s)
end

#import_ical(calendar_id, file) ⇒ Object



65
66
67
# File 'lib/teamlab/modules/calendar.rb', line 65

def import_ical(calendar_id, file)
  @request.post([calendar_id.to_s, 'import'], somefile: File.new(file))
end

#manage_subscriptions(states) ⇒ Object



81
82
83
# File 'lib/teamlab/modules/calendar.rb', line 81

def manage_subscriptions(states)
  @request.put(%w[subscriptions manage], states: states)
end

#unsubscribe_from_event(event_id) ⇒ Object



107
108
109
# File 'lib/teamlab/modules/calendar.rb', line 107

def unsubscribe_from_event(event_id)
  @request.delete(['events', event_id.to_s, 'unsubscribe'])
end

#update_calendar(calendar_id, name, time_zone, options = {}) ⇒ Object



73
74
75
# File 'lib/teamlab/modules/calendar.rb', line 73

def update_calendar(calendar_id, name, time_zone, options = {})
  @request.put([calendar_id.to_s], { name: name, timeZone: time_zone }.merge(options))
end

#update_calendar_user_view(calendar_id, name, time_zone, options = {}) ⇒ Object



77
78
79
# File 'lib/teamlab/modules/calendar.rb', line 77

def update_calendar_user_view(calendar_id, name, time_zone, options = {})
  @request.put([calendar_id.to_s, 'view'], { name: name, timeZone: time_zone }.merge(options))
end

#update_event(calendar_id, event_id, name, options = {}) ⇒ Object



85
86
87
# File 'lib/teamlab/modules/calendar.rb', line 85

def update_event(calendar_id, event_id, name, options = {})
  @request.put([calendar_id.to_s, event_id.to_s], { name: name }.merge(options))
end

#update_icsevent(calendar_id, event_id, ics, options = {}) ⇒ Object



89
90
91
# File 'lib/teamlab/modules/calendar.rb', line 89

def update_icsevent(calendar_id, event_id, ics, options = {})
  @request.put(['icsevent'], { calendarId: calendar_id.to_s, eventId: event_id.to_s, ics: ics.to_s }.merge(options))
end