Class: ServiceProxy::Base
- Inherits:
-
Object
- Object
- ServiceProxy::Base
- Defined in:
- lib/service_proxy/base.rb
Constant Summary collapse
- VERSION =
'0.2.1'
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#http ⇒ Object
Returns the value of attribute http.
-
#service_methods ⇒ Object
Returns the value of attribute service_methods.
-
#soap_actions ⇒ Object
Returns the value of attribute soap_actions.
-
#target_namespace ⇒ Object
Returns the value of attribute target_namespace.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#wsdl ⇒ Object
Returns the value of attribute wsdl.
Instance Method Summary collapse
- #call_service(options) ⇒ Object
-
#initialize(endpoint) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(endpoint) ⇒ Base
Returns a new instance of Base.
22 23 24 25 |
# File 'lib/service_proxy/base.rb', line 22 def initialize(endpoint) self.endpoint = endpoint self.setup end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object (private)
111 112 113 114 115 116 |
# File 'lib/service_proxy/base.rb', line 111 def method_missing(method, *args) method_name = method.to_s = args.pop || {} super unless self.service_methods.include?(method_name) call_service(.update(:method => method_name)) end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def debug @debug end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def endpoint @endpoint end |
#http ⇒ Object
Returns the value of attribute http.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def http @http end |
#service_methods ⇒ Object
Returns the value of attribute service_methods.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def service_methods @service_methods end |
#soap_actions ⇒ Object
Returns the value of attribute soap_actions.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def soap_actions @soap_actions end |
#target_namespace ⇒ Object
Returns the value of attribute target_namespace.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def target_namespace @target_namespace end |
#uri ⇒ Object
Returns the value of attribute uri.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def uri @uri end |
#wsdl ⇒ Object
Returns the value of attribute wsdl.
19 20 21 |
# File 'lib/service_proxy/base.rb', line 19 def wsdl @wsdl end |
Instance Method Details
#call_service(options) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/service_proxy/base.rb', line 27 def call_service() method = [:method] headers = { 'content-type' => 'text/xml; charset=utf-8', 'SOAPAction' => self.soap_actions[method] } body = build_request(method, ) response = self.http.request_post(self.uri.path, body, headers) parse_response(method, response) end |