Class: Gemgento::API::SOAP::Directory::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgento/api/soap/directory/country.rb

Class Method Summary collapse

Class Method Details

.fetch_allVoid

Fetch all Countries from Magento and sync them to Gemgento.

Returns:

  • (Void)


10
11
12
13
14
15
16
17
18
# File 'lib/gemgento/api/soap/directory/country.rb', line 10

def self.fetch_all
  response = list

  if response.success?
    response.body[:countries][:item].each do |country|
      sync_magento_to_local(country)
    end
  end
end

.listGemgento::MagentoResponse

Get a list of Countries from Magento.



23
24
25
26
27
28
29
30
31
# File 'lib/gemgento/api/soap/directory/country.rb', line 23

def self.list
  response = MagentoApi.create_call(:directory_country_list)

  if response.success? && !response.body[:countries][:item].is_a?(Array)
    response.body[:countries][:item] = [response.body[:countries][:item]]
  end

  return response
end