Sha256: c768215b3526770da53a28bf4b7eae41eb67ca3a036c6b33b88aa16e00022537
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
# typed: true # frozen_string_literal: true require_relative '../extension/metadata_fix_wrap_kw_args' module Workato module Testing class VCREncryptedCassetteSerializer < ActiveSupport::EncryptedFile def initialize super( content_path: '', key_path: Workato::Connector::Sdk::DEFAULT_MASTER_KEY_PATH, env_key: Workato::Connector::Sdk::DEFAULT_MASTER_KEY_ENV, raise_if_missing_key: true ) end def file_extension 'enc' end def serialize(hash) ::Dir::Tmpname.create('vcr_cassette') do |tmp_path| @content_path = Pathname.new(tmp_path) end write(YAML.dump(hash)) File.binread(content_path) ensure File.unlink(content_path) if content_path.exist? @content_path = '' end def deserialize(string) ::Dir::Tmpname.create('vcr_cassette') do |tmp_path| @content_path = Pathname.new(tmp_path) end File.write(@content_path, string) ::YAML.safe_load(read).presence || {} ensure File.unlink(content_path) if content_path.exist? @content_path = '' end end end end
Version data entries
15 entries across 15 versions & 1 rubygems