gaah 0.3.2.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4838ead72ceb5c77c0f2450f5972d3af88276017
4
- data.tar.gz: ffd47c6fd5633b9cefbbe1d3790a3b0bd37fd4a3
3
+ metadata.gz: e9dc2eed38e050c5de23c139c671e0d7fe07c1f5
4
+ data.tar.gz: e38e08dd5674dab3a88430f214642d8db1b135d5
5
5
  SHA512:
6
- metadata.gz: 77f0e1fa1587770a342e5a5a85812ee6663e82bd283c7d03d5042873bafd320c2fffc791e8512871170c39b98002e8179da9a4fcce5dd8ff61bfd3898b56422b
7
- data.tar.gz: 5e8bb68155615d1ba576f081cc45f44b1354fc54161f813f64f8a6576c9f089a6c29a98519d981e7b9b67986e448b913e470c0c6fe2cada59606da7db2a5e403
6
+ metadata.gz: b46b8f40c1798abfc2701e42d5d8ca56600269c51aed04946cb5effd71dabd0b2296db78bfa8b3a3ddbb8e8468f7de8010be8ef6bc8fac8daff4d9fb41a3c90f
7
+ data.tar.gz: e7b356a7a0363ef2dd280da7fc7c902e06c41690e30f3a49fa1095bd858584d35d269eb3e66a82aebcee0dc4074cdd7c8218a142c806040a498f2f975d90ed37
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Gaah
2
- VERSION = "0.3.2.1"
2
+ VERSION = "0.3.3"
3
3
  end
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.2.1
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