Class: Puree::Extractor::Download

Inherits:
Object
  • Object
show all
Includes:
API::Authentication
Defined in:
lib/puree/extractor/download.rb

Overview

Download extractor.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Download

Returns a new instance of Download.

Parameters:

  • config (Hash)

    a customizable set of options

Options Hash (config):

  • :url (String)

    The URL of the Pure host.

  • :username (String)

    The username of the Pure host account.

  • :password (String)

    The password of the Pure host account.



11
12
13
14
15
# File 'lib/puree/extractor/download.rb', line 11

def initialize(config)
  @resource_type = :download
  @api_map = Puree::API::Map.new.get # Workararound to provide access to service_family
  configure_api config
end

Instance Method Details

#get(limit: 0, offset: 0, resource:) ⇒ Array<Puree::Model::DownloadHeader> Also known as: find

Get download statistics. Only for Datasets.

Parameters:

  • limit (Fixnum) (defaults to: 0)
  • offset (Fixnum) (defaults to: 0)
  • resource (Symbol)

    The resource being reported

Returns:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/puree/extractor/download.rb', line 23

def get(limit: 0,
        offset: 0,
        resource:)
  raise 'Cannot perform a request without a configuration' if @config.nil?
  @response = @request.get rendering:      :system,
                           limit:          limit,
                           offset:         offset,
                           resource_type:  @resource_type,
                           content_type:   service_family(resource)
  set_content @response.body
end