Class: GoogleCalendar::Calendar

Inherits:
Object
  • Object
show all
Extended by:
Connection
Defined in:
lib/google_calendar_oauth2/calendar.rb

Class Method Summary collapse

Methods included from Connection

client, connection

Class Method Details

.create(attrs) ⇒ Object



20
21
22
# File 'lib/google_calendar_oauth2/calendar.rb', line 20

def self.create(attrs)
  connection.execute(api_method: client.calendars.insert, body: [JSON.dump(attrs)], headers: {'Content-Type' => 'application/json'})
end

.find(query) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/google_calendar_oauth2/calendar.rb', line 11

def self.find(query)
  list.each do |cal|
    if cal.summary == query
      return @cal = cal
    end
  end
  @cal
end

.listObject



6
7
8
9
# File 'lib/google_calendar_oauth2/calendar.rb', line 6

def self.list
  list = connection.execute(client.calendar_list.list)
  list.data.items
end