Sha256: 257185495e309b1b594958a81cf922b4a449bbbc8af79f5bd400f8fa153625a5

Contents?: true

Size: 1004 Bytes

Versions: 5

Compression:

Stored size: 1004 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Adaptors
    module NetSuiteSOAP
      module Subsidiary
        module Operations
          class Find < NetSuiteSOAP::Operation::Find
            class Contract < LedgerSync::Adaptors::Contract
              params do
                required(:external_id).maybe(:string)
                required(:ledger_id).filled(:string)
                required(:name).maybe(:string)
                required(:state).maybe(:string)
              end
            end

            private

            def operate
              netsuite_resource = ::NetSuite::Records::Subsidiary.get(
                internal_id: resource.ledger_id
              )

              resource.name = netsuite_resource.name
              resource.ledger_id = netsuite_resource.internal_id

              success(
                resource: resource,
                response: netsuite_resource
              )
            end
          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_soap/subsidiary/operations/find.rb
ledger_sync-1.3.4 lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb
ledger_sync-1.3.3 lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb
ledger_sync-1.3.2 lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb