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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e57c48fcfdfb41e57dce8a6701e12bdc983e2ffb
4
- data.tar.gz: 642b076be90c14a723ef915a57a75e0e3766ff80
3
+ metadata.gz: 1e6b8437a467879bb04148714d14aeca8fceffb5
4
+ data.tar.gz: be661d86cf73891e6560d4e58a68b50413a284e8
5
5
  SHA512:
6
- metadata.gz: 5272b04d59893d8b04cf3fa8217502210abd8b106675143da52f4f8034114e1043258a2ba458f57ac7bbc521846a93d7eea5767fa18d2cb236d43371ba410c6b
7
- data.tar.gz: 536bd11741a32ed79860318ee78344c2903f2a35d4fb05b1ae8c057f2cf597eaf528bb6b544f4cd45cca81dd9c291f3483f360a068e6970540e3ebe36ad6386c
6
+ metadata.gz: 9be087e2ad9c58e95c28b27392e25750ee3213234ec144d944f73da0f4d488e917da89fa8b75cbc85689de04b23aecc2bb10a867a7231a58419b9c9b0925e745
7
+ data.tar.gz: 5ed40ef02890342408d93e48724ae34f70d42d8a823e33d5fe17541d72d9dd5dccd744166e4868c99d288a080f7b28a3bb167e1fced2fb7e26f421f512d92707
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  PROJECT_GEM = 'experian-data-dictionary'
3
- PROJECT_GEM_VERSION = '1.4.1'
3
+ PROJECT_GEM_VERSION = '1.4.2'
4
4
 
5
5
  s.name = PROJECT_GEM
6
6
  s.version = PROJECT_GEM_VERSION
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..3) === method_parts.size and method_parts[0] == 'en'
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.1
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-06-23 00:00:00.000000000 Z
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