bps-google-api 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 48eb103dafe0d57e7032a72e648f7cf085e2526c53f5d2d18e9122eeec620eea
4
- data.tar.gz: e9505e457d101da12a86cd758d2e124b335cfb5271e2f84404816cbd7d74e8d1
3
+ metadata.gz: 67669257142314c0e1c703dcd7553a52826e5233efdf201d11d2b3756cb3c432
4
+ data.tar.gz: 1e946c30ee44aa29890b1a6bf889a78d428633980c4233a27d52f218afe4259a
5
5
  SHA512:
6
- metadata.gz: 62a8efa1c192691cf326063b4c9ee19d296b3d6c8953d02d535b449d0cfe78e560965f237993c7aa7728d6748bf91fa40aaa29f3aa924475d92044dd06141f23
7
- data.tar.gz: 781131026cb28c330afada70929b2d6564e79620d4dcc87472788e8d6c887461b37d4741f921e8fd3959b039b4a040009f230e217687481c5cb1cc0c9510cef0
6
+ metadata.gz: 9ebef8848cc1f097db66ddeb5f1ba7ed7a60efde57a24839eb42e047aea0e6bc366bc0e3e4c72f1933aebe2d3c988848e0058ec635df21e2b6e3769f81904f83
7
+ data.tar.gz: 3c69d7700f0521654c56b8f13b68f3b7cddbdd2f4713bafd337249d4cd75d8cc6496c81115c4ea302941b6f27b6e46bea6f0644e33d3884981ed6c49c096ff41
data/.rubocop.yml CHANGED
@@ -37,6 +37,7 @@ Metrics/LineLength:
37
37
  Max: 100
38
38
  Metrics/MethodLength:
39
39
  Enabled: true
40
+ Max: 15
40
41
  Metrics/ClassLength:
41
42
  Enabled: true
42
43
  Max: 125
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bps-google-api (0.5.0)
4
+ bps-google-api (0.5.1)
5
5
  exp_retry (~> 0.0.13)
6
6
  fileutils (~> 1.2)
7
7
  google-api-client (~> 0.23)
@@ -16,7 +16,7 @@ GEM
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
18
  zeitwerk (~> 2.3)
19
- addressable (2.8.1)
19
+ addressable (2.8.3)
20
20
  public_suffix (>= 2.0.2, < 6.0)
21
21
  ast (2.4.0)
22
22
  concurrent-ruby (1.2.2)
@@ -47,7 +47,7 @@ GEM
47
47
  faraday-patron (1.0.0)
48
48
  faraday-rack (1.0.0)
49
49
  faraday-retry (1.0.3)
50
- fileutils (1.7.0)
50
+ fileutils (1.7.1)
51
51
  gems (1.2.0)
52
52
  google-api-client (0.53.0)
53
53
  google-apis-core (~> 0.1)
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'bps-google-api'
5
- s.version = '0.5.0'
6
- s.date = '2023-03-13'
5
+ s.version = '0.5.1'
6
+ s.date = '2023-04-08'
7
7
  s.summary = 'Configured Google API'
8
8
  s.description = 'A configured Google API wrapper.'
9
9
  s.homepage = 'http://rubygems.org/gems/bps-google-api'
@@ -7,9 +7,10 @@ class GoogleAPI
7
7
  raise Google::Apis::RateLimitError, '(Rate Limit Exceeded)' if error
8
8
 
9
9
  @verbose = verbose
10
- Google::Apis.logger.level = Logger::WARN
11
- choose_page_token(page_token)
12
- loop_over_pages(ENV['GOOGLE_CALENDAR_ID_TEST'], page_limit: page_limit)
10
+ quietly do
11
+ choose_page_token(page_token)
12
+ loop_over_pages(ENV['GOOGLE_CALENDAR_ID_TEST'], page_limit: page_limit)
13
+ end
13
14
  puts '*** Cleared all events!' if @verbose
14
15
  rescue Google::Apis::RateLimitError
15
16
  puts "\n\n*** Google::Apis::RateLimitError (Rate Limit Exceeded)" if @verbose
@@ -19,6 +20,15 @@ class GoogleAPI
19
20
 
20
21
  private
21
22
 
23
+ def quietly
24
+ old_level = Google::Apis.logger.level
25
+ Google::Apis.logger.level = Logger::WARN
26
+
27
+ yield
28
+
29
+ Google::Apis.logger.level = old_level
30
+ end
31
+
22
32
  def choose_page_token(page_token)
23
33
  last_token = Calendar.last_token_path
24
34
  @page_token ||= File.read(last_token) if File.exist?(last_token)
@@ -86,13 +86,19 @@ RSpec.describe GoogleAPI::Calendar do
86
86
  context 'with multiple pages' do
87
87
  let(:calendar) { subject.class.api }
88
88
 
89
- before do
90
- allow(calendar).to receive(:call).and_return(
91
- Google::Apis::CalendarV3::Events.new(items: [Google::Apis::CalendarV3::Event], next_page_token: 'abc'),
92
- Google::Apis::CalendarV3::Events.new(items: [Google::Apis::CalendarV3::Event], next_page_token: nil)
93
- )
89
+ let(:events) do
90
+ [
91
+ Google::Apis::CalendarV3::Events.new(
92
+ items: [Google::Apis::CalendarV3::Event], next_page_token: 'abc'
93
+ ),
94
+ Google::Apis::CalendarV3::Events.new(
95
+ items: [Google::Apis::CalendarV3::Event], next_page_token: nil
96
+ )
97
+ ]
94
98
  end
95
99
 
100
+ before { allow(calendar).to receive(:call).and_return(events) }
101
+
96
102
  it 'returns the array of all events from list_all when paginated' do
97
103
  expect(calendar).to receive(:call).twice
98
104
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bps-google-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-13 00:00:00.000000000 Z
11
+ date: 2023-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: exp_retry