Class: Vantiv::Certification::ValidationTestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/vantiv/certification/validation_test_runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter_by: '', save_to:) ⇒ ValidationTestRunner

Returns a new instance of ValidationTestRunner.



14
15
16
17
# File 'lib/vantiv/certification/validation_test_runner.rb', line 14

def initialize(filter_by: '', save_to:)
  @filter_by = filter_by
  @certs_file = save_to
end

Class Method Details

.run(filter_by: '', save_to:) ⇒ Object



10
11
12
# File 'lib/vantiv/certification/validation_test_runner.rb', line 10

def self.run(filter_by: '', save_to:)
  new(filter_by: filter_by, save_to: save_to).run
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vantiv/certification/validation_test_runner.rb', line 19

def run
  fixtures.each do |file_name|
    cert_name = get_cert_name(file_name)
    next if filter_by && !/L_#{filter_by}_\d*/.match(cert_name)

    contents = JSON.parse(File.read(file_name))
    run_request(
      cert_name: cert_name,
      endpoint: Vantiv::Api::Endpoints.const_get(contents["endpoint"]),
      body: create_body(contents["body"])
    )
  end
  shutdown
end