ruboty-google_spreadsheet 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1cdb28aef6a68afc0b98bbcd31af476b57931b8
|
4
|
+
data.tar.gz: 7fafefd72204e70a52f27f95afabad440f683fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0705122d99ed7f4018af2ca0163b63ed0870a050632a629a03eeb2771b84bfb419c5975c84ea29d79b275baa17b250024a70e402d0cdb6e02761a734dcef8120
|
7
|
+
data.tar.gz: 68ee4032215d806d5bc089d5d88ff138d76ec03ea0bdc8322c705a8b3f8e169ac5c301219477d3aba1731727c041b9b8d34a99f73fa72a75db49474e46ed4a12
|
@@ -10,8 +10,10 @@ module Ruboty
|
|
10
10
|
def initialize
|
11
11
|
super
|
12
12
|
|
13
|
-
@
|
14
|
-
@
|
13
|
+
@threads = []
|
14
|
+
@threads << Thread.new { sync }
|
15
|
+
@threads << Thread.new { reautorize }
|
16
|
+
@threads.each { |thread| thread.abort_on_exception = true }
|
15
17
|
|
16
18
|
@client = Ruboty::GoogleSpreadsheet::Client.new(
|
17
19
|
client_id: ENV["GOOGLE_CLIENT_ID"],
|
@@ -19,7 +21,7 @@ module Ruboty
|
|
19
21
|
redirect_uri: ENV["GOOGLE_REDIRECT_URI"],
|
20
22
|
refresh_token: ENV["GOOGLE_REFRESH_TOKEN"]
|
21
23
|
)
|
22
|
-
@client.
|
24
|
+
@client.authorize!
|
23
25
|
end
|
24
26
|
|
25
27
|
def data
|
@@ -33,17 +35,18 @@ module Ruboty
|
|
33
35
|
|
34
36
|
def sync
|
35
37
|
loop do
|
36
|
-
|
38
|
+
sleep 5
|
37
39
|
data.synchronize
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def reauthorize
|
44
|
+
loop do
|
45
|
+
# access token will expire in 3600 sec.
|
46
|
+
sleep 3599
|
47
|
+
@client.authorize!
|
48
|
+
@data = nil
|
49
|
+
end
|
47
50
|
end
|
48
51
|
end
|
49
52
|
end
|
@@ -11,11 +11,13 @@ module Ruboty
|
|
11
11
|
@authorization.client_secret = attrs[:client_secret]
|
12
12
|
@authorization.scope = SCOPE
|
13
13
|
@authorization.redirect_uri = attrs[:redirect_uri]
|
14
|
-
@
|
14
|
+
@refresh_token = attrs[:refresh_token]
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def authorize!
|
18
|
+
@authorization.refresh_token = @refresh_token
|
18
19
|
@authorization.fetch_access_token!
|
20
|
+
@refresh_token = @authorization.refresh_token
|
19
21
|
end
|
20
22
|
|
21
23
|
def access_token
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-google_spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto Kaneko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|