Sha256: 9b626e0484eb867c30b1c91da880cbafe39b0f8750f977f5cc0f4c63eec26de5

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

require "savon"

module BlackBook
  class BaseRequest
    class << self
      def request(operation, data)
        client.call(operation, message: data)
      end

      def client
        @@client ||= Savon.client(wsdl: wsdl_url, soap_header: credentials, log: false)
      end

      def operations
        @@operations ||= client.operations
      end

      def credentials
        @@credentials ||= %|<UserCredentials xmlns="https://blackbookws.com/UsedCarWSX">
            <userid>#{BlackBook.config.user_id}</userid>
            <password>#{BlackBook.config.password}</password>
            <customer/>
            <producttype>W</producttype>
            <returncode>0</returncode>
            <returnmessage/>
          </UserCredentials>|
      end

      def wsdl_url
        raise NotImplementedError, "should have a WSDL URL"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
black_book-0.0.5 lib/black_book/base_request.rb
black_book-0.0.4 lib/black_book/base_request.rb
black_book-0.0.3 lib/black_book/base_request.rb
black_book-0.0.2 lib/black_book/base_request.rb
black_book-0.0.1 lib/black_book/base_request.rb