bps-google-api 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bps-google-api.gemspec +1 -1
- data/lib/google_api.rb +1 -1
- data/lib/google_api/base/authorization.rb +3 -3
- data/lib/google_api/calendar.rb +1 -2
- data/lib/google_api/calendar/clear_test_calendar.rb +3 -3
- data/spec/lib/google_api/base_spec.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62dc0559dea2c506661457f032e9e60df284d2f9
|
4
|
+
data.tar.gz: 25d483983fe5607af8d87fbfaad9120674575d2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af86ddc607a96df38f7bf1b2dc321898def9f3be7fffd01273423d6bf9d8ecf373e422c6fa039e5db686edc1ef7bf22438a28be2bfe477aa68df833c59b75c3e
|
7
|
+
data.tar.gz: ffcad31969723afadaf920de95f4ae06caa3c109786293d74f39476b09090c08f7871a92dd8fdecda0ffa48af1542d3515568121de9941732f28d98cb3350afa
|
data/Gemfile.lock
CHANGED
data/bps-google-api.gemspec
CHANGED
data/lib/google_api.rb
CHANGED
@@ -72,7 +72,7 @@ module GoogleAPI
|
|
72
72
|
def store_key(path, key)
|
73
73
|
return if File.exist?(path)
|
74
74
|
|
75
|
-
FileUtils.mkdir_p('config
|
75
|
+
FileUtils.mkdir_p(File.join(ROOT_PATH, 'config', 'keys'))
|
76
76
|
File.open(path, 'w+') do |f|
|
77
77
|
File.chmod(0o600, f)
|
78
78
|
block_given? ? yield(f) : f.write(key)
|
@@ -81,7 +81,7 @@ module GoogleAPI
|
|
81
81
|
|
82
82
|
def client_id_file
|
83
83
|
store_key(
|
84
|
-
File.join(
|
84
|
+
File.join(ROOT_PATH, 'config/keys/google_api_client.json'),
|
85
85
|
<<~KEY
|
86
86
|
{"installed":{"client_id":"#{ENV['GOOGLE_CLIENT_ID']}","project_id":"charming-scarab-208718",
|
87
87
|
"auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token",
|
@@ -93,7 +93,7 @@ module GoogleAPI
|
|
93
93
|
|
94
94
|
def token_file
|
95
95
|
store_key(
|
96
|
-
File.join(
|
96
|
+
File.join(ROOT_PATH, 'config/keys/google_token.yaml'),
|
97
97
|
<<~KEY
|
98
98
|
---
|
99
99
|
default: '{"client_id":"#{ENV['GOOGLE_CLIENT_ID']}","access_token":"#{ENV['GOOGLE_ACCESS_TOKEN']}",
|
data/lib/google_api/calendar.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GoogleAPI
|
4
|
-
require 'google_api/calendar/clear_test_calendar'
|
5
|
-
|
6
4
|
class Calendar < GoogleAPI::Base
|
7
5
|
LAST_TOKEN_PATH ||= File.join(ROOT_PATH, 'tmp', 'run', 'last_page_token')
|
8
6
|
|
7
|
+
require 'google_api/calendar/clear_test_calendar'
|
9
8
|
include GoogleAPI::Calendar::ClearTestCalendar
|
10
9
|
|
11
10
|
SERVICE_CLASS = Google::Apis::CalendarV3::CalendarService
|
@@ -20,7 +20,7 @@ module GoogleAPI
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def choose_page_token(page_token)
|
23
|
-
@page_token ||= File.read(LAST_TOKEN_PATH) if File.exist?(LAST_TOKEN_PATH)
|
23
|
+
@page_token ||= File.read(Calendar::LAST_TOKEN_PATH) if File.exist?(Calendar::LAST_TOKEN_PATH)
|
24
24
|
@page_token = page_token if token?(page_token)
|
25
25
|
end
|
26
26
|
|
@@ -54,8 +54,8 @@ module GoogleAPI
|
|
54
54
|
|
55
55
|
def log_last_page_token
|
56
56
|
puts "\n\n*** Last page token cleared: #{@page_token}" if @verbose
|
57
|
-
File.open(LAST_TOKEN_PATH, 'w+') { |f| f.write(@page_token) }
|
58
|
-
puts "\n*** Token stored in #{LAST_TOKEN_PATH}" if @verbose
|
57
|
+
File.open(Calendar::LAST_TOKEN_PATH, 'w+') { |f| f.write(@page_token) }
|
58
|
+
puts "\n*** Token stored in #{Calendar::LAST_TOKEN_PATH}" if @verbose
|
59
59
|
end
|
60
60
|
|
61
61
|
def progress_bar(total)
|
@@ -15,7 +15,9 @@ RSpec.describe GoogleAPI::Base do
|
|
15
15
|
subject { GoogleAPI::Calendar }
|
16
16
|
|
17
17
|
it 'returns the correct last token path' do
|
18
|
-
expect(GoogleAPI::Calendar::LAST_TOKEN_PATH).to eql(
|
18
|
+
expect(GoogleAPI::Calendar::LAST_TOKEN_PATH).to eql(
|
19
|
+
File.join(GoogleAPI::ROOT_PATH, 'tmp', 'run', 'last_page_token')
|
20
|
+
)
|
19
21
|
end
|
20
22
|
|
21
23
|
it 'returns an array from authorize with reveal' do
|