Class: Vantiv::Certification::ValidationTestRunner
- Inherits:
-
Object
- Object
- Vantiv::Certification::ValidationTestRunner
- Defined in:
- lib/vantiv/certification/validation_test_runner.rb
Constant Summary collapse
- ENDPOINT_RESPONSE_OBJECT =
{ Api::Endpoints::TOKENIZATION => Api::TokenizationResponse.new, Api::Endpoints::AUTHORIZATION => Api::LiveTransactionResponse.new(:auth), Api::Endpoints::AUTH_REVERSAL => Api::TiedTransactionResponse.new(:auth_reversal), Api::Endpoints::CAPTURE => Api::TiedTransactionResponse.new(:capture), Api::Endpoints::SALE => Api::LiveTransactionResponse.new(:sale), Api::Endpoints::CREDIT => Api::TiedTransactionResponse.new(:credit), Api::Endpoints::RETURN => Api::TiedTransactionResponse.new(:return), Api::Endpoints::VOID => Api::TiedTransactionResponse.new(:void) }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(save_to:, filter_by: '') ⇒ ValidationTestRunner
constructor
A new instance of ValidationTestRunner.
- #run ⇒ Object
Constructor Details
#initialize(save_to:, filter_by: '') ⇒ ValidationTestRunner
Returns a new instance of ValidationTestRunner.
24 25 26 27 |
# File 'lib/vantiv/certification/validation_test_runner.rb', line 24 def initialize(save_to:, filter_by: '') @certs_file = save_to @filter_by = filter_by end |
Class Method Details
.run(save_to:, filter_by: '') ⇒ Object
20 21 22 |
# File 'lib/vantiv/certification/validation_test_runner.rb', line 20 def self.run(save_to:, filter_by: '') new(save_to: save_to, filter_by: filter_by).run end |
Instance Method Details
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vantiv/certification/validation_test_runner.rb', line 29 def run fixtures.each do |file_name| cert_name = get_cert_name(file_name) next if filter_by && !/#{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 |