experian-data-dictionary 1.4.1 → 1.4.2
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/.rspec +2 -0
- data/experian_data_dictionary.gemspec +1 -1
- data/lib/experian.rb +9 -7
- data/spec/functional/en_0717_spec.rb +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e6b8437a467879bb04148714d14aeca8fceffb5
|
4
|
+
data.tar.gz: be661d86cf73891e6560d4e58a68b50413a284e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9be087e2ad9c58e95c28b27392e25750ee3213234ec144d944f73da0f4d488e917da89fa8b75cbc85689de04b23aecc2bb10a867a7231a58419b9c9b0925e745
|
7
|
+
data.tar.gz: 5ed40ef02890342408d93e48724ae34f70d42d8a823e33d5fe17541d72d9dd5dccd744166e4868c99d288a080f7b28a3bb167e1fced2fb7e26f421f512d92707
|
data/.rspec
ADDED
data/lib/experian.rb
CHANGED
@@ -2,9 +2,7 @@ EXPERIAN_LIB_DIR = File.dirname(__FILE__)
|
|
2
2
|
Dir["#{EXPERIAN_LIB_DIR}/element_numbers/*.rb"].each { |f| require(f) }
|
3
3
|
|
4
4
|
module Experian
|
5
|
-
|
6
5
|
class DataDictionary
|
7
|
-
|
8
6
|
def self.lookup(column, key)
|
9
7
|
column = column.to_s.downcase.gsub(/\s+/, '')
|
10
8
|
key = key.to_s.strip
|
@@ -28,16 +26,22 @@ module Experian
|
|
28
26
|
|
29
27
|
def self.method_missing(method, *args, &block)
|
30
28
|
method_parts = method.to_s.split('_')
|
31
|
-
if (2..
|
29
|
+
if (2..4) === method_parts.size and method_parts[0] == 'en'
|
32
30
|
column = method_parts[1]
|
33
31
|
if /^[0-9]{1,3}$/ =~ column
|
32
|
+
letters = ''
|
34
33
|
column = "%04d" % column
|
35
|
-
new_method = method_parts.size == 3 ? "en_#{column}_description".to_sym : "en_#{column}".to_sym
|
34
|
+
#new_method = method_parts.size == 3 ? "en_#{column}_description".to_sym : "en_#{column}".to_sym
|
36
35
|
elsif /[a-z]$/ =~ column
|
37
36
|
letters = column.match(/[a-z]+$/)[0]
|
38
37
|
column = "%04d" % column.to_i
|
39
|
-
new_method = method_parts.size == 3 ? "en_#{column}#{letters}_description".to_sym : "en_#{column}#{letters}".to_sym
|
38
|
+
#new_method = method_parts.size == 3 ? "en_#{column}#{letters}_description".to_sym : "en_#{column}#{letters}".to_sym
|
40
39
|
end
|
40
|
+
|
41
|
+
method_parts.shift(2)
|
42
|
+
method_sufix = method_parts.join('_')
|
43
|
+
new_method = method_sufix.size > 0 ? "en_#{column}#{letters}_#{method_sufix}".to_sym : "en_#{column}#{letters}".to_sym
|
44
|
+
|
41
45
|
if self.methods.include?(new_method)
|
42
46
|
return self.send(new_method, *args, &block)
|
43
47
|
else
|
@@ -47,7 +51,5 @@ module Experian
|
|
47
51
|
super(method, *args, &block)
|
48
52
|
end
|
49
53
|
end
|
50
|
-
|
51
54
|
end
|
52
|
-
|
53
55
|
end
|
@@ -3,6 +3,9 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
|
|
3
3
|
describe 'Experian::DataDictionary 0717' do
|
4
4
|
|
5
5
|
context 'valid lookup' do
|
6
|
+
it { expect( Experian::DataDictionary.column_name('0717') ).to eq('Estimated Current Mortgage Amount Ranges') }
|
7
|
+
it { expect( Experian::DataDictionary.column_name('717') ).to eq('Estimated Current Mortgage Amount Ranges') }
|
8
|
+
|
6
9
|
it { expect( Experian::DataDictionary.lookup('0717','1A') ).to eq('1,000 - 9,999 - Extremely Likely') }
|
7
10
|
it { expect( Experian::DataDictionary.lookup('0717','3P') ).to eq('1,000,000 - + - Likely') }
|
8
11
|
it { expect( Experian::DataDictionary.lookup('0717','3F') ).to eq('80,000 - 99,999 - Likely') }
|
@@ -10,12 +13,10 @@ describe 'Experian::DataDictionary 0717' do
|
|
10
13
|
it { expect( Experian::DataDictionary.lookup('0717',' ') ).to eq('Unknown') }
|
11
14
|
end
|
12
15
|
|
13
|
-
|
14
16
|
context 'invalid lookup' do
|
15
17
|
it { expect( Experian::DataDictionary.lookup('0717','A') ).to eq('Unknown') }
|
16
18
|
it { expect( Experian::DataDictionary.lookup('0717','1') ).to eq('Unknown') }
|
17
19
|
it { expect( Experian::DataDictionary.lookup('0717','F') ).to eq('Unknown') }
|
18
20
|
it { expect( Experian::DataDictionary.lookup('0717','0') ).to eq('Unknown') }
|
19
21
|
end
|
20
|
-
|
21
|
-
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: experian-data-dictionary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem/plugin to interact with the Experian.com Data Dictionary. Checkout
|
14
14
|
the project on github for more detail.
|
@@ -20,6 +20,7 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- ".gitignore"
|
22
22
|
- ".pryrc"
|
23
|
+
- ".rspec"
|
23
24
|
- ".ruby-gemset"
|
24
25
|
- ".ruby-version"
|
25
26
|
- Gemfile
|