gaah 0.3.2.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gaah/calendar/api.rb +13 -0
- data/lib/gaah/calendar/calendar.rb +43 -0
- data/lib/gaah/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9dc2eed38e050c5de23c139c671e0d7fe07c1f5
|
4
|
+
data.tar.gz: e38e08dd5674dab3a88430f214642d8db1b135d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46b8f40c1798abfc2701e42d5d8ca56600269c51aed04946cb5effd71dabd0b2296db78bfa8b3a3ddbb8e8468f7de8010be8ef6bc8fac8daff4d9fb41a3c90f
|
7
|
+
data.tar.gz: e7b356a7a0363ef2dd280da7fc7c902e06c41690e30f3a49fa1095bd858584d35d269eb3e66a82aebcee0dc4074cdd7c8218a142c806040a498f2f975d90ed37
|
data/lib/gaah/calendar/api.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'gaah/calendar/calendar'
|
1
2
|
require 'gaah/calendar/event'
|
2
3
|
require 'gaah/calendar/when'
|
3
4
|
require 'gaah/calendar/who'
|
@@ -6,6 +7,18 @@ module Gaah
|
|
6
7
|
module Calendar
|
7
8
|
class Api
|
8
9
|
class << self
|
10
|
+
# API: CalendarList: list
|
11
|
+
def calendars(xoauth_requestor_id, options = {})
|
12
|
+
url = "https://www.googleapis.com/calendar/v3/users/me/calendarList"
|
13
|
+
params = {
|
14
|
+
xoauth_requestor_id: xoauth_requestor_id,
|
15
|
+
minAccessRole: options[:min_access_role] || 'writer',
|
16
|
+
showHidden: options[:show_hidden] || false,
|
17
|
+
}
|
18
|
+
calendars = JSON.load(ApiClient.instance.get(url, params))
|
19
|
+
Calendar.batch_create(calendars['items'])
|
20
|
+
end
|
21
|
+
|
9
22
|
# API: Events#list
|
10
23
|
def events(xoauth_requestor_id, options)
|
11
24
|
url = build_api_url(options[:email])
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Gaah
|
2
|
+
module Calendar
|
3
|
+
class Calendar < Gaah::ApiModel
|
4
|
+
attr_reader :id, :summary, :description, :time_zone, :color_id, :bg_color, :fg_color, :selected, :access_role
|
5
|
+
|
6
|
+
def initialize(json)
|
7
|
+
store_json(json)
|
8
|
+
|
9
|
+
@id = json['id']
|
10
|
+
@summary = json['summary']
|
11
|
+
@description = json['description']
|
12
|
+
@time_zone = json['timeZone']
|
13
|
+
@color_id = json['colorId']
|
14
|
+
@bg_color = json['backgroundColor']
|
15
|
+
@fg_color = json['foregroundColor']
|
16
|
+
@selected = json['selected']
|
17
|
+
@access_role = json['accessRole']
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_json(*args)
|
21
|
+
{
|
22
|
+
id: @id,
|
23
|
+
summary: @summary,
|
24
|
+
description: @description,
|
25
|
+
time_zone: @time_zone,
|
26
|
+
color_id: @color_id,
|
27
|
+
bg_color: @bg_color,
|
28
|
+
fg_color: @fg_color,
|
29
|
+
selected: @selected,
|
30
|
+
access_role: @access_role,
|
31
|
+
}.to_json
|
32
|
+
end
|
33
|
+
|
34
|
+
def marshal_dump
|
35
|
+
[@id, @summary, @description, @time_zone, @color_id, @bg_color, @fg_color, @selected, @access_role]
|
36
|
+
end
|
37
|
+
|
38
|
+
def marshal_load(array)
|
39
|
+
@id, @summary, @description, @time_zone, @color_id, @bg_color, @fg_color, @selected, @access_role = array
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/gaah/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hwan-Joon Choi
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/gaah/api_model.rb
|
99
99
|
- lib/gaah/base.rb
|
100
100
|
- lib/gaah/calendar/api.rb
|
101
|
+
- lib/gaah/calendar/calendar.rb
|
101
102
|
- lib/gaah/calendar/event.rb
|
102
103
|
- lib/gaah/calendar/when.rb
|
103
104
|
- lib/gaah/calendar/who.rb
|