Class: Fastlane::Helper::GlotPressDownloader
- Inherits:
-
Object
- Object
- Fastlane::Helper::GlotPressDownloader
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb
Overview
A helper class to download files from GlotPress with proper error handling and retry mechanism
Constant Summary collapse
- AUTO_RETRY_SLEEP_TIME =
20- MAX_AUTO_RETRY_ATTEMPTS =
30
Instance Attribute Summary collapse
-
#auto_retry ⇒ Object
readonly
Returns the value of attribute auto_retry.
-
#auto_retry_attempt_counter ⇒ Object
readonly
Returns the value of attribute auto_retry_attempt_counter.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.download(url:, locale:, auto_retry: false) {|String| ... } ⇒ Object
Convenience class method to download in a single call.
Instance Method Summary collapse
-
#download {|String| ... } ⇒ Object
Downloads data from GlotPress.
-
#initialize(url:, locale:, auto_retry: false) ⇒ GlotPressDownloader
constructor
Initialize a new GlotPressDownloader.
Constructor Details
#initialize(url:, locale:, auto_retry: false) ⇒ GlotPressDownloader
Initialize a new GlotPressDownloader
21 22 23 24 25 26 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 21 def initialize(url:, locale:, auto_retry: false) @url = url @locale = locale @auto_retry = auto_retry @auto_retry_attempt_counter = 0 end |
Instance Attribute Details
#auto_retry ⇒ Object (readonly)
Returns the value of attribute auto_retry.
13 14 15 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 13 def auto_retry @auto_retry end |
#auto_retry_attempt_counter ⇒ Object (readonly)
Returns the value of attribute auto_retry_attempt_counter.
13 14 15 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 13 def auto_retry_attempt_counter @auto_retry_attempt_counter end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
13 14 15 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 13 def locale @locale end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
13 14 15 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 13 def url @url end |
Class Method Details
.download(url:, locale:, auto_retry: false) {|String| ... } ⇒ Object
Convenience class method to download in a single call
37 38 39 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 37 def self.download(url:, locale:, auto_retry: false, &) new(url: url, locale: locale, auto_retry: auto_retry).download(&) end |
Instance Method Details
#download {|String| ... } ⇒ Object
Downloads data from GlotPress
46 47 48 49 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_downloader.rb', line 46 def download(&) @auto_retry_attempt_counter = 0 # Reset counter only at start of download download_from_url(@url, &) end |