module Resync::Client::Mixins::Downloadable

A downloadable resource or link.

Public Instance Methods

download_to_file(path) click to toggle source

Delegates to {Client#download_to_file} to download the contents of :uri to the specified path. Subsequent calls wiill download the contents again, potentially overwriting the file if given the same path. @param path [String] the path to download to

# File lib/resync/client/mixins/downloadable.rb, line 38
def download_to_file(path)
  client.download_to_file(uri: uri, path: path)
end
download_to_temp_file() click to toggle source

Delegates to {Client#download_to_temp_file} to download the contents of :uri to a file. Subsequent calls will download the contents again, each time to a fresh temporary file.

# File lib/resync/client/mixins/downloadable.rb, line 29
def download_to_temp_file
  client.download_to_temp_file(uri)
end
get() click to toggle source

Delegates to {Client#get} to get the contents of this :uri. The downloaded content will only be downloaded once; subsequent calls to this method will return the cached content.

# File lib/resync/client/mixins/downloadable.rb, line 22
def get
  @content ||= client.get(uri)
end
get_and_parse() click to toggle source

Delegates to {Client#get_and_parse} to get the contents of :uri as a ResourceSync document. The downloaded, parsed document will only be downloaded once; subsequent calls to this method will return the cached document.

# File lib/resync/client/mixins/downloadable.rb, line 15
def get_and_parse # rubocop:disable Style/AccessorMethodName
  @parsed_content ||= client.get_and_parse(uri)
end