ruboty-google_calendar 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f3a854c1253222b9ca27fa1503f13b667961f23
4
- data.tar.gz: 94db08488268b25acfdeb66ebf1cd79823dcf01e
3
+ metadata.gz: a97771d0adce7cd67b047cabc68a2efa008e636a
4
+ data.tar.gz: 460d244eb4fc39f228b6c4f39a7d78cff270f7be
5
5
  SHA512:
6
- metadata.gz: dc137e9fb3885e1d66def6d1fcbe246e74697557f47a6fcfcff8d71d18852cf96c882c4fdf64e60e139c12919d456bc9c75efa622317864efb3bdd7fe5571927
7
- data.tar.gz: 19404895f65ff0b819dd12cb2d5f246936d30d081671288ea5f9225364454d8892979eea6192e6bd56bbb21388fe528653fa4fe3d2450ac6f2d0fba1f6226cc6
6
+ metadata.gz: c18ef6a25cfb3abe40fdd98cc4d2709538a0045253cd54db3856d4c9a96ed5bcb956b15f4a042bd563211abd62691ebfc52c2174375bb244d2032cb898401f19
7
+ data.tar.gz: 4b78f310db751fb27e62aff2edbc3328c5e648060c18fca7daa9c9ea8b3dfff975b70562de2871f253b37e6d9ef98f18edebb86f96607365ae2ac3d7563b4d4a
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.0.2
2
+ - Support all-day events
3
+
4
+ ## 0.0.1
5
+ - 1st Release :tada:
data/README.md CHANGED
@@ -20,3 +20,29 @@ GOOGLE_CLIENT_SECRET - Client Secret
20
20
  GOOGLE_REDIRECT_URI - Redirect URI (http://localhost in most cases)
21
21
  GOOGLE_REFRESH_TOKEN - Refresh token issued with access token
22
22
  ```
23
+
24
+ ### How to issue an access token?
25
+ 1. Open authorization page
26
+ 1. Authorize
27
+ 1. Get code parameter from redirect URL
28
+ 1. Send POST request with the code
29
+
30
+ ```sh
31
+ open "https://accounts.google.com/o/oauth2/auth\
32
+ ?client_id=${GOOGLE_CLIENT_ID}\
33
+ &redirect_uri=http://localhost\
34
+ &scope=https://www.googleapis.com/auth/calendar\
35
+ &response_type=code\
36
+ &approval_prompt=force\
37
+ &access_type=offline"
38
+ ```
39
+
40
+ ```sh
41
+ curl \
42
+ -d "client_id=${GOOGLE_CLIENT_ID}"\
43
+ -d "client_secret=${GOOGLE_CLIENT_SECRET}"\
44
+ -d "redirect_uri=http://localhost"\
45
+ -d "grant_type=authorization_code"
46
+ -d "code=${CODE}"\
47
+ "https://accounts.google.com/o/oauth2/token"
48
+ ```
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module GoogleCalendar
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -85,7 +85,6 @@ module Ruboty
85
85
  end
86
86
  end
87
87
 
88
- # @todo Support access token expiration.
89
88
  def authenticate!
90
89
  api_client.authorization.fetch_access_token!
91
90
  end
@@ -124,16 +123,31 @@ module Ruboty
124
123
 
125
124
  private
126
125
 
126
+ def all_day?
127
+ @item.start.date_time.nil?
128
+ end
129
+
127
130
  def finished_at
128
- if @item.start.date_time.localtime.day == @item.end.date_time.localtime.day
131
+ case
132
+ when all_day?
133
+ "--:--"
134
+ when finished_in_same_day?
129
135
  @item.end.date_time.localtime.strftime("%H:%M")
130
136
  else
131
137
  @item.end.date_time.localtime.strftime("%Y-%m-%d %H:%M")
132
138
  end
133
139
  end
134
140
 
141
+ def finished_in_same_day?
142
+ @item.start.date_time.localtime.day == @item.end.date_time.localtime.day
143
+ end
144
+
135
145
  def started_at
136
- @item.start.date_time.localtime.strftime("%Y-%m-%d %H:%M")
146
+ if all_day?
147
+ "#{@item.start.date} --:--"
148
+ else
149
+ @item.start.date_time.localtime.strftime("%Y-%m-%d %H:%M")
150
+ end
137
151
  end
138
152
 
139
153
  def summary
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-google_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
+ - CHANGELOG.md
91
92
  - Gemfile
92
93
  - LICENSE.txt
93
94
  - README.md
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  version: '0'
117
118
  requirements: []
118
119
  rubyforge_project:
119
- rubygems_version: 2.4.5
120
+ rubygems_version: 2.2.2
120
121
  signing_key:
121
122
  specification_version: 4
122
123
  summary: Ruboty plug-in to read schedule from Google Calendar.