csvundle 0.1.3 → 0.1.7

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/csvundle.gemspec CHANGED
@@ -6,12 +6,12 @@ require 'csvundle/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "csvundle"
8
8
  spec.version = CSVundle::VERSION
9
- spec.authors = ["Ybur Yug"]
10
- spec.email = ["bobbygrayson@gmail.com"]
9
+ spec.authors = ["Robert Grayson", "Jonah Ruiz"]
10
+ spec.email = ["bobbygrayson@gmail.com", "jonah@pixelhipsters.com"]
11
11
 
12
12
  spec.summary = %q{To package csvs for access terminal.}
13
13
  spec.description = %q{A WIP gem to package csvs for access terminal.}
14
- spec.homepage = "http://google.com"
14
+ spec.homepage = "https://github.com/accessterminal/CSVundle"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.bindir = "exe"
@@ -1,12 +1,39 @@
1
+ require 'date'
1
2
  require 'csv'
2
3
  require 'yaml'
3
4
 
4
5
  module CSVundle
5
- class GenericCSV
6
- attr_accessor :rows, :columns
6
+ class AccessCSV
7
+ attr_accessor :setup_data, :rows, :columns, :full_csv
8
+ attr_reader :headers, :column_values
7
9
 
8
- def initialize
9
- @rows, @columns = [], []
10
+ def initialize(type)
11
+ @setup_data = YAML.load(ERB.new(File.read("#{GEM_ROOT}/config/csv_setup_data.yml")).result).fetch(type.to_s)
12
+ @rows, @columns, @full_csv = [], [], []
13
+ @headers = @setup_data['headers']
14
+ @columns = @headers.keys
15
+ @column_values = @headers.values
16
+ @normalized_columns = normalized_columns
17
+ @type = type if type_usable? type
18
+ setup_by_type
19
+ end
20
+
21
+ def serve(mapped_data)
22
+ mapped_data.each { |row| @rows << row }
23
+ mapped_data.each { |row| @full_csv << row }
24
+ CSV.generate { |csv| @full_csv.each { |row| csv << row } }
25
+ end
26
+
27
+ def setup_by_type
28
+ full_csv << @setup_data['initial_data'] if @setup_data['initial_data'].any?
29
+ @setup_data['filler_row_count'].times { full_csv << [] }
30
+ @setup_data['filler_row_count'].times { rows << [] }
31
+ full_csv << columns
32
+ end
33
+
34
+ def type_usable?(type)
35
+ [:lienalytics, :grant_street, :lumentum, :mtag, :old_lienalytics,
36
+ :real_auction, :tsr, :tsr_js, :core_logic].include? type.to_sym
10
37
  end
11
38
 
12
39
  def viperize(symbol)
@@ -27,18 +54,4 @@ module CSVundle
27
54
  { "#{column}": @rows.map { |row| row[@columns.index(column)] } }
28
55
  end
29
56
  end
30
-
31
- class AccessCSV < GenericCSV
32
- attr_reader :setup_data
33
- def initialize(type)
34
- @setup_data = YAML.load(File.read("config/csv_setup_data.yml")).fetch(type.to_s)
35
- @columns = @setup_data['headers']
36
- @type = type if type_usable? type
37
- end
38
-
39
- def type_usable?(type)
40
- [:lienalytics, :grant_street, :lumentum, :mtag, :old_lienalytics,
41
- :real_auction, :tsr, :tsr_js].include? type.to_sym
42
- end
43
- end
44
57
  end
@@ -1,3 +1,3 @@
1
1
  module CSVundle
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/csvundle.rb CHANGED
@@ -2,8 +2,5 @@ require 'csvundle/version'
2
2
  require 'csvundle/access_csv'
3
3
 
4
4
  module CSVundle
5
- def self.setup_data_for(type)
6
- setup_data = CSVundle::AccessCSV.new(type.to_sym).setup_data
7
- Hash[setup_data.map{|(k,v)| [k.to_sym,v]}] # convert string keys to symbols
8
- end
5
+ GEM_ROOT = File.expand_path("../..", __FILE__)
9
6
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csvundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
- - Ybur Yug
7
+ - Robert Grayson
8
+ - Jonah Ruiz
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
12
+ date: 2017-06-30 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -69,6 +70,7 @@ dependencies:
69
70
  description: A WIP gem to package csvs for access terminal.
70
71
  email:
71
72
  - bobbygrayson@gmail.com
73
+ - jonah@pixelhipsters.com
72
74
  executables: []
73
75
  extensions: []
74
76
  extra_rdoc_files: []
@@ -85,13 +87,11 @@ files:
85
87
  - bin/console
86
88
  - bin/setup
87
89
  - config/csv_setup_data.yml
88
- - config/headers.yml
89
- - config/lumentum.rb
90
90
  - csvundle.gemspec
91
91
  - lib/csvundle.rb
92
92
  - lib/csvundle/access_csv.rb
93
93
  - lib/csvundle/version.rb
94
- homepage: http://google.com
94
+ homepage: https://github.com/accessterminal/CSVundle
95
95
  licenses: []
96
96
  metadata: {}
97
97
  post_install_message:
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.4.6
113
+ rubygems_version: 2.6.12
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: To package csvs for access terminal.
data/config/headers.yml DELETED
@@ -1,280 +0,0 @@
1
- "lienalytics":
2
- - "lien_ID"
3
- - "row_number"
4
- - "state_name"
5
- - "county_name"
6
- - "full_fips_code"
7
- - "apn"
8
- - "parcel_id"
9
- - "block"
10
- - "lot"
11
- - "qualifier"
12
- - "addl_lots"
13
- - "tax_type"
14
- - "list_item_reference"
15
- - "client_provided_parcel_id"
16
- - "certificate_no"
17
- - "face_value"
18
- - "redemptive_value"
19
- - "principal"
20
- - "tax_year"
21
- - "total_yearly_tax"
22
- - "location_street_address_1"
23
- - "location_street_address_2"
24
- - "location_city_state_zip"
25
- - "location_city"
26
- - "location_zip"
27
- - "longitude"
28
- - "latitude"
29
- - "county_land_use"
30
- - "county_land_use_desc"
31
- - "standardized_land_use"
32
- - "standardized_land_use_desc"
33
- - "county_held"
34
- - "prop_record_year"
35
- - "lien_rollup"
36
- - "location_house_number"
37
- - "location_street_dir_left"
38
- - "location_street_name"
39
- - "location_street_suffix"
40
- - "location_street_dir_right"
41
- - "location_unit_number"
42
- - "legal_status"
43
- - "interest_rate"
44
- - "penalty_rate"
45
- - "penalty_amount"
46
- - "premium_overbid"
47
- - "overbid_interest_rate"
48
- - "original_sale_auction_date"
49
- - "date_purchased_from_issuer"
50
- - "issuer"
51
- - "sub"
52
- - "assessment_year"
53
- - "assessed_land_value"
54
- - "assessed_improvement_value"
55
- - "total_assessed_value"
56
- - "market_value_year"
57
- - "market_land_value"
58
- - "market_improvement_value"
59
- - "total_market_value"
60
- - "lot_frontage"
61
- - "lot_depth"
62
- - "lot_size_unit"
63
- - "zoning"
64
- - "building_class"
65
- - "year_built"
66
- - "no_of_stories"
67
- - "no_of_units"
68
- - "last_sale_date"
69
- - "last_sale_price"
70
- - "last_arms_length_sale_date"
71
- - "last_arms_length_sale_price"
72
- - "prior_arms_length_sale_date"
73
- - "prior_arms_length_sale_price"
74
- - "legal_city"
75
- - "legal_block"
76
- - "legal_lot_number"
77
- - "legal_section"
78
- - "legal_district"
79
- - "legal_unit"
80
- - "legal_subdivision_name"
81
- - "legal_phase_number"
82
- - "legal_tract_number"
83
- - "legal_section_township_range_meridian"
84
- - "legal_assessors_map_ref"
85
- - "legal_brief_desc"
86
- - "current_owner"
87
- - "mailing_care_of"
88
- - "mailing_street_address"
89
- - "mailing_city_state"
90
- - "mailing_zip"
91
- - "owner_occupied"
92
- - "loan1_contract_date"
93
- - "loan1_recording_date"
94
- - "loan1_amount"
95
- - "loan1_due_date"
96
- - "loan1_type"
97
- - "loan2_contract_date"
98
- - "loan2_recording_date"
99
- - "loan2_amount"
100
- - "loan2_due_date"
101
- - "loan2_type"
102
- - "municipality"
103
- - "tags"
104
- - "bids"
105
- - "notes"
106
- - "additional_csv_data"
107
-
108
- lumentum:
109
- - "lien_ID"
110
- - "row_number"
111
- - "state_name"
112
- - "county_name"
113
- - "full_fips_code"
114
- - "apn"
115
- - "parcel_id"
116
- - "block"
117
- - "lot"
118
- - "qualifier"
119
- - "addl_lots"
120
- - "tax_type"
121
- - "list_item_reference"
122
- - "client_provided_parcel_id"
123
- - "certificate_no"
124
- - "face_value"
125
- - "redemptive_value"
126
- - "principal"
127
- - "tax_year"
128
- - "total_yearly_tax"
129
- - "location_street_address_1"
130
- - "location_street_address_2"
131
- - "location_city_state_zip"
132
- - "location_city"
133
- - "location_zip"
134
- - "longitude"
135
- - "latitude"
136
- - "county_land_use"
137
- - "county_land_use_desc"
138
- - "standardized_land_use"
139
- - "standardized_land_use_desc"
140
- - "county_held"
141
- - "prop_record_year"
142
- - "lien_rollup"
143
- - "location_house_number"
144
- - "location_street_dir_left"
145
- - "location_street_name"
146
- - "location_street_suffix"
147
- - "location_street_dir_right"
148
- - "location_unit_number"
149
- - "legal_status"
150
- - "interest_rate"
151
- - "penalty_rate"
152
- - "penalty_amount"
153
- - "premium_overbid"
154
- - "overbid_interest_rate"
155
- - "original_sale_auction_date"
156
- - "date_purchased_from_issuer"
157
- - "issuer"
158
- - "sub"
159
- - "assessment_year"
160
- - "assessed_land_value"
161
- - "assessed_improvement_value"
162
- - "total_assessed_value"
163
- - "market_value_year"
164
- - "market_land_value"
165
- - "market_improvement_value"
166
- - "total_market_value"
167
- - "lot_frontage"
168
- - "lot_depth"
169
- - "lot_size_unit"
170
- - "zoning"
171
- - "building_class"
172
- - "year_built"
173
- - "no_of_stories"
174
- - "no_of_units"
175
- - "last_sale_date"
176
- - "last_sale_price"
177
- - "last_arms_length_sale_date"
178
- - "last_arms_length_sale_price"
179
- - "prior_arms_length_sale_date"
180
- - "prior_arms_length_sale_price"
181
- - "legal_city"
182
- - "legal_block"
183
- - "legal_lot_number"
184
- - "legal_section"
185
- - "legal_district"
186
- - "legal_unit"
187
- - "legal_subdivision_name"
188
- - "legal_phase_number"
189
- - "legal_tract_number"
190
- - "legal_section_township_range_meridian"
191
- - "legal_assessors_map_ref"
192
- - "legal_brief_desc"
193
- - "current_owner"
194
- - "mailing_care_of"
195
- - "mailing_street_address"
196
- - "mailing_city_state"
197
- - "mailing_zip"
198
- - "owner_occupied"
199
- - "loan1_contract_date"
200
- - "loan1_recording_date"
201
- - "loan1_amount"
202
- - "loan1_due_date"
203
- - "loan1_type"
204
- - "loan2_contract_date"
205
- - "loan2_recording_date"
206
- - "loan2_amount"
207
- - "loan2_due_date"
208
- - "loan2_type"
209
- - "municipality"
210
- - "tags"
211
- - "bids"
212
- - "notes"
213
- - "additional_csv_data"
214
-
215
- lumentum:
216
- - "CountyName"
217
- - "BatchNumber"
218
- - "AdvNumber"
219
- - "CertificateNumber"
220
- - "NALFormat"
221
- - "ALTKEYFormat"
222
- - "PropertyAppraiserFormat"
223
- - "TaxCollectorFormat"
224
- - "ExtraFormat"
225
- - "AuctionFormat"
226
- - "NewParcel"
227
- - "ReParceled"
228
- - "CertYear"
229
- - "TaxYear"
230
- - "FaceAmt"
231
- - "MktValue"
232
- - "LandValue"
233
- - "StructureValue"
234
- - "ZoningCode"
235
- - "DigipanZoning"
236
- - "ZoningUseCode"
237
- - "HX"
238
- - "PropertySize"
239
- - "SfStructure"
240
- - "YearBuilt"
241
- - "ImprovedQuality"
242
- - "ConstructionClass"
243
- - "NumberOfBuildings"
244
- - "NumberOfResUnits"
245
- - "MultiSale"
246
- - "SalesHistoryAmount"
247
- - "SalesHistoryYear"
248
- - "SuperiorLien"
249
- - "LisPendens"
250
- - "Environmental"
251
- - "CDDName"
252
- - "BondStatus"
253
- - "TotalBondAmount"
254
- - "LastDateUpdated"
255
- - "LenderName"
256
- - "LenderAmount"
257
- - "LenderType"
258
- - "LoanType"
259
- - "LoanRecordingDate"
260
- - "LoanDueDate"
261
- - "Owner"
262
- - "OwnerType"
263
- - "OwnerChange"
264
- - "PropertyAddress"
265
- - "PropertyCity"
266
- - "PropertyState"
267
- - "PropertyZip"
268
- - "MailingAddress"
269
- - "MailingCity"
270
- - "MailState"
271
- - "MailingZip"
272
- - "LegalAddress"
273
- - "BackTaxLastUpdated"
274
- - "CertHolderType"
275
- - "TaxDeedHistory"
276
- - "BackTaxOpenCount"
277
- - "BackTaxClosedCount"
278
- - "RollupFaceAmount"
279
- - "Rollupinterest"
280
- - "RollupTotal"
data/config/lumentum.rb DELETED
@@ -1 +0,0 @@
1
-