Sha256: 130477bf8beede5b448e65e095ad7cd180e28a42908d1a0c2706099f925641fd

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module LedgerSync
  module Ledgers
    module NetSuiteSOAP
      class Operation
        module Mixin
          def self.included(base)
            base.include Ledgers::Operation::Mixin
            base.include InstanceMethods
          end

          module InstanceMethods
            def netsuite_resource_class
              @netsuite_resource_class ||= serializer.class::NETSUITE_RESOURCE_CLASS
            end

            def netsuite_error(netsuite_resource:)
              Error::OperationError.new(
                message: netsuite_resource.errors.first.message,
                operation: self,
                response: netsuite_resource
              )
            end

            def netsuite_failure(netsuite_resource:)
              failure(netsuite_error(netsuite_resource: netsuite_resource))
            end

            def perform
              client.wrap_perform do
                super
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ledger_sync-1.7.0 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.6.0 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.4.4 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/netsuite_soap/operation.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/netsuite_soap/operation.rb