class ConnpassToCalendar::Api::GoogleApis::Calendar
Constants
- OOB_URI
- SCOPE
Public Class Methods
new(application_name, credentials_path, token_path, user_id)
click to toggle source
# File lib/connpass_to_calendar/api/google_apis/calendar.rb, line 12 def initialize(application_name, credentials_path, token_path, user_id) @application_name = application_name @credentials_path = credentials_path @token_path = token_path @user_id = user_id end
Public Instance Methods
create_event(summary, location, description, start_date_time, end_date_time)
click to toggle source
# File lib/connpass_to_calendar/api/google_apis/calendar.rb, line 41 def create_event(summary, location, description, start_date_time, end_date_time) client = Google::Apis::CalendarV3::CalendarService.new client.client_options.application_name = @application_name client.authorization = authorize event = Google::Apis::CalendarV3::Event.new({ summary: summary, location: location, description: description, start: { date_time: start_date_time, time_zone: "Japan", }, end: { date_time: end_date_time, time_zone: "Japan", }, }) result = client.insert_event("primary", event) puts "Event created: #{result.html_link}" end