Class: CONTENTdmAPI::CompoundItem

Inherits:
Object
  • Object
show all
Defined in:
lib/contentdm_api/compound_item.rb

Overview

A convenience method to retrive a Ruby hash of Item data from the CONTENTdm API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url: '', collection: '', id: 0, requester: RequestBatch, response: Response) ⇒ Void

Parameters:

  • base_url (String) (defaults to: '')

    URL to the CONTENTdm API “CdmServer.com:port/dmwebservices/index.php

  • collection (String) (defaults to: '')

    The CONTENTdm API calls this an “alias”

  • id (Integer) (defaults to: 0)

    The CONTENTdm API calls this a “pointer”. It is the identifier for a a given CONTENTdm item.

  • requester (Object) (defaults to: RequestBatch)

    A class to make requests of the API.

  • response (Object) (defaults to: Response)

    A class to parse API responses.


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/contentdm_api/compound_item.rb', line 16

def initialize(base_url: '',
               collection: '',
               id: 0,
               requester: RequestBatch,
               response: Response)
  @collection = collection
  @id         = id
  @requester  = requester
  @base_url   = base_url
  @response   = response
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url


5
6
7
# File 'lib/contentdm_api/compound_item.rb', line 5

def base_url
  @base_url
end

#collectionObject (readonly)

Returns the value of attribute collection


5
6
7
# File 'lib/contentdm_api/compound_item.rb', line 5

def collection
  @collection
end

#idObject (readonly)

Returns the value of attribute id


5
6
7
# File 'lib/contentdm_api/compound_item.rb', line 5

def id
  @id
end

#requesterObject (readonly)

Returns the value of attribute requester


5
6
7
# File 'lib/contentdm_api/compound_item.rb', line 5

def requester
  @requester
end

#responseObject (readonly)

Returns the value of attribute response


5
6
7
# File 'lib/contentdm_api/compound_item.rb', line 5

def response
  @response
end

Instance Method Details

#metadataHash

A hash of metadata with compound data for a given item

dmGetCompoundObjectInfo functions

Returns:

  • (Hash)

    Merged responses from the dmGetItemInfo and


32
33
34
# File 'lib/contentdm_api/compound_item.rb', line 32

def 
  values.first.merge(values.last).merge('id' => "#{collection}/#{id}")
end