Module: DPN::Client::Agent::Digest

Included in:
DPN::Client::Agent
Defined in:
lib/dpn/client/agent/digest.rb

Overview

Operations on the digest resource.

Instance Method Summary collapse

Instance Method Details

#bag_digests(bag, options = {page_size: 25}) {|Response| ... } ⇒ Object

Get the digests for a specific bag

Parameters:

  • options (Hash) (defaults to: {page_size: 25})

    a customizable set of options

Options Hash (options):

  • :page_size (Fixnum) — default: 25

    Number of results per page

  • :before (DateTime String) — default: nil

    Include only entries last modified before this date.

  • :after (DateTime String) — default: nil

    Include only entries last modified after this date.

Yields:

  • (Response)

    Block to process each individual result.



33
34
35
# File 'lib/dpn/client/agent/digest.rb', line 33

def bag_digests(bag, options = {page_size: 25}, &block)
  paginate_each "/bag/#{bag}/digest/", options, options[:page_size], &block
end

#create_digest(digest) {|Response| ... } ⇒ Response

Create a digest

Parameters:

  • digest (Hash)

    Body of the digest

Yields:

Returns:



52
53
54
# File 'lib/dpn/client/agent/digest.rb', line 52

def create_digest(digest, &block)
  post "/bag/#{digest[:bag]}/digest/", digest, &block
end

#digest(bag, algorithm) {|Response| ... } ⇒ Response

Get a specific digest

Parameters:

  • bag (String)

    UUIDv4 of the bag.

  • algorithm (String)

    Name of the algorithm.

Yields:

  • (Response)

    Optional block to process the response.

Returns:



43
44
45
# File 'lib/dpn/client/agent/digest.rb', line 43

def digest(bag, algorithm, &block)
  get "/bag/#{bag}/digest/#{algorithm}/", nil, &block
end

#digests(options = {page_size: 25}) {|Response| ... } ⇒ Object

Get the digests index

Parameters:

  • options (Hash) (defaults to: {page_size: 25})

Options Hash (options):

  • :page_size (Fixnum) — default: 25

    Number of results per page

  • :before (DateTime String) — default: nil

    Include only entries last modified before this date.

  • :after (DateTime String) — default: nil

    Include only entries last modified after this date.

Yields:

  • (Response)

    Block to process each individual result.



21
22
23
# File 'lib/dpn/client/agent/digest.rb', line 21

def digests(options = {page_size: 25}, &block)
  paginate_each "/digest/", options, options[:page_size], &block
end