class FileGrabber::URL

Public Class Methods

new(url) click to toggle source
# File lib/filegrabber/url.rb, line 5
def initialize url
  @url = url
end

Public Instance Methods

get_body() click to toggle source
# File lib/filegrabber/url.rb, line 9
def get_body
  if HTTP_BASIC_AUTH[:password].nil?
    puts "Please provide a basic auth password."
    exit 1
  end
  Unirest.get(@url.to_s, auth: unirest_auth).body
end

Private Instance Methods

unirest_auth() click to toggle source
# File lib/filegrabber/url.rb, line 19
def unirest_auth
  {
    user: HTTP_BASIC_AUTH[:username],
    password: HTTP_BASIC_AUTH[:password]
  }
end