Class: CDMBL::CompoundLookup

Inherits:
Object
  • Object
show all
Defined in:
lib/cdmbl/compound_lookup.rb

Overview

Fetching the full metadata for compound records is expensive. This class lets us check on how many compounds a CDM record has so that we know

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cdm_endpoint: '', collection: '', id: '', request_klass: CONTENTdmAPI::Request, service_klass: CONTENTdmAPI::Service) ⇒ CompoundLookup

Returns a new instance of CompoundLookup.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cdmbl/compound_lookup.rb', line 11

def initialize(cdm_endpoint: '',
               collection: '',
               id: '',
               request_klass: CONTENTdmAPI::Request,
               service_klass: CONTENTdmAPI::Service)
  @cdm_endpoint  = cdm_endpoint
  @collection    = collection
  @id            = id
  @request_klass = request_klass
  @service_klass = service_klass
end

Instance Attribute Details

#cdm_endpointObject (readonly)

Returns the value of attribute cdm_endpoint.



5
6
7
# File 'lib/cdmbl/compound_lookup.rb', line 5

def cdm_endpoint
  @cdm_endpoint
end

#collectionObject (readonly)

Returns the value of attribute collection.



5
6
7
# File 'lib/cdmbl/compound_lookup.rb', line 5

def collection
  @collection
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/cdmbl/compound_lookup.rb', line 5

def id
  @id
end

#request_klassObject (readonly)

Returns the value of attribute request_klass.



5
6
7
# File 'lib/cdmbl/compound_lookup.rb', line 5

def request_klass
  @request_klass
end

#service_klassObject (readonly)

Returns the value of attribute service_klass.



5
6
7
# File 'lib/cdmbl/compound_lookup.rb', line 5

def service_klass
  @service_klass
end

Instance Method Details

#countObject



23
24
25
# File 'lib/cdmbl/compound_lookup.rb', line 23

def count
  page.respond_to?(:length) ? page.length : 0
end