Class: Edi::Wayfair::RecordCatalogParentCoverage::ScanValidator

Inherits:
Object
  • Object
show all
Defined in:
app/services/edi/wayfair/record_catalog_parent_coverage/scan_validator.rb

Overview

Validates the shape and pagination boundary of a Supplier Catalog v1 scan.

Instance Method Summary collapse

Constructor Details

#initialize(pages) ⇒ ScanValidator

Returns a new instance of ScanValidator.

Parameters:

  • pages (Array<Hash>)

    parsed GraphQL response pages



6
7
8
# File 'app/services/edi/wayfair/record_catalog_parent_coverage/scan_validator.rb', line 6

def initialize(pages)
  @pages = pages
end

Instance Method Details

#errorsArray<String>

Returns:

  • (Array<String>)


11
12
13
14
15
16
# File 'app/services/edi/wayfair/record_catalog_parent_coverage/scan_validator.rb', line 11

def errors
  structural_errors = [empty_error, graphql_error, shape_error].compact
  return structural_errors if structural_errors.any?

  [page_sequence_error, termination_error, total_pages_error].compact
end