Class: E621ExportDownloader::ExportHelper
- Inherits:
-
Object
- Object
- E621ExportDownloader::ExportHelper
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/e621_export_downloader/export_helper.rb
Constant Summary collapse
- Model =
type_member
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #delete(date) ⇒ Object
- #download(date) ⇒ Object
- #exists?(date) ⇒ Boolean
- #format_date(date) ⇒ Object
- #get(date) ⇒ Object
-
#initialize(type:, parser:, client:) ⇒ ExportHelper
constructor
A new instance of ExportHelper.
Constructor Details
#initialize(type:, parser:, client:) ⇒ ExportHelper
Returns a new instance of ExportHelper.
21 22 23 24 25 26 |
# File 'lib/e621_export_downloader/export_helper.rb', line 21 def initialize(type:, parser:, client:) @type = type @parser = parser @client = client @rewind_count = T.let(0, Integer) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/e621_export_downloader/export_helper.rb', line 18 def client @client end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
15 16 17 |
# File 'lib/e621_export_downloader/export_helper.rb', line 15 def parser @parser end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/e621_export_downloader/export_helper.rb', line 12 def type @type end |
Instance Method Details
#delete(date) ⇒ Object
34 35 36 37 |
# File 'lib/e621_export_downloader/export_helper.rb', line 34 def delete(date) client.debug("deleting export for #{type.serialize}", header: %W[helper #{format_date(date)}]) _get(date).delete end |
#download(date) ⇒ Object
40 41 42 43 |
# File 'lib/e621_export_downloader/export_helper.rb', line 40 def download(date) client.debug("downloading export for #{type.serialize}", header: %W[helper #{format_date(date)}]) _get(date).download end |
#exists?(date) ⇒ Boolean
46 47 48 49 |
# File 'lib/e621_export_downloader/export_helper.rb', line 46 def exists?(date) client.debug("checking export existence for #{type.serialize}", header: %W[helper #{format_date(date)}]) _get(date).exists? end |
#format_date(date) ⇒ Object
29 30 31 |
# File 'lib/e621_export_downloader/export_helper.rb', line 29 def format_date(date) date.strftime("%Y-%m-%d") end |