Class: SpreeEcs::Taxon

Inherits:
Base
  • Object
show all
Defined in:
lib/spree_ecs/taxon.rb

Class Method Summary collapse

Methods inherited from Base

cache, log

Class Method Details

.find(id) ⇒ Object

Find category by BrowseNodeId



16
17
18
19
20
21
# File 'lib/spree_ecs/taxon.rb', line 16

def find(id)
  cache("spree_ecs:taxon:#{id}"){
    log(" find taxon: #{id} ")
    parse_browse_node(Amazon::Ecs.browse_node_lookup(id))
  }
end

.top_sellers(id) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/spree_ecs/taxon.rb', line 4

def top_sellers(id)
  cache("spree_ecs:taxon:top-sellers:#{id}"){
    log(" taxon top sellers: #{id} ")
    (Amazon::Ecs.browse_node_lookup(id, {:response_group => "TopSellers"}).
     doc/"TopSeller/ASIN/").map{|x| x.to_s }
  }
rescue
  []
end