Sha256: adb7ec3d3f37702409c08f90fce8335ac0cbfc506c67b152d955f3af92fc6779

Contents?: true

Size: 1.52 KB

Versions: 14

Compression:

Stored size: 1.52 KB

Contents

module Exlibris
  module Primo
    module WebService
      module Client
        module SoapActions
          def self.included(klass)
            klass.class_eval do
              extend ClassAttributes
            end
          end

          module ClassAttributes
            def soap_actions
              @soap_actions ||= []
            end

            def add_soap_actions *actions
              actions.each do |action|
                soap_actions << action unless soap_actions.include? action
              end
            end
            protected :add_soap_actions
          end

          def soap_actions
            @soap_actions ||= self.class.soap_actions #.concat(client.wsdl.soap_actions)
          end
          protected :soap_actions
          
          # 
          # Define methods for SOAP actions. SOAP actions take a single String argument, request_xml,
          # which is set as the body of the SOAP request
          # 
          def method_missing(method, *args, &block)
            if(soap_actions.include? method)
              self.class.send(:define_method, method) { |request_xml|
                client.call(method, message: request_xml)
              }
              send method, *args, &block
            else
              super
            end
          end

          #
          # Tell users that we respond to SOAP actions.
          #
          def respond_to?(method, include_private=false)
            (soap_actions.include? method) ? true : super
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
exlibris-primo-2.1.1 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-2.1.0 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-2.0.0 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.9 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.8 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.7 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.6 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.5 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.4 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.3 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.2 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.1 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.1.0 lib/exlibris/primo/web_service/client/base/soap_actions.rb
exlibris-primo-1.0.11 lib/exlibris/primo/web_service/client/base/soap_actions.rb