Sha256: c7a615b444f97a400a51336a6d4c87b404dfcf9f66ef18d52a308d1cbf5f5c12

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

module NetSuite
  module Support
    module Requests

      def self.included(base)
        base.send(:extend, ClassMethods)
      end

      module ClassMethods

        def call(*args)
          new(*args).call
        end

      end

      def call
        @response = request
        build_response
      end

      private

      def request
        raise NotImplementedError, 'Please implement a #request method'
      end

      def build_response
        Response.new(:success => success?, header: response_header, :body => response_body)
      end

      def success?
        raise NotImplementedError, 'Please implement a #success? method'
      end

      # Only care about headers in Search class for now
      def response_header
        nil
      end

      def response_body
        raise NotImplementedError, 'Please implement a #response_body method'
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
netsuite-0.2.0 lib/netsuite/support/requests.rb
netsuite-0.1.0 lib/netsuite/support/requests.rb