daengine 0.5.13 → 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -0
- data/app/controllers/digital_assets_controller.rb +29 -46
- data/app/helpers/digital_assets_helper.rb +11 -2
- data/app/models/content_service_resource.rb +15 -15
- data/app/models/digital_asset.rb +83 -94
- data/app/models/teamsite_digital_asset_shim.rb +253 -0
- data/app/service/digital_asset_lookup_service.rb +47 -47
- data/bin/process_assets +6 -7
- data/bin/process_availability +7 -8
- data/bin/process_taxonomy +7 -8
- data/config/routes.rb +7 -7
- data/lib/daengine.rb +1 -13
- data/lib/daengine/content_service_processor.rb +24 -24
- data/lib/daengine/digital_asset_processor.rb +4 -0
- data/lib/daengine/teamsite_metadata_parser.rb +3 -2
- data/lib/daengine/version.rb +1 -1
- data/lib/tasks/daengine_tasks.rake +0 -9
- data/spec/acceptance/digital_assets_spec.rb +116 -0
- data/spec/controllers/digital_assets_controller_spec.rb +14 -99
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +8802 -0
- data/spec/factories.rb +8 -32
- data/spec/lib/content_service_processor_spec.rb +30 -30
- data/spec/lib/teamsite_metadata_parser_spec.rb +26 -19
- data/spec/mock_data/bulk-ssc_deploy.xml +900 -900
- data/spec/mock_data/daengine.yml +1 -1
- data/spec/mock_data/digitalAssets/GK-66261382-96be-4a92-839a-73467e89e1b4.txt +289 -289
- data/spec/mock_data/digitalAssets/TEST_FINRA_DOC.doc +0 -0
- data/spec/mock_data/digitalAssets/m_gyt-709d8ae1-31f1-46ea-b448-33f43dd5140f.html +1008 -1008
- data/spec/mock_data/selective_new_package.xml +55 -2
- data/spec/mock_data/taxonomy/taxonomyengine.yml +1 -1
- data/spec/models/digital_asset_spec.rb +23 -28
- data/spec/service/digital_asset_lookup_service_spec.rb +75 -79
- data/spec/spec_helper.rb +18 -1
- metadata +23 -7
- data/lib/daengine/digital_asset_extension_processor.rb +0 -28
- data/spec/lib/digital_asset_extension_processor_spec.rb +0 -32
- data/spec/mock_data/merrill_lynch_extension.json +0 -5
@@ -1,28 +0,0 @@
|
|
1
|
-
module Daengine
|
2
|
-
class DigitalAssetExtensionProcessor
|
3
|
-
|
4
|
-
def self.process_extension_file
|
5
|
-
file = Daengine.config[:digital_asset_extension_filepath]
|
6
|
-
if File::exist?(file)
|
7
|
-
Daengine.log("DigitalAssetExtensionProcessor: Started processing #{file}", "info")
|
8
|
-
json = JSON.parse(File.read(file))
|
9
|
-
json.map {|d| d.symbolize_keys}.each do |doc|
|
10
|
-
da = DigitalAsset.guid_is(doc[:guid]).first
|
11
|
-
if !da.nil?
|
12
|
-
doc.delete(:guid)
|
13
|
-
doc.each_pair do |name, value|
|
14
|
-
da.send("#{name}=", value) if da.respond_to?("#{name}=")
|
15
|
-
end
|
16
|
-
da.save!
|
17
|
-
else
|
18
|
-
Daengine.log("DigitalAssetExtensionProcessor: Skipping guid #{doc[:guid]}", "info")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
Daengine.log("DigitalAssetExtensionProcessor: Finished processing #{file}", "info")
|
22
|
-
else
|
23
|
-
Daengine.log("DigitalAssetExtensionProcessor: File not found #{file}", "info")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Daengine::DigitalAssetExtensionProcessor do
|
4
|
-
before { Daengine.configure(:digital_asset_extension_filepath => Dir.pwd+'/spec/mock_data/merrill_lynch_extension.json'
|
5
|
-
) }
|
6
|
-
context "process_digital_asset_extension_file" do
|
7
|
-
before do
|
8
|
-
asset1 = FactoryGirl.create :digital_asset, :product_ids => ['303','420'],
|
9
|
-
:audiences => ['690'], :sami_code => 'F000000.BAR'
|
10
|
-
doc1 = FactoryGirl.build :document, :content_type => '909',
|
11
|
-
:path => '/1/foo/bar/foobar.doc'
|
12
|
-
doc2 = FactoryGirl.build :document, :path => '/2/foo/bar/foobar.doc'
|
13
|
-
|
14
|
-
asset1.documents << doc1
|
15
|
-
asset1.documents << doc2
|
16
|
-
asset1.save!
|
17
|
-
|
18
|
-
asset2 = FactoryGirl.create :digital_asset, :product_ids => ['420'],
|
19
|
-
:sami_code => 'MEH12345.000', :guid => 'guid-2'
|
20
|
-
doc3 = FactoryGirl.build :document, :content_type => '549',
|
21
|
-
:path => '/1/foo/bar/FINRA-foobar.doc'
|
22
|
-
asset2.documents << doc3
|
23
|
-
asset2.save!
|
24
|
-
end
|
25
|
-
it 'processes all the digital assets found' do
|
26
|
-
Daengine::DigitalAssetExtensionProcessor.process_extension_file
|
27
|
-
DigitalAsset.key_account_in('Merrill Lynch').should have(1).digital_asset
|
28
|
-
DigitalAsset.key_account_in('Merrill Lynch')[0].ml_category.should eq('broker_dealer')
|
29
|
-
DigitalAsset.key_account_in('Merrill Lynch')[0].control_number.should eq('ML 13-005518')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,5 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{ "guid": "guid-1", "ml_category": "investor", "control_number": "ML 13-005517", "key_accounts": ["Merrill Lynch"]},
|
3
|
-
{ "guid": "guid-2", "ml_category": "broker_dealer", "control_number": "ML 13-005518", "key_accounts": ["Merrill Lynch"]},
|
4
|
-
{ "guid": "guid-3", "ml_category": "retirement", "control_number": "ML 13-005519", "key_accounts": ["Merrill Lynch"]}
|
5
|
-
]
|