Class: VHS::Cassetter
- Inherits:
-
Object
- Object
- VHS::Cassetter
- Defined in:
- lib/vhs/cassetter.rb
Class Method Summary collapse
-
.update(cassette_filename) ⇒ Object
TODO - write this as an instance method - allow to pass cassette with or w/o VCR.configuration.cassette_library_dir.
Class Method Details
.update(cassette_filename) ⇒ Object
TODO
-
write this as an instance method
-
allow to pass cassette with or w/o VCR.configuration.cassette_library_dir
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vhs/cassetter.rb', line 10 def self.update(cassette_filename) cassette_yaml = VCR::Cassette::Reader.new(cassette_filename, { api_host: VHS::config.api_host }).read cassette_hash = YAML.load cassette_yaml #FIXME params are getting lost here cassette_request = cassette_hash.first[:request] = { body: cassette_request[:body], method: cassette_request[:method], headers: { Accept: 'application/json' } # other headers make the servers raise } if cassette_request.respond_to? :params [:params] = cassette_request[:params] end VHS.cassette_force_updates # forces cassette to be recorded request = Typhoeus::Request.new cassette_request[:uri], hydra = Typhoeus::Hydra.new hydra.queue request hydra.run end |