Sha256: d73395b4d1062856061ca2b668875e00e14b6ba09ac3fe42269e370954b3fab7

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

require 'rakuten_web_service/configuration'

require 'rakuten_web_service/recipe/category'

module RakutenWebService
  class Recipe < Resource
    endpoint 'https://app.rakuten.co.jp/services/api/Recipe/CategoryRanking/20121121'

    attribute :recipeId, :recipeTitle, :recipeUrl,
      :foodImageUrl, :mediumImageUrl, :smallImageUrl,
      :pickup, :shop, :nickname,
      :recipeDescription, :recipeMaterial,
      :recipeIndication, :recipeCost,
      :recipePublishday, :rank

    set_parser do |response|
      response['result'].map { |r| Recipe.new(r) }
    end

    def self.ranking(category_id = nil)
      params = {}
      params.merge!(category_id: category_id) unless category_id.nil?
      self.search(params)
    end

    class << self
      protected :search
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rakuten_web_service-1.8.0 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.7.0 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.6.1 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.6.0 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.5.0 lib/rakuten_web_service/recipe.rb