Class: Riiif::HttpFileResolver::RemoteFile

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Benchmarkable
Defined in:
app/resolvers/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.



33
34
35
36
# File 'app/resolvers/riiif/http_file_resolver.rb', line 33

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

Instance Attribute Details

#cache_pathObject (readonly)

Returns the value of attribute cache_path.



32
33
34
# File 'app/resolvers/riiif/http_file_resolver.rb', line 32

def cache_path
  @cache_path
end

#urlObject (readonly)

Returns the value of attribute url.



32
33
34
# File 'app/resolvers/riiif/http_file_resolver.rb', line 32

def url
  @url
end

Instance Method Details

#basic_auth_credentialsObject



42
43
44
# File 'app/resolvers/riiif/http_file_resolver.rb', line 42

def basic_auth_credentials
  @options[:basic_auth_credentials]
end

#fetchObject



46
47
48
49
# File 'app/resolvers/riiif/http_file_resolver.rb', line 46

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