Class: Gaah::Calendar::Api
- Inherits:
-
Object
- Object
- Gaah::Calendar::Api
- Defined in:
- lib/gaah/calendar/api.rb
Class Method Summary collapse
-
.create_event(xoauth_requestor_id, options) ⇒ Object
API: Events#insert.
-
.event(xoauth_requestor_id, options) ⇒ Object
API: Events#get.
-
.events(xoauth_requestor_id, options) ⇒ Object
API: Events#list.
Class Method Details
.create_event(xoauth_requestor_id, options) ⇒ Object
API: Events#insert
19 20 21 22 23 24 25 |
# File 'lib/gaah/calendar/api.rb', line 19 def create_event(xoauth_requestor_id, ) url = build_api_url(.delete(:email)) params = { xoauth_requestor_id: xoauth_requestor_id } body = build_create_api_body() json = ApiClient.instance.post(url, params, body) event = JSON.load(json) end |
.event(xoauth_requestor_id, options) ⇒ Object
API: Events#get
28 29 30 31 32 33 34 35 |
# File 'lib/gaah/calendar/api.rb', line 28 def event(xoauth_requestor_id, ) base = build_api_url(.delete(:email)) id = .delete(:event_id) url = "#{base}/#{id}" params = { xoauth_requestor_id: xoauth_requestor_id } json = ApiClient.instance.get(url, params) event = JSON.load(json) end |
.events(xoauth_requestor_id, options) ⇒ Object
API: Events#list
10 11 12 13 14 15 16 |
# File 'lib/gaah/calendar/api.rb', line 10 def events(xoauth_requestor_id, ) url = build_api_url([:email]) params = build_events_api_params(xoauth_requestor_id, ) json = ApiClient.instance.get(url, params) events = JSON.load(json) Event.batch_create(events['items']) end |