Module: Exlibris::Primo::WebService::Client::SoapActions

Included in:
Base
Defined in:
lib/exlibris/primo/web_service/client/base/soap_actions.rb

Defined Under Namespace

Modules: ClassAttributes

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Define methods for SOAP actions. SOAP actions take a single String argument, request_xml, which is set as the body of the SOAP request



34
35
36
37
38
39
40
41
42
43
# File 'lib/exlibris/primo/web_service/client/base/soap_actions.rb', line 34

def method_missing(method, *args, &block)
  if(soap_actions.include? method)
    self.class.send(:define_method, method) { |request_xml|
      client.request(method) { soap.body = request_xml }
    }
    send method, *args, &block
  else
    super
  end
end

Class Method Details

.included(klass) ⇒ Object



6
7
8
9
10
# File 'lib/exlibris/primo/web_service/client/base/soap_actions.rb', line 6

def self.included(klass)
  klass.class_eval do
    extend ClassAttributes
  end
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean

Tell users that we respond to SOAP actions.

Returns:

  • (Boolean)


48
49
50
# File 'lib/exlibris/primo/web_service/client/base/soap_actions.rb', line 48

def respond_to?(method, include_private=false)
  (soap_actions.include? method) ? true : super
end