lokalise_manager 5.0.0 → 5.1.0

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: 31b3524b3186c5fa2f6ff2f915cf45dc2cc26f69c615ff6d44fffd6581286222
4
- data.tar.gz: 324ce28075eb3d6cacfda2076ac5b0d9b18a0750026e464e99ebb8b9aafa70d5
3
+ metadata.gz: e651c10cfc08624f8bbfe88970210ed7a9e012e8637cc8cbb61aa4328942016b
4
+ data.tar.gz: f0dea631f1afba287ff49ff7336a1d74030347feafbafb848e8e5f445d466df9
5
5
  SHA512:
6
- metadata.gz: 207900d1455053cc5246892f53ceed6027d2335ced167702e8f9c2eb977b0ce037f089cf447d8b4941bcd49d940de9d66a88c078df147c7ad23cad30e001b230
7
- data.tar.gz: 14cc73a9f1a2fe3cad5716e9fe11bb68ad991eb239fc0d2aac45322b3237faf7644b7da403b2124733107e7f29a3e78cba3c510c77993d8f8339753112cd2b16
6
+ metadata.gz: d4792e56612597b654536c72b0c29550b15c9e3666da1422208d613e546cb2870b9749a7150111e40296bd5e2550ca9eacedc55715b0c28292eb1cff45eddf9c
7
+ data.tar.gz: 59cfbc87f48a4293fa064946d638b27510211d05bdd8dd5b9c4c63716455b55cdec851da5b2f35b4a4941d153639874bf87e2e34040cc433fe6a46ce978bc0c8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.0 (09-Feb-2024)
4
+
5
+ * Handle rare case when the server returns HTML instead of JSON which happens when too many requests are sent
6
+
3
7
  ## 5.0.0 (09-Nov-2023)
4
8
 
5
9
  * **Breaking change**: require Ruby 3+. Version 2.7 has reached end-of-life and thus we are not planning to support it anymore. If you need support for Ruby 2.7, please stay on 4.0.0.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Ilya Krukowski
3
+ Copyright (c) 2024 Ilya Krukowski
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -14,7 +14,7 @@ If you are looking for a Rails integration, please check [lokalise_rails](https:
14
14
 
15
15
  ### Requirements
16
16
 
17
- This gem requires Ruby 2.5+. You will also need to [setup a Lokalise account](https://app.lokalise.com/signup) and create a [translation project](https://docs.lokalise.com/en/articles/1400460-projects). Finally, you will need to generate a [read/write API token](https://docs.lokalise.com/en/articles/1929556-api-tokens) at your Lokalise profile.
17
+ This gem requires Ruby 3.0+. You will also need to [setup a Lokalise account](https://app.lokalise.com/signup) and create a [translation project](https://docs.lokalise.com/en/articles/1400460-projects). Finally, you will need to generate a [read/write API token](https://docs.lokalise.com/en/articles/1929556-api-tokens) at your Lokalise profile.
18
18
 
19
19
  Alternatively, you can utilize a token obtained via OAuth 2 flow. When using such a token, you'll have to set `:use_oauth2_token` option to `true` (see below).
20
20
 
@@ -88,6 +88,11 @@ module LokaliseManager
88
88
  "#{config.project_id}:#{config.branch}"
89
89
  end
90
90
 
91
+ # In rare cases the server might return HTML instead of JSON.
92
+ # It happens when too many requests are being sent.
93
+ # Until this is fixed, we revert to this quick'n'dirty solution.
94
+ EXCEPTIONS = [JSON::ParserError, RubyLokaliseApi::Error::TooManyRequests].freeze
95
+
91
96
  # Sends request with exponential backoff mechanism
92
97
  def with_exp_backoff(max_retries)
93
98
  return unless block_given?
@@ -95,7 +100,7 @@ module LokaliseManager
95
100
  retries = 0
96
101
  begin
97
102
  yield
98
- rescue RubyLokaliseApi::Error::TooManyRequests => e
103
+ rescue *EXCEPTIONS => e
99
104
  raise(e.class, "Gave up after #{retries} retries") if retries >= max_retries
100
105
 
101
106
  sleep 2**retries
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LokaliseManager
4
- VERSION = '5.0.0'
4
+ VERSION = '5.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lokalise_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lokalise-api
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.4.21
241
+ rubygems_version: 3.5.6
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Lokalise integration for Ruby