Class: RakutenWebService::Recipe::Category

Inherits:
RakutenWebService::Resource show all
Defined in:
lib/rakuten_web_service/recipe/category.rb

Instance Method Summary collapse

Methods inherited from RakutenWebService::Resource

#[], all, attribute, client, endpoint, #get_attribute, #initialize, resource_name, search, set_parser, set_resource_name

Constructor Details

This class inherits a constructor from RakutenWebService::Resource

Instance Method Details

#absolute_category_idObject



41
42
43
44
45
46
47
# File 'lib/rakuten_web_service/recipe/category.rb', line 41

def absolute_category_id
  if parent_category
    [parent_category.absolute_category_id, id.to_s].join('-')
  else
    id.to_s
  end
end

#parent_categoryObject



36
37
38
39
# File 'lib/rakuten_web_service/recipe/category.rb', line 36

def parent_category
  return nil if parent_category_type.nil?
  Recipe.categories(parent_category_type).find { |c| c.id.to_i === parent_category_id.to_i }
end

#rankingObject



32
33
34
# File 'lib/rakuten_web_service/recipe/category.rb', line 32

def ranking
  Recipe.ranking(absolute_category_id)
end