File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
2727
2828 spec . add_dependency 'nokogiri' , '~> 1.6.0'
2929 spec . add_dependency 'rubyzip' , '>= 1.0.0'
30+ spec . add_dependency 'httparty' , '~> 0.14.0'
3031end
Original file line number Diff line number Diff line change 11require 'zip/filesystem'
22require 'nokogiri'
33require 'date'
4- require 'open-uri '
4+ require 'httparty '
55
66module Creek
77
@@ -20,8 +20,14 @@ def initialize path, options = {}
2020 extension = File . extname ( options [ :original_filename ] || path ) . downcase
2121 raise 'Not a valid file format.' unless ( [ '.xlsx' , '.xlsm' ] . include? extension )
2222 end
23- path = open ( path ) if options [ :remote ]
24- @files = Zip ::File . open path
23+ if options [ :remote ]
24+ zipfile = Tempfile . new ( "file" )
25+ zipfile . binmode
26+ zipfile . write ( HTTParty . get ( path ) . body )
27+ zipfile . close
28+ path = zipfile . path
29+ end
30+ @files = Zip ::File . open ( path )
2531 @shared_strings = SharedStrings . new ( self )
2632 end
2733
You can’t perform that action at this time.
0 commit comments