Sha256: 581462c3fa5a27e80aa34cabd2ba9e330e8a88fb7030db84e7988ff92ea9a238

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require 'resync'

module Resync

  # Adds +get+, +get_raw+, and +get_file+ methods, delegating
  # to the injected client.
  #
  # @see Augmented#client
  module Downloadable
    # Delegates to {Client#get_and_parse} to get the contents of
    # +:uri+ as a ResourceSync document
    def get_and_parse # rubocop:disable Style/AccessorMethodName
      client.get_and_parse(uri)
    end

    # Delegates to {Client#get} to get the contents of this +:uri+
    def get # rubocop:disable Style/AccessorMethodName
      client.get(uri)
    end

    # Delegates to {Client#download_to_temp_file} to download the
    # contents of +:uri+ to a file.
    def download_to_temp_file # rubocop:disable Style/AccessorMethodName
      client.download_to_temp_file(uri)
    end

    # Delegates to {Client#download_to_file} to download the
    # contents of +:uri+ to the specified path.
    # @param path [String] the path to download to
    def download_to_file(path)
      client.download_to_file(uri: uri, path: path)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resync-client-0.1.2 lib/resync/client/downloadable.rb
resync-client-0.1.1 lib/resync/client/downloadable.rb
resync-client-0.1.0 lib/resync/client/downloadable.rb