Module: Resync::Client::Mixins::Downloadable
- Includes:
- ClientDelegator
- Included in:
- ZippedResource, Link, Resource
- Defined in:
- lib/resync/client/mixins/downloadable.rb
Overview
A downloadable resource or link.
Instance Attribute Summary
Attributes included from ClientDelegator
Instance Method Summary collapse
-
#download_to_file(path) ⇒ Object
Delegates to Resync::Client#download_to_file to download the contents of
:uri
to the specified path. -
#download_to_temp_file ⇒ Object
Delegates to Resync::Client#download_to_temp_file to download the contents of
:uri
to a file. -
#get ⇒ Object
Delegates to Resync::Client#get to get the contents of this
:uri
. -
#get_and_parse ⇒ Object
Delegates to Resync::Client#get_and_parse to get the contents of
:uri
as a ResourceSync document.
Methods included from ClientDelegator
Instance Method Details
#download_to_file(path) ⇒ Object
Delegates to Resync::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.
38 39 40 |
# 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 ⇒ Object
Delegates to Resync::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.
29 30 31 |
# File 'lib/resync/client/mixins/downloadable.rb', line 29 def download_to_temp_file # rubocop:disable Style/AccessorMethodName client.download_to_temp_file(uri) end |
#get ⇒ Object
Delegates to Resync::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.
22 23 24 |
# File 'lib/resync/client/mixins/downloadable.rb', line 22 def get # rubocop:disable Style/AccessorMethodName @content ||= client.get(uri) end |
#get_and_parse ⇒ Object
Delegates to Resync::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.
15 16 17 |
# 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 |