Class: Magento::Connection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Connection

Returns a new instance of Connection.



13
14
15
16
17
18
# File 'lib/magento.rb', line 13

def initialize(*args)
  @config = Configuration.new
  @client = XMLRPC::Client.new(@config.host,@config.path,@config.port)
  @session = @client.call("login", @config.username, @config.api_key)
  self
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



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

def client
  @client
end

Instance Method Details

#call(method = nil, *args) ⇒ Object



20
21
22
# File 'lib/magento.rb', line 20

def call(method = nil, *args)
  client.call("call",@session, method, args)
end