Created
December 24, 2016 19:23
-
-
Save bleonard/9378e40d7a6d69f21905c6b784a03955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main | |
def process_all | |
self.paths.each do |path| | |
fetcher = Fetcher.new(path) | |
fetcher.fetch! | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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