Sha256: 3ef52b9263bcc5e731b61cfa9c2d6d14cc205224054fc2d79aa5b6ecb570362a

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

module NetSuite
  module Actions
    class Get
      include SavonSupport

      def initialize(id)
        @id = id
      end

      private

      def request
        connection.request :platformMsgs, :get do
          soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
          soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
          soap.header = auth_header
          soap.body   = request_body
        end
      end

      # <soap:Body>
      #   <platformMsgs:get>
      #     <platformMsgs:baseRef internalId="983" type="customer" xsi:type="platformCore:RecordRef">
      #       <platformCore:name/>
      #     </platformMsgs:baseRef>
      #   </platformMsgs:get>
      # </soap:Body>
      def request_body
        {
          'platformMsgs:baseRef' => {},
          :attributes! => {
            'platformMsgs:baseRef' => {
              :internalId => @id,
              :type       => 'customer',
              'xsi:type'  => 'platformCore:RecordRef'
            }
          }
        }
      end

      def success?
        @success ||= response_hash[:status][:@is_success] == 'true'
      end

      def response_body
        @response_body ||= response_hash[:record]
      end

      def response_hash
        @response_hash = @response[:get_response][:read_response]
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
netsuite-0.0.7 lib/netsuite/actions/get.rb
netsuite-0.0.6 lib/netsuite/actions/get.rb
netsuite-0.0.5 lib/netsuite/actions/get.rb
netsuite-0.0.4 lib/netsuite/actions/get.rb