Sha256: 55366a6060e65d218089d49600f54d7102b002aeee493abfc2e37783f0360d97

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require_relative '../operation'

module LedgerSync
  module Adaptors
    module NetSuite
      module Operation
        class Delete
          include NetSuite::Operation::Mixin

          private

          def delete
            case response.status
            when 200..299
              LedgerSync::Result.Success(response)
            else
              failure(
                Error::OperationError.new(
                  operation: self,
                  response: response
                )
              )
            end
          end

          def operate
            delete
              .and_then { success }
          end

          def response
            @response ||= adaptor.delete(
              path: ledger_serializer.class.api_resource_path(resource: resource)
            )
          end

          def success
            super(
              resource: resource,
              response: response
            )
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/adaptors/netsuite/operation/delete.rb
ledger_sync-1.3.4 lib/ledger_sync/adaptors/netsuite/operation/delete.rb
ledger_sync-1.3.3 lib/ledger_sync/adaptors/netsuite/operation/delete.rb
ledger_sync-1.3.2 lib/ledger_sync/adaptors/netsuite/operation/delete.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/netsuite/operation/delete.rb