Class: RakutenWebService::Recipe

Inherits:
Resource
  • Object
show all
Defined in:
lib/rakuten_web_service/recipe.rb,
lib/rakuten_web_service/recipe/category.rb

Defined Under Namespace

Classes: Category

Class Method Summary collapse

Methods inherited from 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

Class Method Details

.categories(category_type) ⇒ Object



16
17
18
19
20
21
# File 'lib/rakuten_web_service/recipe/category.rb', line 16

def self.categories(category_type)
  @categories ||= {}
  @categories[category_type] ||= Category.search(category_type: category_type).response['result'][category_type].map do |category|
    Category.new(category.merge(categoryType: category_type))
  end
end

.large_categoriesObject



4
5
6
# File 'lib/rakuten_web_service/recipe/category.rb', line 4

def self.large_categories
  categories('large')
end

.medium_categoriesObject



8
9
10
# File 'lib/rakuten_web_service/recipe/category.rb', line 8

def self.medium_categories
  categories('medium')
end

.ranking(category) ⇒ Object



20
21
22
# File 'lib/rakuten_web_service/recipe.rb', line 20

def self.ranking(category)
  self.search(category_id: category)
end

.small_categoriesObject



12
13
14
# File 'lib/rakuten_web_service/recipe/category.rb', line 12

def self.small_categories
  categories('small')
end