Skip to content

Commit d447ed0

Browse files
committed
Remove useless parameters from extracted GlotPressDownloader
1 parent ccba6e1 commit d447ed0

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,24 @@ def initialize(auto_retry)
1212
@auto_retry_attempt_counter = 0
1313
end
1414

15-
def download(target_locale, glotpress_url, is_source)
15+
def download(glotpress_url)
1616
uri = URI(glotpress_url)
1717
response = Net::HTTP.get_response(uri)
1818

1919
case response.code
20-
when '200'
21-
# All good pass the result along
20+
when '200' # All good pass the result along
2221
response
23-
when '301'
24-
# Follow the redirect
25-
UI.message("Received 301 for `#{locale}`. Following redirect...")
26-
download(locale, response.header['location'], is_source)
27-
when '429'
28-
# We got rate-limited, auto_retry or offer to try again with a prompt
22+
when '301' # Follow the redirect
23+
UI.message("Received 301 for `#{response.uri}`. Following redirect...")
24+
download(response.header['location'])
25+
when '429' # We got rate-limited, auto_retry or offer to try again with a prompt
2926
if @auto_retry && @auto_retry_attempt_counter <= MAX_AUTO_RETRY_ATTEMPTS
3027
UI.message("Received 429 for `#{response.uri}`. Auto retrying in #{AUTO_RETRY_SLEEP_TIME} seconds...")
3128
sleep(AUTO_RETRY_SLEEP_TIME)
3229
@auto_retry_attempt_counter += 1
33-
download(target_locale, response.uri, is_source)
30+
download(response.uri)
3431
elsif UI.confirm("Retry downloading `#{response.uri}` after receiving 429 from the API?")
35-
download(target_locale, response.uri, is_source)
32+
download(response.uri)
3633
else
3734
UI.error("Abandoning `#{response.uri}` download as requested.")
3835
end
@@ -64,7 +61,7 @@ def initialize(target_folder, target_files, auto_retry)
6461
# Downloads data from GlotPress, in JSON format
6562
def download(target_locale, glotpress_url, is_source)
6663
downloader = GlotPressDownloader.new(@auto_retry)
67-
response = downloader.download(target_locale, glotpress_url, is_source)
64+
response = downloader.download(glotpress_url)
6865
handle_glotpress_download(response: response, locale: target_locale, is_source: is_source)
6966
end
7067

0 commit comments

Comments
 (0)