Class: Magenthor::Base
- Inherits:
-
Object
- Object
- Magenthor::Base
- Defined in:
- lib/magenthor/base.rb
Constant Summary collapse
- @@client =
nil
- @@session_id =
nil
- @@api_user =
nil
- @@api_key =
nil
Class Method Summary collapse
-
.setup(params) ⇒ Magenthor::Base
Initialize the constants that will be used to make the connection to Magento.
Class Method Details
.setup(params) ⇒ Magenthor::Base
Initialize the constants that will be used to make the connection to Magento
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/magenthor/base.rb', line 15 def self.setup params if params.class != Hash puts "Parameters must be in an Hash." return false end if !params.key? :host or !params.key? :api_user or !params.key? :api_key puts "Mandatory parameter missing. Check if :host, :api_user and :api_key are there." return false end @@api_user = params[:api_user] @@api_key = params[:api_key] url = "http://#{params[:host]}:#{params[:port]}/api/xmlrpc" @@client = XMLRPC::Client.new2(url) @@client.http_header_extra = { "accept-encoding" => "identity" } return true end |