Class: FileGrabber::RemoteDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/filegrabber/remote_document.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ RemoteDocument

Returns a new instance of RemoteDocument.



7
8
9
10
11
# File 'lib/filegrabber/remote_document.rb', line 7

def initialize url
  @params = URI.decode_www_form(url.query).to_h
  url.query = nil
  @url = url
end

Instance Method Details

#downloadObject



13
14
15
16
# File 'lib/filegrabber/remote_document.rb', line 13

def download
  Log.info "FROM URL: #{@url}"
  Unirest.get(@url.to_s, parameters: @params).body
end