Class: Gemgento::API::SOAP::Catalog::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgento/api/soap/catalog/search.rb

Class Method Summary collapse

Class Method Details

.results(query) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gemgento/api/soap/catalog/search.rb', line 7

def self.results(query)
  response = MagentoApi.create_call(:product_search_results, {query: query})

  if response.success?
    result = response.body[:result][:item]
    if result.nil?
      return []
    else
      result = [result] unless result.is_a? Array
      return result
    end
  else
    return []
  end
end