Sha256: 92c9141909913e94a31dfadfbe0edf2c6b0ebfa49bc3f5d3e4ea4e800570764a

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

class DigitalAssetLookupService

  def self.find_documents_by_fund_code(fund_codes)
    ids = fund_codes.collect {|c| term_id_from_fund_code(c)}
    DigitalAsset.product_in ids
  end

  def self.fund_code_from_id(taxonomy_id)
    TaxonomyTerm.term_id_is(taxonomy_id).try(:term_type).try([], 'FUND_CODE')
  end

  def self.term_id_from_fund_code(code) 
   term = TaxonomyTerm.fund_code_is(code)
   term.try(:first).try(:term_id)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daengine-0.2.18 app/service/digital_asset_lookup_service.rb