Sha256: 0da4e7989735da799bd73dcca649c8d9999e96ac28063cfea1237d960819ffe9

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

require 'httparty'
require 'zip'

module SoapyBing
  module Helpers
    class ZipDownloader
      def initialize(url)
        @url = url
      end

      def read
        Zip::InputStream.open(download_io) do |archive_io|
          file_io = archive_io.get_next_entry.get_input_stream
          file_io.read
        end
      end

      private

      def download_io
        StringIO.new HTTParty.get(@url).body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soapy_bing-1.0.1 lib/soapy_bing/helpers/zip_downloader.rb
soapy_bing-1.0.0 lib/soapy_bing/helpers/zip_downloader.rb
soapy_bing-0.4.0 lib/soapy_bing/helpers/zip_downloader.rb