Module: Experian
- Includes:
- Constants
- Defined in:
- lib/experian.rb,
lib/experian/error.rb,
lib/experian/client.rb,
lib/experian/request.rb,
lib/experian/version.rb,
lib/experian/response.rb,
lib/experian/constants.rb,
lib/experian/connect_check.rb,
lib/experian/connect_check/client.rb,
lib/experian/connect_check/request.rb,
lib/experian/connect_check/response.rb
Defined Under Namespace
Modules: ConnectCheck, Constants Classes: ArgumentError, Client, ClientError, Error, Forbidden, Request, Response, ServerError
Constant Summary collapse
- VERSION =
"0.1.2"
Constants included from Constants
Constants::ARF_VERSION, Constants::COMPLETION_CODES, Constants::ECALS_TIMEOUT, Constants::ERROR_ACTION_INDICATORS, Constants::LOOKUP_SERVICE_NAME, Constants::LOOKUP_SERVICE_VERSION, Constants::LOOKUP_SERVLET_URL, Constants::SERVICE_NAME, Constants::SERVICE_NAME_TEST, Constants::SERVICE_VERSION, Constants::XML_NAMESPACE, Constants::XML_REQUEST_NAMESPACE, Constants::XML_SCHEMA_INSTANCE, Constants::XML_SCHEMA_LOCATION
Class Attribute Summary collapse
-
.eai ⇒ Object
Returns the value of attribute eai.
-
.op_initials ⇒ Object
Returns the value of attribute op_initials.
-
.password ⇒ Object
Returns the value of attribute password.
-
.preamble ⇒ Object
Returns the value of attribute preamble.
-
.subcode ⇒ Object
Returns the value of attribute subcode.
-
.test_mode ⇒ Object
Returns the value of attribute test_mode.
-
.user ⇒ Object
Returns the value of attribute user.
-
.vendor_number ⇒ Object
Returns the value of attribute vendor_number.
Class Method Summary collapse
- .assert_experian_domain ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .ecals_lookup_required? ⇒ Boolean
- .ecals_uri ⇒ Object
- .net_connect_uri ⇒ Object
- .perform_ecals_lookup ⇒ Object
- .service_name ⇒ Object
- .test_mode? ⇒ Boolean
Class Attribute Details
.eai ⇒ Object
Returns the value of attribute eai.
16 17 18 |
# File 'lib/experian.rb', line 16 def eai @eai end |
.op_initials ⇒ Object
Returns the value of attribute op_initials.
16 17 18 |
# File 'lib/experian.rb', line 16 def op_initials @op_initials end |
.password ⇒ Object
Returns the value of attribute password.
16 17 18 |
# File 'lib/experian.rb', line 16 def password @password end |
.preamble ⇒ Object
Returns the value of attribute preamble.
16 17 18 |
# File 'lib/experian.rb', line 16 def preamble @preamble end |
.subcode ⇒ Object
Returns the value of attribute subcode.
16 17 18 |
# File 'lib/experian.rb', line 16 def subcode @subcode end |
.test_mode ⇒ Object
Returns the value of attribute test_mode.
17 18 19 |
# File 'lib/experian.rb', line 17 def test_mode @test_mode end |
.user ⇒ Object
Returns the value of attribute user.
16 17 18 |
# File 'lib/experian.rb', line 16 def user @user end |
.vendor_number ⇒ Object
Returns the value of attribute vendor_number.
16 17 18 |
# File 'lib/experian.rb', line 16 def vendor_number @vendor_number end |
Class Method Details
.assert_experian_domain ⇒ Object
61 62 63 64 65 66 |
# File 'lib/experian.rb', line 61 def assert_experian_domain unless @net_connect_uri.host.end_with?('.experian.com') @net_connect_uri = nil raise Experian::ClientError, "Could not authenticate connection to Experian, unexpected host name." end end |
.configure {|_self| ... } ⇒ Object
19 20 21 |
# File 'lib/experian.rb', line 19 def configure yield self end |
.ecals_lookup_required? ⇒ Boolean
57 58 59 |
# File 'lib/experian.rb', line 57 def ecals_lookup_required? @net_connect_uri.nil? || @ecals_last_update.nil? || Time.now - @ecals_last_update > Experian::ECALS_TIMEOUT end |
.ecals_uri ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/experian.rb', line 27 def ecals_uri uri = URI(Experian::LOOKUP_SERVLET_URL) uri.query = URI.encode_www_form( 'lookupServiceName' => Experian::LOOKUP_SERVICE_NAME, 'lookupServiceVersion' => Experian::LOOKUP_SERVICE_VERSION, 'serviceName' => service_name, 'serviceVersion' => Experian::SERVICE_VERSION, 'responseType' => 'text/plain' ) uri end |
.net_connect_uri ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/experian.rb', line 39 def net_connect_uri perform_ecals_lookup if ecals_lookup_required? # setup basic authentication @net_connect_uri.user = Experian.user @net_connect_uri.password = Experian.password @net_connect_uri end |
.perform_ecals_lookup ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/experian.rb', line 49 def perform_ecals_lookup @net_connect_uri = URI.parse(Excon.get(ecals_uri.to_s).body) assert_experian_domain @ecals_last_update = Time.now rescue Excon::Errors::SocketError => e raise Experian::ClientError, "Could not connect to Experian: #{e.}" end |
.service_name ⇒ Object
68 69 70 |
# File 'lib/experian.rb', line 68 def service_name test_mode? ? Experian::SERVICE_NAME_TEST : Experian::SERVICE_NAME end |
.test_mode? ⇒ Boolean
23 24 25 |
# File 'lib/experian.rb', line 23 def test_mode? !!test_mode end |