Module: Vindicia::Model::ClassMethods

Defined in:
lib/vindicia/model.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend_object(base) ⇒ Object



14
15
16
17
# File 'lib/vindicia/model.rb', line 14

def self.extend_object(base)
  super
  base.init_vindicia_model
end

Instance Method Details

#actions(*actions) ⇒ Object

Accepts one or more SOAP actions and generates both class and instance methods named after the given actions. Each generated method accepts an optional SOAP body Hash and a block to be passed to Savon::Client#request and executes a SOAP request.



38
39
40
41
42
# File 'lib/vindicia/model.rb', line 38

def actions(*actions)
  actions.each do |action|
    define_class_action action
  end
end

#client(&block) ⇒ Object



23
24
25
# File 'lib/vindicia/model.rb', line 23

def client(&block)
  @client ||= Savon::Client.new &block
end

#endpoint(uri) ⇒ Object



27
28
29
# File 'lib/vindicia/model.rb', line 27

def endpoint(uri)
  client.wsdl.endpoint = uri
end

#init_vindicia_modelObject



19
20
21
# File 'lib/vindicia/model.rb', line 19

def init_vindicia_model
  class_action_module
end

#namespace(uri) ⇒ Object



31
32
33
# File 'lib/vindicia/model.rb', line 31

def namespace(uri)
  client.wsdl.namespace = uri
end