Sha256: 07911e308bd6e59606b4aa142e1204c69e5d721083501e86bc58a298dde38e8a

Contents?: true

Size: 980 Bytes

Versions: 8

Compression:

Stored size: 980 Bytes

Contents

# frozen_string_literal: true

require_relative '../operation'

module LedgerSync
  module Ledgers
    module NetSuite
      class 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 ||= client.delete(
              path: ledger_resource_path
            )
          end

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

Version data entries

8 entries across 8 versions & 1 rubygems

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