Class: Bipm::Data::Importer::Strategies::Base
- Inherits:
-
Object
- Object
- Bipm::Data::Importer::Strategies::Base
- Defined in:
- lib/bipm/data/importer/strategies/base.rb
Overview
Abstract strategy. Subclasses implement call and override
recording_mode. The Fetcher queries recording_mode to decide
whether to disable VCR/WebMock before invoking — the CLI never
touches VCR directly.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#languages ⇒ Object
readonly
Returns the value of attribute languages.
Class Method Summary collapse
-
.recording_mode ⇒ Object
:live -> HTTP requests bypass VCR/WebMock entirely.
Instance Method Summary collapse
- #call(agent:) ⇒ Object
-
#initialize(body:, base_dir:, languages: Language.all) ⇒ Base
constructor
A new instance of Base.
- #recording_mode ⇒ Object
Constructor Details
#initialize(body:, base_dir:, languages: Language.all) ⇒ Base
Returns a new instance of Base.
16 17 18 19 20 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 16 def initialize(body:, base_dir:, languages: Language.all) @body = body @base_dir = base_dir @languages = languages.map { |l| l.is_a?(Language) ? l : Language.find(l) } end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
14 15 16 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 14 def base_dir @base_dir end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
14 15 16 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 14 def body @body end |
#languages ⇒ Object (readonly)
Returns the value of attribute languages.
14 15 16 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 14 def languages @languages end |
Class Method Details
.recording_mode ⇒ Object
:live -> HTTP requests bypass VCR/WebMock entirely. :cassette -> VCR replays recorded responses (records new episodes when BIPM_VCR_RECORD is set).
29 30 31 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 29 def self.recording_mode :cassette end |
Instance Method Details
#call(agent:) ⇒ Object
22 23 24 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 22 def call(agent:) raise NotImplementedError, "#{self.class}#call not implemented" end |
#recording_mode ⇒ Object
33 34 35 |
# File 'lib/bipm/data/importer/strategies/base.rb', line 33 def recording_mode self.class.recording_mode end |