deltavista_crif_dva_interface 1.0.2 → 1.0.3

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.
@@ -2,9 +2,11 @@ require 'nokogiri'
2
2
 
3
3
  module DeltavistaCrifDvaInterface
4
4
  class DeltaVistaService < RestfulService
5
+ attr_reader :url, :logger, :config
5
6
 
6
7
  def initialize(config)
7
8
  @url = config.deltavista_service_url
9
+ @logger = config.logger || Logger.new(STDOUT)
8
10
  @config = config
9
11
  end
10
12
 
@@ -41,7 +43,7 @@ module DeltavistaCrifDvaInterface
41
43
  @parser = CreditCheckShortV02.new @config
42
44
  request_body = @parser.to_xml(address)
43
45
  headers = {'Content-Type' => 'text/xml'}
44
- post_http_request(@url, request_body, headers) do |data|
46
+ post_http_request(url, request_body, headers) do |data|
45
47
  extract_response data
46
48
  end
47
49
  end
@@ -57,8 +59,10 @@ module DeltavistaCrifDvaInterface
57
59
  def verify_address(address)
58
60
  @parser = AddressUpdate.new @config
59
61
  request_body = @parser.to_xml(address)
62
+ logger.debug request_body.inspect
60
63
  headers = {'Content-Type' => 'text/xml'}
61
- post_http_request(@url, request_body, headers) do |data|
64
+ post_http_request(url, request_body, headers) do |data|
65
+ logger.debug data.inspect
62
66
  extract_response data
63
67
  end
64
68
  end
@@ -76,7 +80,7 @@ module DeltavistaCrifDvaInterface
76
80
  @parser = CollectionCheck.new @config
77
81
  request_body = @parser.to_xml(address, collection)
78
82
  headers = {'Content-Type' => 'text/xml'}
79
- post_http_request(@url, request_body, headers) do |data|
83
+ post_http_request(url, request_body, headers) do |data|
80
84
  extract_response data
81
85
  end
82
86
  end
@@ -26,10 +26,16 @@ module DeltavistaCrifDvaInterface
26
26
  yield resp.body
27
27
  end
28
28
 
29
+ # Generates URI depending on URI string
30
+ # @param url_string [String] URI string
31
+ # @return [URI] URI object
29
32
  def to_url(url_string)
30
33
  URI.parse(url_string)
31
34
  end
32
35
 
36
+ # Generates new HTTP request
37
+ # @param url [URI] request URI
38
+ # @return [Net::HTTP] HTTP request
33
39
  def create_http_request(url)
34
40
  http = Net::HTTP.new(url.host, url.port)
35
41
  if url.scheme == 'https'
@@ -1,3 +1,3 @@
1
1
  module DeltavistaCrifDvaInterface
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'i18n'
2
2
  require 'country_iso_translater'
3
+ require 'logger'
3
4
 
4
5
  require 'deltavista_crif_dva_interface/version'
5
6
  require 'deltavista_crif_dva_interface/config'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltavista_crif_dva_interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-11-20 00:00:00.000000000 Z
14
+ date: 2014-12-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec