Sha256: ad67b482cd46751418f1d050c8215e53ba78435b26aaf2b86547922bb7d0f7a9

Contents?: true

Size: 1.99 KB

Versions: 19

Compression:

Stored size: 1.99 KB

Contents

class DigitalAssetLookupService

  # def self.find_documents_by_fund_code(fund_codes)
  #   ids = fund_codes.collect {|c| term_id_from_fund_code(c)}
  #   DigitalAsset.unscoped.content_type_in(DigitalAsset::ContentType::FUND_DOC_TYPES).product_in ids
  # end

  # def self.find_documents_by_fund_code_and_content_type(fund_codes,content_type)
  #   assets = DigitalAssetLookupService.find_documents_by_fund_code(fund_codes)
  #   found_asset = nil
  #   assets.each {|da|
  #     da.documents.each {|doc|
  #       found_asset = da if doc.content_type == content_type
  #     }
  #   }
  #   found_asset
  # end

  def self.fund_code_from_id(taxonomy_id)
    TaxonomyTerm.term_id_is(taxonomy_id).first.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

  # def self.fund_code_from_asset_path(path)
  #   da = DigitalAsset.path_is(item.path).first
  #   fund_code = fund_for_digital_asset da
  # end
  # def self.find_documents_by_query(arg_product_ids=nil, arg_content_type_ids=nil, arg_audience_ids=nil, finra=nil)
  #   product_ids = [] << arg_product_ids 
  #   product_ids.compact!
  #   product_ids.flatten!
  #   content_type_ids = [] << arg_content_type_ids
  #   content_type_ids.compact!
  #   content_type_ids.flatten!
  #   audience_ids = [] << arg_audience_ids
  #   audience_ids.compact!
  #   audience_ids.flatten!
  #   finra = finra || false
  #   query = {}
  #   query[:product_ids.in] = product_ids if !product_ids.blank?
  #   query[:'documents.content_type'.in] = content_type_ids if !content_type_ids.blank?
  #   query[:audiences.in] = audience_ids if !audience_ids.blank?

  #   digital_assets = DigitalAsset.where(query)
  #   digital_assets = digital_assets.select {|d| d.has_finra?} if finra
  #   digital_assets
  # end

  # def self.find_documents_by_sami_code(sami_codes)
  #   DigitalAsset.sami_in sami_codes
  # end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
daengine-0.7.3 app/service/digital_asset_lookup_service.rb
daengine-0.7.2 app/service/digital_asset_lookup_service.rb
daengine-0.7.1 app/service/digital_asset_lookup_service.rb
daengine-0.7 app/service/digital_asset_lookup_service.rb
daengine-0.6.23 app/service/digital_asset_lookup_service.rb
daengine-0.6.22 app/service/digital_asset_lookup_service.rb
daengine-0.6.21 app/service/digital_asset_lookup_service.rb
daengine-0.6.20 app/service/digital_asset_lookup_service.rb
daengine-0.6.19 app/service/digital_asset_lookup_service.rb
daengine-0.6.18 app/service/digital_asset_lookup_service.rb
daengine-0.6.17 app/service/digital_asset_lookup_service.rb
daengine-0.6.16 app/service/digital_asset_lookup_service.rb
daengine-0.6.15 app/service/digital_asset_lookup_service.rb
daengine-0.6.14 app/service/digital_asset_lookup_service.rb
daengine-0.6.13 app/service/digital_asset_lookup_service.rb
daengine-0.6.11 app/service/digital_asset_lookup_service.rb
daengine-0.6.10 app/service/digital_asset_lookup_service.rb
daengine-0.6.9 app/service/digital_asset_lookup_service.rb
daengine-0.6.8 app/service/digital_asset_lookup_service.rb