Module: DPN::Client::Agent::Bag

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

Instance Method Summary collapse

Instance Method Details

#bag(uuid) {|Response| ... } ⇒ Response

Get a specific bag

Parameters:

  • uuid (String)

    UUID of the bag.

Yields:

Returns:


38
39
40
# File 'lib/dpn/client/agent/bag.rb', line 38

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

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

Get the bags index

Parameters:

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

Options Hash (options):

  • :page_size (Fixnum) — default: 25

    Number of entries 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.

  • :bag_type (String) — default: nil

    One of ‘D’, ‘R’, ‘I’, for data, rights, and interpretive, respectively.

  • :admin_node (String) — default: nil

    Namespace of the admin_node of the bag.

  • :ingest_node (String) — default: nil

    Namespace of the ingest_node of the bag.

  • :member (String) — default: nil

    The UUID of the member that owns or is vested in this bag.

  • :first_version_uuid (String) — default: nil

    UUIDv4 of the bag’s first version.

  • :replicated_by (Array<String>) — default: []

    Namespaces of replicating nodes; the result is the UNION of these filters.

Yields:

  • (Response)

    Block to process each individual bag. @see Connection#paginate


29
30
31
# File 'lib/dpn/client/agent/bag.rb', line 29

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

#create_bag(bag) {|Response| ... } ⇒ Response

Create a bag

Parameters:

  • bag (Hash)

    Body of the bag

Yields:

Returns:


47
48
49
# File 'lib/dpn/client/agent/bag.rb', line 47

def create_bag(bag, &block)
  post "/bag/", bag, &block
end

#delete_bag(uuid) {|Response| ... } ⇒ Response

Delete a bag

Parameters:

  • uuid (String)

    UUID of the bag

Yields:

Returns:


65
66
67
# File 'lib/dpn/client/agent/bag.rb', line 65

def delete_bag(uuid, &block)
  delete "/bag/#{uuid}/", &block
end

#update_bag(bag) {|Response| ... } ⇒ Response

Update a bag

Parameters:

  • bag (Hash)

    Body of the bag

Yields:

Returns:


56
57
58
# File 'lib/dpn/client/agent/bag.rb', line 56

def update_bag(bag, &block)
  put "/bag/#{bag[:uuid]}/", bag, &block
end