Sha256: 8895a18758d4003e4fb466f4925cd7bda3da3807738a21a9b265b1ecfb8e1a32
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
module Stir module Operations def self.included(base) base.extend(ClassMethods) end def define_operations! @operations = operations @operations.each do |op| next if self.methods.include?(op) self.class.send(:define_method, op) do |*args| @response = get_client.call(op, *args) end end end def operations get_operations end private def get_operations operations = operations_available? ? get_client.operations : [] operations << self.class.send(:operations) operations.flatten.uniq end def operations_available? return true if get_client.operations rescue RuntimeError false end def get_client Savon.client(self.service_config.symbolize_keys) end module ClassMethods def operation(op_name, op_alias = nil) self.send(:define_method, op_name) { |*args| @response = get_client.call(op_name, *args) } operations.push(op_name) unless op_alias.nil? || op_alias.empty? self.send(:define_method, op_alias) { |*args| send(op_name, *args) } operations.push(op_alias) end end private def operations return @operations if @operations @operations = [] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
stir-2.2.3 | lib/stir/soap/operations.rb |
stir-2.2.2 | lib/stir/soap/operations.rb |
stir-2.2.1 | lib/stir/soap/operations.rb |
stir-2.1.1 | lib/stir/soap/operations.rb |