Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cefin
OLIGAA
Commits
1fbc4eb9
Commit
1fbc4eb9
authored
Jul 22, 2021
by
Cefin
Browse files
reviewing syntax of google calendar event
parent
26ad4e15
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/google_agenda/calendar.rb
View file @
1fbc4eb9
...
...
@@ -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
app/models/google_agenda/event.rb
View file @
1fbc4eb9
...
...
@@ -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
}
."
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment