Skip to content

Instantly share code, notes, and snippets.

@bleonard
Created December 24, 2016 19:23
Show Gist options
  • Save bleonard/9378e40d7a6d69f21905c6b784a03955 to your computer and use it in GitHub Desktop.
Save bleonard/9378e40d7a6d69f21905c6b784a03955 to your computer and use it in GitHub Desktop.
class Fetcher
def initialize(path)
@path = path
end
def fetch!
VCR.use_cassette('#{@path}/fetched') do
response = Net::HTTP.get_response(URI("api.http://example.com/#{@path}"))
process(response)
end
end
end
class Main
def process_all
self.paths.each do |path|
fetcher = Fetcher.new(path)
fetcher.fetch!
end
end
end
# global
VCR.configure do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment