Commit 1fbc4eb9 authored by Cefin's avatar Cefin
Browse files

reviewing syntax of google calendar event

parent 26ad4e15
......@@ -46,7 +46,7 @@ module GoogleAgenda
calendar = Google::Apis::CalendarV3::Calendar.new(
summary: @cal['summary'],
description: @cal['description'],
)
).to_json
result = @calendar_api.patch_calendar(@cal['id'], calendar)
......@@ -58,16 +58,16 @@ module GoogleAgenda
def self.create_calendar calendar_api
calendar = Google::Apis::CalendarV3::Calendar.new(
summary: "TEMP #{DateTime.now}"
)
).to_json
result = calendar_api.insert_calendar(calendar)
JSON.parse(result)
JSON.parse(result.body)
end
def self.find_calendar_by_id id, calendar_api
result = calendar_api.get_calendar(id)
result = calendar_api.get_calendar(id).to_json
JSON.parse(result)
JSON.parse(result.body)
end
end
end
......@@ -30,7 +30,7 @@ module GoogleAgenda
result = calendar_api.get_event(calendar_id, id)
self.new(JSON.parse(result))
self.new(JSON.parse(result.body))
else
raise "No GA service available to find/create event #{id} on calendar #{calendar_id}."
end
......@@ -58,10 +58,10 @@ module GoogleAgenda
location: record.location,
start: Google::Apis::CalendarV3::EventDateTime.new(date_time: record.begin_at),
end: Google::Apis::CalendarV3::EventDateTime.new(date_time: record.end_at),
)
).to_json
result = calendar_api.insert_event(calendar_id, event)
data = JSON.parse(result)
data = JSON.parse(result.body)
return data['id'], data['organizer']['email']
else
raise "No GA service available to delete event #{id} on calendar #{calendar_id}."
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment