Class: Edi::Wayfair::CatalogReadV2Request
- Inherits:
-
Object
- Object
- Edi::Wayfair::CatalogReadV2Request
- Includes:
- Service
- Defined in:
- app/services/edi/wayfair/catalog_read_v2_request.rb
Overview
Executes and parses one Catalog Read v2 supplier-part-number request.
Transport failures become data so one bad batch does not abort the pull.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#call ⇒ Result
Performs the request and parses the response.
Methods included from Service
#attributes_used, #build_result, call, #logger
Methods included from Service::Initializer
Instance Method Details
#call ⇒ Result
Performs the request and parses the response.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/services/edi/wayfair/catalog_read_v2_request.rb', line 29 def call transport = transport_builder.call http = transport.send_request('POST', url, payload, headers(transport))[:http_res] return failure("HTTP #{http&.status}") unless http&.status&.between?(200, 299) parse(http.body) rescue JSON::ParserError => e failure("parse error: #{e.}") rescue StandardError => e failure("#{e.class}: #{e.}") end |