experian 0.1.0

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.
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ describe Experian do
4
+
5
+ before do
6
+ stub_experian_uri_lookup
7
+ end
8
+
9
+ it "should refresh the ECALS url every 24 hours" do
10
+ Experian.perform_ecals_lookup
11
+ refute Experian.ecals_lookup_required?
12
+
13
+ Timecop.travel(Time.now + 86500)
14
+ assert Experian.ecals_lookup_required?
15
+
16
+ Timecop.return
17
+ end
18
+
19
+ end
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <NetConnectRequest xmlns="http://www.experian.com/NetConnect" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.experian.com/NetConnect NetConnect.xsd">
3
+ <EAI>X42PB93F</EAI>
4
+ <DBHost>STAR</DBHost>
5
+ <ReferenceId>fakeReferenceId</ReferenceId>
6
+ <Request xmlns="http://www.experian.com/WebDelivery" version="1.0">
7
+ <Products>
8
+ <ConnectCheck>
9
+ <Subscriber>
10
+ <Preamble>FCD2</Preamble>
11
+ <OpInitials>AB</OpInitials>
12
+ <SubCode>1968543</SubCode>
13
+ </Subscriber>
14
+ <PrimaryApplicant>
15
+ <Name>
16
+ <Surname>Simpson</Surname>
17
+ <First>Homer</First>
18
+ </Name>
19
+ <SSN>123456789</SSN>
20
+ <CurrentAddress>
21
+ <Street>10655 NorthBirch Street</Street>
22
+ <City>Springfield</City>
23
+ <State>IL</State>
24
+ <Zip>60611</Zip>
25
+ </CurrentAddress>
26
+ <YOB>1951</YOB>
27
+ </PrimaryApplicant>
28
+ <OutputType>
29
+ <ARF>
30
+ <ARFVersion>06</ARFVersion>
31
+ </ARF>
32
+ </OutputType>
33
+ <Vendor>
34
+ <VendorNumber>P55</VendorNumber>
35
+ </Vendor>
36
+ <Options>
37
+ <ReferenceNumber>00234</ReferenceNumber>
38
+ <EndUser>homer</EndUser>
39
+ </Options>
40
+ </ConnectCheck>
41
+ </Products>
42
+ </Request>
43
+ </NetConnectRequest>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <NetConnectResponse xmlns="http://www.experian.com/NetConnectResponse">
3
+ <CompletionCode>0000</CompletionCode>
4
+ <TransactionId>8276972</TransactionId>
5
+ <HostResponse><![CDATA[1100028100813165523TNJ10600@1110104SC 3XY YXXXXXXX12AMBLE,ROBERT64Fraud alert on account. Deposit required to complete enrollment.@12500220603PRTBPPCTQQ@3220018 666153036@335006212ROBERT AMBLE1955A124ANNA E61212261955@335002814ROBERT K AMBLE @335002511KELLY AMBLE @335003218ROBERT KELLY AMBLE @3360074031308131003276502S 376717 11TH AVE /BROOKLYN NY 112195904@3360074050206131001858455S 37101 VILLAGE DR /JERICHO NY 117532260@3360074080703121003600637S 3725 MAIN PKWY /PLAINVIEW NY 118032127@3360076060203031131270246M 392625 PARK AVE /BRIDGEPORT CT 066041397@3360074050906096001971762S 3735 MAIN PKWY /PLAINVIEW NY 118032127@3360080010703076002990543S 43125 CAPTAINS DR /WEST BABYLON NY 117048201@3360072110411041003980220S 3519 SCOTT AVE /JERICHO NY 117532515@3360074109402991001548357P 37PO BOX 2473 /KINGSTON NY 124022473@361009057780335 Q Q0NUMBER OF INQUIRIES WAS ALSO A FACTOR, BUT EFFECT WAS NOT SIGNIFICANT@36100207708ID MATCH@36100485236ACCOUNTS CLOSED BY CONSUMER 08 TIMES@365034106051310032106& 05-13-10 0000000 FRAUDULENT APPLICATIONS MAY BE SUBMITTED IN MY NAME USING CORRECT PERSONAL INFORMATION. DO NOT EXTEND CREDIT WITHOUT FIRST CONTACTING ME PERSONALLY AND VERIFYING ALL APPLICANT INFORMATION AT DAY 555-555-5555 OR EVENING ____________. THIS VICTIM STATEMENT WILL BE MAINTAINED FOR 7 YEARS FROM 08/29/02.@382019104M0000000120CKPT: COMMERCIAL BUSINESS ADDRESS ON FACS+ FILE/COMMERCIAL BUSINESS ADDRESS/6717 11TH AVE/BROOKLYN NY 11219/718.331.3900C2260701130000007011300000C31219531955C4121217 @950001602201623@]]></HostResponse>
6
+ </NetConnectResponse>
7
+
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <NetConnectResponse xmlns="http://www.experian.com/NetConnectResponse">
3
+ <CompletionCode>1000</CompletionCode>
4
+ <TransactionId>8276385</TransactionId>
5
+ <ErrorMessage>Invalid request format</ErrorMessage>
6
+ <ErrorTag>NetConnectRequest/Request/Products/ConnectCheck/PrimaryApplicant/ConnectCheck_PrimaryApplicantTypeChoice/null</ErrorTag>
7
+ </NetConnectResponse>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <NetConnectResponse>
3
+ <CompletionCode>0000</CompletionCode>
4
+ <ReferenceId>userabc001</ReferenceId>
5
+ <HostResponse><![CDATA[1000430C031204152039XBCOAW0700200013045CEFE900024003000000000000000]]></HostResponse>
6
+ </NetConnectResponse>
7
+
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ describe Experian::Request do
4
+
5
+ it "should build an xml NetConnect request container" do
6
+ request = Experian::Request.new
7
+ assert_match /<NetConnectRequest.*>\s<\/NetConnectRequest>/, request.xml
8
+ end
9
+
10
+ end
@@ -0,0 +1,40 @@
1
+ require 'test_helper'
2
+
3
+ describe Experian::Response do
4
+
5
+ before do
6
+ @response = Experian::Response.new(fixture("connect_check", "response.xml"))
7
+ end
8
+
9
+ it "should raise a ClientError if response contains invalid xml" do
10
+ assert_raises(Experian::ClientError) do
11
+ response = Experian::Response.new("malformed xml")
12
+ end
13
+ end
14
+
15
+ it "extracts the host response" do
16
+ refute_nil @response.host_response
17
+ end
18
+
19
+ it "extracts the error message" do
20
+ response = Experian::Response.new(fixture("connect_check", "response_error.xml"))
21
+ assert_equal "Invalid request format", response.error_message
22
+ end
23
+
24
+ it "extracts the completion code" do
25
+ assert_equal "0000", @response.completion_code
26
+ end
27
+
28
+ it "extracts the transaction id" do
29
+ assert_equal "8276972", @response.transaction_id
30
+ end
31
+
32
+ it "parses out defined segments into array" do
33
+ assert_equal 22, @response.segments.count
34
+ end
35
+
36
+ it "returns a specific segment" do
37
+ assert_equal "12500220603PRTBPPCTQQ", @response.segment(125)
38
+ end
39
+
40
+ end
@@ -0,0 +1,35 @@
1
+ require 'experian'
2
+ require 'minitest/autorun'
3
+ require 'minitest/pride'
4
+ require 'webmock/minitest'
5
+ require 'mocha/setup'
6
+ require 'timecop'
7
+
8
+ def fixture_path
9
+ File.expand_path("../fixtures", __FILE__)
10
+ end
11
+
12
+ def fixture(product, file)
13
+ File.read("#{fixture_path}/#{product}/#{file}")
14
+ end
15
+
16
+ def stub_experian_uri_lookup
17
+ Experian.user, Experian.password = 'user', 'password'
18
+ stub_request(:get, Experian.ecals_uri.to_s).to_return(body: "http://fake.experian.com", status: 200)
19
+ end
20
+
21
+ def stub_experian_request(product, file)
22
+ stub_experian_uri_lookup
23
+ stub_request(:post, "http://user:password@fake.experian.com").to_return(body: fixture(product, file), status: 200)
24
+ end
25
+
26
+ Experian.configure do |config|
27
+ config.eai = "X42PB93F"
28
+ config.preamble = "FCD2"
29
+ config.op_initials = "AB"
30
+ config.subcode = "1968543"
31
+ config.user = "user"
32
+ config.password = "password"
33
+ config.vendor_number = "P55"
34
+ config.test_mode = true
35
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: experian
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Hutzelman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: excon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: builder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ description: Ruby gem wrapper for the Experian net connect API.
56
+ email:
57
+ - ehutzelman@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - experian.gemspec
68
+ - lib/experian.rb
69
+ - lib/experian/client.rb
70
+ - lib/experian/connect_check.rb
71
+ - lib/experian/connect_check/client.rb
72
+ - lib/experian/connect_check/request.rb
73
+ - lib/experian/connect_check/response.rb
74
+ - lib/experian/constants.rb
75
+ - lib/experian/error.rb
76
+ - lib/experian/request.rb
77
+ - lib/experian/response.rb
78
+ - lib/experian/version.rb
79
+ - test/client_test.rb
80
+ - test/connect_check/client_test.rb
81
+ - test/connect_check/request_test.rb
82
+ - test/connect_check/response_test.rb
83
+ - test/experian_test.rb
84
+ - test/fixtures/connect_check/request.xml
85
+ - test/fixtures/connect_check/response.xml
86
+ - test/fixtures/connect_check/response_error.xml
87
+ - test/fixtures/connect_check/response_error_legacy.xml
88
+ - test/request_test.rb
89
+ - test/response_test.rb
90
+ - test/test_helper.rb
91
+ homepage: http://github.com/ehutzelman/experian
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.1.5
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Ruby gem wrapper for the Experian net connect API.
115
+ test_files:
116
+ - test/client_test.rb
117
+ - test/connect_check/client_test.rb
118
+ - test/connect_check/request_test.rb
119
+ - test/connect_check/response_test.rb
120
+ - test/experian_test.rb
121
+ - test/fixtures/connect_check/request.xml
122
+ - test/fixtures/connect_check/response.xml
123
+ - test/fixtures/connect_check/response_error.xml
124
+ - test/fixtures/connect_check/response_error_legacy.xml
125
+ - test/request_test.rb
126
+ - test/response_test.rb
127
+ - test/test_helper.rb