Sha256: 35e9bfeef4318862241e02bf69b3454e62f0c338589b271ec1bf5f561cac0e85

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

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/20170426'

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

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

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

    class << self
      protected :search
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rakuten_web_service-1.13.2 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.13.1 lib/rakuten_web_service/recipe.rb
rakuten_web_service-1.13.0 lib/rakuten_web_service/recipe.rb