go_to_webinar 0.2.9 → 0.2.10

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: cfea68fbffb7ce80a4db2f95e90e5ddfe2dcc60c3985799d50330df7cd4bbdf2
4
- data.tar.gz: 6c83997291535d19f83cd04c5e95a00f4fc713d63bbb96e297885faf8f3e1159
3
+ metadata.gz: df9fa769ff6179ab77d56cceedefffd4cebc66af444b7b903c91ec9dd149b915
4
+ data.tar.gz: 8f602a443a9f18616ed3d9aa6186cd8d732216b2bf4c28b1b16ad867c131c8fd
5
5
  SHA512:
6
- metadata.gz: 89a7d3ba63a3a4f8e0b624b17e73edd921cf2032373eeab1e99b16fb307a40d514e1e8a258daacfa70dc929bb7da2eeeda07f0de67649ca42545e8a7b1687556
7
- data.tar.gz: 49cc45452cbda420f495dd542dcbd62473f46ef44eaa4bcd7cb93d09b3992659cf03280fa607bcdfbc05a83669844442144c887cf1379e7cd62fe17d1c10c1f7
6
+ metadata.gz: 808a2e7d986daa91aea2587dcbf6d6b63adce397fffed7d7890788f4678c033661caa28ea78274bc525b9980c8e9d59c2e8ed95e171d9207b505ba035f26ce79
7
+ data.tar.gz: cdc2f267d736529bc83fdb63b328c3a620d70e6f61e35dcc3780b1abcd427ae3e50a1cb0e6b065be10050d924d70b99854ec13dc2f74142419ac2b0d5581491b
@@ -46,17 +46,23 @@ module GoToWebinar
46
46
  retries ||= 0
47
47
  yield
48
48
  rescue RestClient::Forbidden => e
49
+ raise unless (retries += 1) < 2
50
+
51
+ attempt_refresh(e)
52
+ retry
53
+ rescue StandardError => e
49
54
  raise unless (retries += 1) <= 2
50
-
51
- if retries < 2
52
- raise unless int_error_code(e) == 'InvalidToken'
53
- raise unless @g2w_oauth2_client&.access_token&.expired?
54
- @access_token = @g2w_oauth2_client.refresh_access_token.token
55
- retry
56
- elsif retries == 3
57
- @g2w_oauth2_client.get_new_access_token
58
- retry
59
- end
55
+
56
+ @g2w_oauth2_client.get_new_access_token
57
+ @access_token = @g2w_oauth2_client.access_token&.token
58
+ retry
59
+ end
60
+
61
+ def attempt_refresh(e)
62
+ raise unless int_error_code(e) == 'InvalidToken'
63
+ raise unless @g2w_oauth2_client&.access_token&.expired?
64
+
65
+ @access_token = @g2w_oauth2_client.refresh_access_token.token
60
66
  end
61
67
 
62
68
  def int_error_code(exception)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoToWebinar
4
- VERSION = '0.2.9'
4
+ VERSION = '0.2.10'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_to_webinar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva