daengine 0.3.7.3 → 0.3.7.4
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.
data/app/models/digital_asset.rb
CHANGED
@@ -4,14 +4,6 @@ class DigitalAsset
|
|
4
4
|
include Mongoid::Document
|
5
5
|
include Mongoid::Timestamps
|
6
6
|
|
7
|
-
PROSPECTUS = '542'
|
8
|
-
FACTSHEET = '533'
|
9
|
-
COMMENTARY = '532'
|
10
|
-
ANNUAL_REPORT = '529'
|
11
|
-
SEMIANNUAL_REPORT = '541'
|
12
|
-
SAI = '540'
|
13
|
-
SUMMARY_PROSPECTUS = '5380'
|
14
|
-
OTHER = ''
|
15
7
|
|
16
8
|
field :title, type: String
|
17
9
|
field :changed_at, type: Time
|
@@ -53,7 +45,7 @@ class DigitalAsset
|
|
53
45
|
scope :stale, -> {where(:updated_at.lte => 2.minutes.ago)}
|
54
46
|
scope :orderable_is, ->(orderable) {where(:orderable => orderable)}
|
55
47
|
scope :orderable, -> {where(orderable: true)}
|
56
|
-
scope :has_finra, -> {where(:'documents.content_type' =>
|
48
|
+
scope :has_finra, -> {where(:'documents.content_type' => ContentType::FINRA)}
|
57
49
|
scope :audience_in, ->(audience) {where(:audiences.in => audience)}
|
58
50
|
scope :alphabetical, order_by(:title => :asc)
|
59
51
|
# scope :order_by_fund, order_by[[:product_ids, :asc]]
|
@@ -93,27 +85,16 @@ class DigitalAsset
|
|
93
85
|
end
|
94
86
|
|
95
87
|
def finra_document
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
def asset_type
|
101
|
-
docs = documents.select { |d| d.content_type == PROSPECTUS ||
|
102
|
-
d.content_type == SAI ||
|
103
|
-
d.content_type == COMMENTARY ||
|
104
|
-
d.content_type == SEMIANNUAL_REPORT ||
|
105
|
-
d.content_type == ANNUAL_REPORT ||
|
106
|
-
d.content_type == FACTSHEET ||
|
107
|
-
d.content_type == SUMMARY_PROSPECTUS}
|
108
|
-
docs.size == 1 ? docs[0].content_type : OTHER
|
88
|
+
finra_idx = documents.index {|d| d.content_type == ContentType::FINRA}
|
89
|
+
documents[finra_idx] if finra_idx
|
109
90
|
end
|
110
91
|
|
111
92
|
def is_investor_approved?
|
112
|
-
audiences.index(
|
93
|
+
audiences.index(:audience_investor)
|
113
94
|
end
|
114
95
|
|
115
96
|
def is_institutional_use?
|
116
|
-
audiences.index(
|
97
|
+
audiences.index(:audience_advisor)
|
117
98
|
end
|
118
99
|
|
119
100
|
def product
|
@@ -126,9 +107,12 @@ class DigitalAsset
|
|
126
107
|
TaxonomyTerm.label_for_term(content_organization_ids[0])
|
127
108
|
end
|
128
109
|
def content_type
|
129
|
-
|
130
|
-
|
110
|
+
TaxonomyTerm.label_for_term(content_type_id)
|
111
|
+
end
|
112
|
+
def content_type_id
|
113
|
+
first_non_finra.try(:content_type)
|
131
114
|
end
|
115
|
+
|
132
116
|
def pages; first_non_finra.pages end
|
133
117
|
|
134
118
|
def audience
|
@@ -145,7 +129,7 @@ class DigitalAsset
|
|
145
129
|
|
146
130
|
private
|
147
131
|
|
148
|
-
def first_non_finra; documents.detect{|d| d.content_type !=
|
132
|
+
def first_non_finra; documents.detect{|d| d.content_type != ContentType::FINRA} end
|
149
133
|
|
150
134
|
|
151
135
|
end
|
@@ -170,3 +154,19 @@ class DigitalAsset::Document
|
|
170
154
|
validates_format_of :path, without: /\/manifest|archives\// # dont accept manifest files
|
171
155
|
|
172
156
|
end
|
157
|
+
|
158
|
+
class DigitalAsset::ContentType
|
159
|
+
FINRA = '549'
|
160
|
+
PROSPECTUS = '542'
|
161
|
+
FACTSHEET = '533'
|
162
|
+
COMMENTARY = '532'
|
163
|
+
FUND_YIELD = '538'
|
164
|
+
ANNUAL_REPORT = '529'
|
165
|
+
SEMIANNUAL_REPORT = '541'
|
166
|
+
SAI = '540'
|
167
|
+
SUMMARY_PROSPECTUS = '5380'
|
168
|
+
DAILY_HOLDINGS = 'MA53THCZQ'
|
169
|
+
MONTHLY_HOLDINGS = 'MA53Y14FY'
|
170
|
+
BUSINESS_CALENDAR = 'MA540I7SX'
|
171
|
+
WEEKLY_HOLDINGS = 'MA542HDIJ'
|
172
|
+
end
|
data/app/models/taxonomy_term.rb
CHANGED
@@ -138,7 +138,7 @@ module Daengine::TeamsiteMetadataParser
|
|
138
138
|
if(File.mtime(file) > last_read)
|
139
139
|
begin
|
140
140
|
exifdata = ::MiniExiftool.new(file) # spaces in filename
|
141
|
-
doc['pages'] = exifdata.pagecount # or exifdata['Slides']
|
141
|
+
doc['pages'] = exifdata.pagecount || exifdata.pages || exifdata.slides # or exifdata['Slides']
|
142
142
|
doc['size'] = exifdata.filesize
|
143
143
|
doc['mime_type'] = exifdata.mimetype
|
144
144
|
Daengine.log "Exif data for #{file} was pages:#{doc['pages']}, size:#{doc['size']}", "info"
|
data/lib/daengine/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: daengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.7.
|
5
|
+
version: 0.3.7.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- sbhatia
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-14 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|