Class: E621ExportDownloader::Client
- Inherits:
-
Object
- Object
- E621ExportDownloader::Client
- Extended by:
- T::Sig
- Defined in:
- lib/e621_export_downloader/client.rb,
lib/e621_export_downloader/client/options.rb,
lib/e621_export_downloader/client/options/builder.rb,
lib/e621_export_downloader/client/options/builder/parsers.rb
Defined Under Namespace
Classes: Options
Constant Summary collapse
- Logger =
::Logger.new($stdout)
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #config(&block) ⇒ Object
- #connection ⇒ Object
- #debug(msg, header: []) ⇒ Object
- #get(type) ⇒ Object
- #get_pools(date = Date.today) ⇒ Object
- #get_posts(date = Date.today) ⇒ Object
- #get_tag_aliases(date = Date.today) ⇒ Object
- #get_tag_implications(date = Date.today) ⇒ Object
- #get_tags(date = Date.today) ⇒ Object
- #get_wiki_pages(date = Date.today) ⇒ Object
-
#initialize(options = nil) ⇒ Client
constructor
A new instance of Client.
- #pools ⇒ Object
- #posts ⇒ Object
- #tag_aliases ⇒ Object
- #tag_implications ⇒ Object
- #tags ⇒ Object
- #wiki_pages ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/e621_export_downloader/client.rb', line 13 def @options end |
Instance Method Details
#config(&block) ⇒ Object
21 22 23 |
# File 'lib/e621_export_downloader/client.rb', line 21 def config(&block) block.call(Options::Builder.new(@options)) end |
#connection ⇒ Object
26 27 28 |
# File 'lib/e621_export_downloader/client.rb', line 26 def connection Faraday.new(url: Constants::BASE_URL, headers: { "User-Agent" => Constants::USER_AGENT }) end |
#debug(msg, header: []) ⇒ Object
31 32 33 |
# File 'lib/e621_export_downloader/client.rb', line 31 def debug(msg, header: []) Logger.debug("[e621_export_downloader#{":#{header.join(':')}" unless header.empty?}] #{msg}") end |
#get(type) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/e621_export_downloader/client.rb', line 36 def get(type) if type.is_a?(String) case type when "pools" type = Types::Pools when "posts" type = Types::Posts when "tag_aliases" type = Types::TagAliases when "tag_implications" type = Types::TagImplications when "tags" type = Types::Tags when "wiki_pages" type = Types::WikiPages else raise(ArgumentError, "invalid type: #{type}") end end T.assert_type!(type, Types) ExportHelper.new(client: self, type: type, parser: .parsers.public_send(type.serialize)) end |
#get_pools(date = Date.today) ⇒ Object
66 67 68 |
# File 'lib/e621_export_downloader/client.rb', line 66 def get_pools(date = Date.today) pools.get(date) end |
#get_posts(date = Date.today) ⇒ Object
76 77 78 |
# File 'lib/e621_export_downloader/client.rb', line 76 def get_posts(date = Date.today) posts.get(date) end |
#get_tag_aliases(date = Date.today) ⇒ Object
86 87 88 |
# File 'lib/e621_export_downloader/client.rb', line 86 def get_tag_aliases(date = Date.today) tag_aliases.get(date) end |
#get_tag_implications(date = Date.today) ⇒ Object
96 97 98 |
# File 'lib/e621_export_downloader/client.rb', line 96 def get_tag_implications(date = Date.today) tag_implications.get(date) end |
#get_tags(date = Date.today) ⇒ Object
106 107 108 |
# File 'lib/e621_export_downloader/client.rb', line 106 def (date = Date.today) .get(date) end |
#get_wiki_pages(date = Date.today) ⇒ Object
116 117 118 |
# File 'lib/e621_export_downloader/client.rb', line 116 def get_wiki_pages(date = Date.today) wiki_pages.get(date) end |
#pools ⇒ Object
61 62 63 |
# File 'lib/e621_export_downloader/client.rb', line 61 def pools get(Types::Pools) end |
#posts ⇒ Object
71 72 73 |
# File 'lib/e621_export_downloader/client.rb', line 71 def posts get(Types::Posts) end |
#tag_aliases ⇒ Object
81 82 83 |
# File 'lib/e621_export_downloader/client.rb', line 81 def tag_aliases get(Types::TagAliases) end |
#tag_implications ⇒ Object
91 92 93 |
# File 'lib/e621_export_downloader/client.rb', line 91 def tag_implications get(Types::TagImplications) end |
#tags ⇒ Object
101 102 103 |
# File 'lib/e621_export_downloader/client.rb', line 101 def get(Types::Tags) end |
#wiki_pages ⇒ Object
111 112 113 |
# File 'lib/e621_export_downloader/client.rb', line 111 def wiki_pages get(Types::WikiPages) end |