bps-google-api 0.1.3 → 0.1.4

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: 8eff47c99912679cfc122fc41ce6e98d49517c02
4
- data.tar.gz: 2d96aa50347b5ed0333b3018b8f34d580eef8fa9
3
+ metadata.gz: 9ce9a24661d8641417f6bade32c5232d1d781359
4
+ data.tar.gz: dfd8b1f1155c7d82962a0044eb78d539dc87423b
5
5
  SHA512:
6
- metadata.gz: 5416b66ee21ae81e3ce50c73c5aa05e4be924dbd6e8ae9bf92bf4c2a37b6308d7d496176b1cba4caa53449100c95be8e301da4702f43acace2de3e28db7952de
7
- data.tar.gz: '0808cd665b75f5a229d29a6c387e59c32254bfd804c367a96aeb10e7440abb5e0eda0e40ed808a130ce80908f7bc078c8dcb944c33266eae078d7f74e5b5a457'
6
+ metadata.gz: 68779cc842f13e8f5c5741651e6a91b55e62ae33d9a21e67bf4e0566185883f2d2d633f8725ab7ae53b4ad03e13956507e135136b1cb152a9cfcddcfc570a191
7
+ data.tar.gz: b8bfc5bd9b20f3dd4636409047742bf7132c6bb579e2aa5e965aed256a282424df09e600214e184ec9547341a42b9be7ab2701d4df89f5b9aa6d195a8f02f083
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bps-google-api (0.1.3)
5
- exp_retry (~> 0.0.8)
4
+ bps-google-api (0.1.4)
5
+ exp_retry (~> 0.0.10)
6
6
  fileutils (~> 1.2)
7
7
  google-api-client (~> 0.23.4)
8
8
  ruby-progressbar (~> 1.10)
@@ -14,7 +14,7 @@ GEM
14
14
  public_suffix (>= 2.0.2, < 4.0)
15
15
  declarative (0.0.10)
16
16
  declarative-option (0.1.0)
17
- exp_retry (0.0.9)
17
+ exp_retry (0.0.10)
18
18
  faraday (0.15.4)
19
19
  multipart-post (>= 1.2, < 3)
20
20
  fileutils (1.2.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'bps-google-api'
5
- s.version = '0.1.3'
5
+ s.version = '0.1.4'
6
6
  s.date = '2019-06-15'
7
7
  s.summary = 'Configured Google API'
8
8
  s.description = 'A configured Google API wrapper.'
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = %w[lib]
14
14
  s.files = `git ls-files`.split("\n")
15
15
 
16
- s.add_runtime_dependency 'exp_retry', '~> 0.0.8'
16
+ s.add_runtime_dependency 'exp_retry', '~> 0.0.10'
17
17
  s.add_runtime_dependency 'fileutils', '~> 1.2'
18
18
  s.add_runtime_dependency 'google-api-client', '~> 0.23.4'
19
19
  s.add_runtime_dependency 'ruby-progressbar', '~> 1.10'
@@ -3,11 +3,12 @@
3
3
  module GoogleAPI
4
4
  class Calendar < GoogleAPI::Base
5
5
  module ClearTestCalendar
6
- def clear_test_calendar(page_token: nil, page_limit: 50)
6
+ def clear_test_calendar(page_token: nil, page_limit: 50, verbose: false)
7
+ @verbose = verbose
7
8
  Google::Apis.logger.level = Logger::WARN
8
9
  choose_page_token(page_token)
9
10
  loop_over_pages(ENV['GOOGLE_CALENDAR_ID_TEST'], page_limit: page_limit)
10
- puts '*** Cleared all events!'
11
+ puts '*** Cleared all events!' if @verbose
11
12
  rescue Google::Apis::RateLimitError
12
13
  puts "\n\n*** Google::Apis::RateLimitError (Rate Limit Exceeded)"
13
14
  ensure
@@ -23,7 +24,7 @@ module GoogleAPI
23
24
  end
24
25
 
25
26
  def loop_over_pages(cal_id, page_limit: 50)
26
- puts "*** Starting with page token: #{@page_token}" if @page_token.present?
27
+ puts "*** Starting with page token: #{@page_token}" if @verbose && @page_token.present?
27
28
 
28
29
  page_limit -= 1 while (@page_token = clear_page(cal_id)) && page_limit.positive?
29
30
  end
@@ -35,20 +36,20 @@ module GoogleAPI
35
36
  end
36
37
 
37
38
  def clear_events_from_page(cal_id, items)
38
- puts "*** Page token: #{@page_token}"
39
- pb = progress_bar(items.count)
39
+ puts "*** Page token: #{@page_token}" if @verbose
40
+ pb = progress_bar(items.count) if @verbose
40
41
  items&.each_with_index do |event, _index|
41
42
  ExpRetry.for(exception: Calendar::RETRIES) do
42
43
  delete(cal_id, event.id)
43
- pb.increment
44
+ pb.increment if @verbose
44
45
  end
45
46
  end
46
47
  end
47
48
 
48
49
  def log_last_page_token
49
- puts "\n\n*** Last page token cleared: #{@page_token}"
50
+ puts "\n\n*** Last page token cleared: #{@page_token}" if @verbose
50
51
  File.open(last_token_path, 'w+') { |f| f.write(@page_token) }
51
- puts "\n*** Token stored in #{last_token_path}"
52
+ puts "\n*** Token stored in #{last_token_path}" if @verbose
52
53
  end
53
54
 
54
55
  def progress_bar(total)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bps-google-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.8
19
+ version: 0.0.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.8
26
+ version: 0.0.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fileutils
29
29
  requirement: !ruby/object:Gem::Requirement