Class: CDMDEXER::CdmItem
- Inherits:
 - 
      Object
      
        
- Object
 - CDMDEXER::CdmItem
 
 
- Defined in:
 - lib/cdmdexer/cdm_item.rb
 
Instance Attribute Summary collapse
- 
  
    
      #cdm_api_klass  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute cdm_api_klass.
 - 
  
    
      #cdm_endpoint  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute cdm_endpoint.
 - 
  
    
      #cdm_notification_klass  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute cdm_notification_klass.
 - 
  
    
      #collection  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute collection.
 - 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute id.
 - 
  
    
      #record  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute record.
 
Instance Method Summary collapse
- 
  
    
      #initialize(record: :MISSING_RECORD, cdm_endpoint: :MISSING_ENDPOINT, cdm_api_klass: CONTENTdmAPI::Item, cdm_notification_klass: CDMDEXER::CdmNotification)  ⇒ CdmItem 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of CdmItem.
 - #page ⇒ Object
 - #to_h ⇒ Object
 
Constructor Details
#initialize(record: :MISSING_RECORD, cdm_endpoint: :MISSING_ENDPOINT, cdm_api_klass: CONTENTdmAPI::Item, cdm_notification_klass: CDMDEXER::CdmNotification) ⇒ CdmItem
Returns a new instance of CdmItem.
      10 11 12 13 14 15 16 17 18 19  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 10 def initialize(record: :MISSING_RECORD, cdm_endpoint: :MISSING_ENDPOINT, cdm_api_klass: CONTENTdmAPI::Item, cdm_notification_klass: CDMDEXER::CdmNotification) @record = record @collection, @id = record['id'].split(':') @cdm_endpoint = cdm_endpoint @cdm_api_klass = cdm_api_klass @cdm_notification_klass = cdm_notification_klass end  | 
  
Instance Attribute Details
#cdm_api_klass ⇒ Object (readonly)
Returns the value of attribute cdm_api_klass.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def cdm_api_klass @cdm_api_klass end  | 
  
#cdm_endpoint ⇒ Object (readonly)
Returns the value of attribute cdm_endpoint.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def cdm_endpoint @cdm_endpoint end  | 
  
#cdm_notification_klass ⇒ Object (readonly)
Returns the value of attribute cdm_notification_klass.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def cdm_notification_klass @cdm_notification_klass end  | 
  
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def collection @collection end  | 
  
#id ⇒ Object (readonly)
Returns the value of attribute id.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def id @id end  | 
  
#record ⇒ Object (readonly)
Returns the value of attribute record.
      3 4 5  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 3 def record @record end  | 
  
Instance Method Details
#page ⇒ Object
      28 29 30 31  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 28 def page primary_record.fetch('page', []) .each_with_index.map { |page, i| to_compound(page, i) } end  | 
  
#to_h ⇒ Object
      21 22 23 24 25 26  | 
    
      # File 'lib/cdmdexer/cdm_item.rb', line 21 def to_h # Preserve the record hash. It may contain compound data that has been # resubmitted here by the transformer_worker as it recurses through # compounds in order to extract their full metadata @to_h ||= record.merge() end  |