Class: Ribose::Event

Inherits:
Base
  • Object
show all
Includes:
Actions::Create, Actions::Delete, Actions::Fetch, Actions::Update
Defined in:
lib/ribose/event.rb

Class Method Summary collapse

Methods included from Actions::Delete

#delete

Methods included from Actions::Base

#included

Methods included from Actions::Update

#update

Methods included from Actions::Create

#create

Methods included from Actions::Fetch

#fetch

Methods inherited from Base

#initialize

Methods included from ResourceHelper

#resource_id, #resource_key, #resource_path, #resources

Constructor Details

This class inherits a constructor from Ribose::Base

Class Method Details

.all(calendar_id, options = {}) ⇒ Sawyer::Resource

List calendar events

Returns:

  • (Sawyer::Resource)

    Calendar Events



14
15
16
# File 'lib/ribose/event.rb', line 14

def self.all(calendar_id, options = {})
  Ribose::Calendar.fetch(calendar_id, options)
end

.create(calendar_id, attrs, options = {}) ⇒ Sawyer::Resource

Create a calendar event

Returns:

  • (Sawyer::Resource)

    The new event



34
35
36
# File 'lib/ribose/event.rb', line 34

def self.create(calendar_id, attrs, options = {})
  new(options.merge(calendar_id: calendar_id, **attrs)).create["events"]
end

.delete(calendar_id, event_id, options = {}) ⇒ Object

Delete a calendar event



57
58
59
# File 'lib/ribose/event.rb', line 57

def self.delete(calendar_id, event_id, options = {})
  new(options.merge(calendar_id: calendar_id, resource_id: event_id)).delete
end

.fetch(calendar_id, event_id, options = {}) ⇒ Sawyer::Resource

Fetch a calendar event

Returns:

  • (Sawyer::Resource)

    Event details



24
25
26
# File 'lib/ribose/event.rb', line 24

def self.fetch(calendar_id, event_id, options = {})
  new(options.merge(calendar_id: calendar_id, resource_id: event_id)).fetch
end

.update(calendar_id, event_id, attributes, options = {}) ⇒ Object

Update a calendar event



45
46
47
48
49
# File 'lib/ribose/event.rb', line 45

def self.update(calendar_id, event_id, attributes, options = {})
  new(options.merge(
    calendar_id: calendar_id, resource_id: event_id, **attributes,
  )).update["events"]
end