Sha256: b8a8ed4cc63e6536fdab3804deab3f9cb74a9e75267f177b9065f9db4627fe0c
Contents?: true
Size: 1.02 KB
Versions: 8
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module SolidusBacktracs module Api class BatchSyncer class << self def from_config new( client: SolidusBacktracs::Api::Client.from_config, shipment_matcher: SolidusBacktracs.config.api_shipment_matcher, ) end end attr_reader :client, :shipment_matcher def initialize(client:, shipment_matcher:) @client = client @shipment_matcher = shipment_matcher end def call(shipments) begin response = client.bulk_create_orders(shipments) rescue RateLimitedError => e ::Spree::Event.fire( 'solidus_backtracs.api.rate_limited', shipments: shipments, error: e, ) raise e rescue RequestError => e ::Spree::Event.fire( 'solidus_backtracs.api.sync_errored', shipments: shipments, error: e, ) raise e end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems