Class: Riiif::HTTPFileResolver::RemoteFile

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Benchmarkable
Defined in:
lib/riiif/http_file_resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ RemoteFile

Returns a new instance of RemoteFile.



34
35
36
37
# File 'lib/riiif/http_file_resolver.rb', line 34

def initialize(url, options = {})
  @url = url
  @options = options
end

Instance Attribute Details

#cache_pathObject (readonly)

Returns the value of attribute cache_path.



33
34
35
# File 'lib/riiif/http_file_resolver.rb', line 33

def cache_path
  @cache_path
end

#urlObject (readonly)

Returns the value of attribute url.



33
34
35
# File 'lib/riiif/http_file_resolver.rb', line 33

def url
  @url
end

Instance Method Details

#basic_auth_credentialsObject



43
44
45
# File 'lib/riiif/http_file_resolver.rb', line 43

def basic_auth_credentials
  @options[:basic_auth_credentials]
end

#fetchObject



47
48
49
50
# File 'lib/riiif/http_file_resolver.rb', line 47

def fetch
  download_file unless ::File.exist?(file_name)
  file_name
end