module Googlecal

A google calendar object

A google calendar event object

Constants

VERSION

Public Class Methods

create(event_params, calendar_id = Base.calendar_id) click to toggle source

create and save a new event through googles api

# File lib/googlecal/gevent.rb, line 52
def self.create(event_params, calendar_id = Base.calendar_id)
  # event creation
  event = service.insert_event(calendar_id, Google::Apis::CalendarV3::Event.new(event_params))
  if event
    return GEvent.new(event)
  else
    return false
  end
end
find(event_id, calendar_id = Base.calendar_id) click to toggle source

find google calendar event by event_id :event_id: - Unique event id given by google cal api

# File lib/googlecal/gevent.rb, line 80
def self.find(event_id, calendar_id = Base.calendar_id)
  # find by google event id
  begin
    event = service.get_event(calendar_id, event_id)
    return event
  catch e
    return nil
  end
end

Public Instance Methods

delete(calendar_id = Base.calendar_id) click to toggle source

delete event by event.id in googles api DELETES EVENT

# File lib/googlecal/gevent.rb, line 64
def delete(calendar_id = Base.calendar_id)
  # delete instance of event
  # update event instance
  @event = service.delete_event(calendar_id, id)
  return true
end
delete_event(calendar_id = 'primary', event_id) click to toggle source

Delete an even from a calendar by event id

Attributes

  • :calendar_id: - Unique id of calendar

  • :event_id: - Unique id of event to be deleted

# File lib/googlecal/base.rb, line 66
def delete_event(calendar_id = 'primary', event_id)
  result = @@calendar_service.delete_event(calendar_id, event_id)
  return result
end
get_event(calendar_id = 'primary', event_id) click to toggle source

Get an event by event id

Attributes

  • :calendar_id: - Unique id of calendar

  • :event_id: - Unique id of event

TODO: for some reason this part is not working with some of the tests i have tried with it

# File lib/googlecal/base.rb, line 79
def get_event(calendar_id = 'primary', event_id)
  result = @@calendar_service.get_event(calendar_id, event_id)
  return result
end
update(params, calendar_id = Base.calendar_id) click to toggle source

update google calendar event by event.id

# File lib/googlecal/gevent.rb, line 72
def update(params, calendar_id = Base.calendar_id)
  # delta update
  # TODO: update calendar event
  service.update_event(calendar_id, id, @event)
end