Class: DeltavistaCrifDvaInterface::DeltaVistaService
- Inherits:
-
RestfulService
- Object
- RestfulService
- DeltavistaCrifDvaInterface::DeltaVistaService
- Defined in:
- lib/deltavista_crif_dva_interface/delta_vista_service.rb
Class Method Summary collapse
-
.genders(language = 'de') ⇒ Array
All available genders for deltavista check.
-
.legal_forms(language = 'de') ⇒ Array
All available legal forms for deltavista check.
Instance Method Summary collapse
-
#collection_check(address, collection) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface.
-
#credit_check(address) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface.
-
#extract_response(xml_body) ⇒ Struct
XML Body converted to hash.
-
#initialize(config) ⇒ DeltaVistaService
constructor
A new instance of DeltaVistaService.
-
#verify_address(address) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface.
Methods inherited from RestfulService
#check_response!, #create_http_request, #get_http_response, #post_http_request, #put_http_request, #to_url, #valid_response?
Constructor Details
#initialize(config) ⇒ DeltaVistaService
Returns a new instance of DeltaVistaService.
6 7 8 9 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 6 def initialize(config) @url = config.deltavista_service_url @config = config end |
Class Method Details
.genders(language = 'de') ⇒ Array
Returns all available genders for deltavista check.
31 32 33 34 35 36 37 38 39 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 31 def self.genders(language = 'de') if language == 'de' [ ['Unbekannt', 0], ['Männlich', 1], ['Weiblich', 2] ] end end |
.legal_forms(language = 'de') ⇒ Array
Returns all available legal forms for deltavista check.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 13 def self.legal_forms(language = 'de') if language == 'de' [ ['AG', 2], ['GmbH', 3], ['Genossenschaft', 4], ['Kommanditgesellschaft', 5], ['Kollektivgesellschaft', 6], ['Einzelfirma', 7], ['Verein', 8], ['Einfache Gesellschaft', 9], ['Andere', 99] ] end end |
Instance Method Details
#collection_check(address, collection) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface. The XML-Response will be converted back into an address object and returned. If no address is available the method returns nil.
If the Service is not available a StandardError will be thrown.
83 84 85 86 87 88 89 90 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 83 def collection_check(address, collection) @parser = CollectionCheck.new @config request_body = @parser.to_xml(address, collection) headers = {'Content-Type' => 'text/xml'} post_http_request(@url, request_body, headers) do |data| extract_response data end end |
#credit_check(address) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface. The XML-Response will be converted back into an address object and returned. If no address is available the method returns nil.
If the Service is not available a StandardError will be thrown.
48 49 50 51 52 53 54 55 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 48 def credit_check(address) @parser = CreditCheckShortV02.new @config request_body = @parser.to_xml(address) headers = {'Content-Type' => 'text/xml'} post_http_request(@url, request_body, headers) do |data| extract_response data end end |
#extract_response(xml_body) ⇒ Struct
Returns XML Body converted to hash.
94 95 96 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 94 def extract_response(xml_body) @parser.to_hash(xml_body) end |
#verify_address(address) ⇒ Struct
Takes an address object and sends it as XML to the DeltaVista-Interface. The XML-Response will be converted back into an address object and returned. If no address is available the method returns nil.
If the Service is not available a StandardError will be thrown.
65 66 67 68 69 70 71 72 |
# File 'lib/deltavista_crif_dva_interface/delta_vista_service.rb', line 65 def verify_address(address) @parser = AddressUpdate.new @config request_body = @parser.to_xml(address) headers = {'Content-Type' => 'text/xml'} post_http_request(@url, request_body, headers) do |data| extract_response data end end |