Class: Obp::Access::Retriever
- Inherits:
-
Object
- Object
- Obp::Access::Retriever
- Defined in:
- lib/obp/access/retriever.rb
Constant Summary collapse
- MANIFEST_FILE =
"manifest.json"
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#concurrency ⇒ Object
readonly
Returns the value of attribute concurrency.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
Instance Method Summary collapse
-
#initialize(output_dir:, catalog:, concurrency: 4) ⇒ Retriever
constructor
A new instance of Retriever.
- #run ⇒ Object
Constructor Details
#initialize(output_dir:, catalog:, concurrency: 4) ⇒ Retriever
Returns a new instance of Retriever.
13 14 15 16 17 |
# File 'lib/obp/access/retriever.rb', line 13 def initialize(output_dir:, catalog:, concurrency: 4) @output_dir = output_dir @catalog = catalog @concurrency = concurrency end |
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
11 12 13 |
# File 'lib/obp/access/retriever.rb', line 11 def catalog @catalog end |
#concurrency ⇒ Object (readonly)
Returns the value of attribute concurrency.
11 12 13 |
# File 'lib/obp/access/retriever.rb', line 11 def concurrency @concurrency end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
11 12 13 |
# File 'lib/obp/access/retriever.rb', line 11 def output_dir @output_dir end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/obp/access/retriever.rb', line 19 def run FileUtils.mkdir_p(output_dir) pending = pending_deliverables total = pending.size if total.zero? puts "Nothing to retrieve — all #{catalog.retrievable.size} deliverables already fetched." return end puts "Retrieving #{total} deliverables to #{output_dir} (concurrency: #{concurrency})..." process_all(pending, total) puts "Done. Fetched #{total} documents." end |