Class: Ooor::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/ooor/services.rb

Direct Known Subclasses

CommonService, DbService, ObjectService, ReportService

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Service

Returns a new instance of Service.



12
13
14
# File 'lib/ooor/services.rb', line 12

def initialize(session)
  @session = session
end

Class Method Details

.define_service(service, methods) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/ooor/services.rb', line 16

def self.define_service(service, methods)
  methods.each do |meth|
    self.instance_eval do
      define_method meth do |*args|
        endpoint = @session.get_client(:xml, "#{@session.base_url}/#{service.to_s.gsub('ooor_alias_', '')}") #TODO make that transport agnostic
        endpoint.call(meth.gsub('ooor_alias_', ''), *args)
      end
    end
  end
end