Class: Gemgento::API::SOAP::Directory::Region
- Inherits:
-
Object
- Object
- Gemgento::API::SOAP::Directory::Region
- Defined in:
- lib/gemgento/api/soap/directory/region.rb
Class Method Summary collapse
Class Method Details
.fetch_all ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gemgento/api/soap/directory/region.rb', line 7 def self.fetch_all ::Gemgento::Country.all.each do |country| response = list(country.iso2_code) if response.success? response.body[:countries][:item].each do |region| sync_magento_to_local(region, country) end end end end |
.list(country) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gemgento/api/soap/directory/region.rb', line 20 def self.list(country) response = MagentoApi.create_call(:directory_region_list, {country: country}) if response.success? if response.body[:countries][:item].nil? response.body[:countries][:item] = [] elsif !response.body[:countries][:item].is_a? Array response.body[:countries][:item] = [response.body[:countries][:item]] end end return response end |