Class: Sepa::SoapBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/sepa/soap_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ SoapBuilder

SoapBuilder checks and validates incoming params and creates the SOAP structure



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sepa/soap_builder.rb', line 4

def initialize(params)

  check_params(params)
  # Generate a request ID for the request
  params[:request_id] = generate_request_id

  # Check if the bank&command need keys/certificates/csr's
  @params = initialize_certificates_and_csr(params)

  check_if_bank_allows_command(@params)

  @ar = ApplicationRequest.new(@params).get_as_base64

  @bank = @params.fetch(:bank)
  find_correct_bank_extension(@bank)

  @template_path = File.expand_path('../xml_templates/soap/', __FILE__)
end

Instance Method Details

#get_ar_as_base64Object



28
29
30
# File 'lib/sepa/soap_builder.rb', line 28

def get_ar_as_base64
  @ar
end

#to_xmlObject



23
24
25
26
# File 'lib/sepa/soap_builder.rb', line 23

def to_xml
  # Returns a complete SOAP message in xml format
  find_correct_build(@params).to_xml
end