Sha256: ce477aa54d722ecd4c2ae9e0e43b135d04ad0f3d2b6d850eb69d6d5876fad101

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module SolidusBactracs
  module Api
    class Client
      class << self
        def from_config
          new(
            request_runner: RequestRunner.new,
            error_handler: SolidusBactracs.config.error_handler,
            shipment_serializer: SolidusBactracs.config.api_shipment_serializer,
          )
        end
      end

      attr_reader :request_runner, :error_handler, :shipment_serializer

      def initialize(request_runner:, error_handler:, shipment_serializer:)
        @request_runner = request_runner
        @error_handler = error_handler
        @shipment_serializer = shipment_serializer
      end

      def bulk_create_orders(shipments)
        shipments.each do |shipment|
          SolidusBactracs::Api::SyncShipmentJob.perform_now(
            shipment_id: shipment.id,
            error_handler: @error_handler,
            shipment_serializer: @shipment_serializer,
            request_runner: @request_runner
          )
        end.compact
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 lib/solidus_bactracs/api/client.rb
solidus_bactracs-4.0.0 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.5.2 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.5.1 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.5.0 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.4.0 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.3.2 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.3.1 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.3.0 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.2.2 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.2.1 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.2.0 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.1.2 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.1.1 lib/solidus_bactracs/api/client.rb
solidus_bactracs-3.1.0 lib/solidus_bactracs/api/client.rb