Module: Magento::Base::ClassMethods

Included in:
Magento::Base
Defined in:
lib/magento/base.rb

Instance Method Summary collapse

Instance Method Details

#api_pathObject



22
23
24
# File 'lib/magento/base.rb', line 22

def api_path
  to_s.split('::').last.underscore.downcase
end

#commit(method, *args) ⇒ Object

Uses the classes name and method to make an rpc call through connection



16
17
18
19
20
# File 'lib/magento/base.rb', line 16

def commit(method, *args)
  # TODO: need to catch errors sent back from magento and bubble them up appropriately
  method = "#{api_path}.#{method}"
  Magento::Base.connection.call(method, *args)
end