Created
May 30, 2016 13:10
-
-
Save belltailjp/d88e78c993eb3c271fbf417f673aabf5 to your computer and use it in GitHub Desktop.
An example of obtaining Google Calendar public events using ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google/apis/calendar_v3' | |
require 'active_support' | |
require 'active_support/core_ext' | |
service = Google::Apis::CalendarV3::CalendarService.new | |
# change here so you can specify your own Google calendar API access key | |
service.key = ENV['GOOGLE_CALENDAR_API_KEY'] | |
# Obtain every events within a year from 名古屋アジャイル勉強会 public calendar | |
events = service.list_events('2jqc6fmqn8smj7vdfhj4drpqhk@group.calendar.google.com', | |
time_min: (Time.now - 365.days).iso8601, | |
time_max: (Time.now + 365.days).iso8601,) | |
puts "Calendar name: #{events.summary}" | |
events.items.each do |event| | |
time = if event.start.date.present? | |
"#{event.start.date.to_s}〜#{event.end.date.to_s}" | |
else | |
"#{event.start.date_time.to_date} #{event.start.date_time.strftime('%-k:%M')}〜#{event.end.date_time.strftime('%-k:%M')}" | |
end | |
puts "#{time} #{event.summary} at #{event.location}" | |
end | |
#Calendar name: 人力アジャイルイベントカレンダー powered by 名古屋アジャイル勉強会 | |
#2015-06-10 10:00〜17:00 [大阪府]ET West 2015 at 大阪市北区大深町3-1 (グランフロント大阪 北館, ナレッジキャピタル コングレコンベンションセンター) | |
#2015-07-12 10:00〜11:00 [東京都]PMI Japan Forum 2015 2日目 at 東京都千代田区一ツ橋2丁目1番2号 (学術総合センター) | |
#2015-06-17 19:00〜21:00 [愛知県]名古屋アジャイル移動図書館「要件定義本」ブックトーク会 at 愛知県名古屋市中区大井町7-25 (イーブルなごや 3階, 第6研修室) | |
#2015-06-26 19:00〜21:00 [愛知県]名古屋アジャイル勉強会「プランニングポーカーで学ぶ相対見積」 at 愛知県名古屋市中区大井町7-25 (イーブルなごや 1階, 第1集会室) | |
#...(abbreviated) | |
#2016-02-17 19:00〜21:00 [愛知県]名古屋アジャイル移動図書館「問題解決技法本」ブックトーク会 at 愛知県名古屋市中区大井町7-25 (イーブルなごや) | |
#2016-02-26 19:00〜21:00 [愛知県]名古屋アジャイル勉強会「スッキリ!問題解決でプロジェクトを進めよう」 at 愛知県名古屋市中区大井町7-25 (イーブルなごや) | |
#2016-03-24 19:30〜21:00 [東京都]Scrum Masters Night! #11 ~Engineering~ at 東京都中央区京橋1-6-1 三井住友海上テプコビル8階 | |
#2016-03-25 19:00〜21:00 [愛知県]名古屋アジャイル勉強会「課題駆動の勘所」 at 愛知県名古屋市中区大井町7-25 (イーブルなごや) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment