Sha256: 0d2bc16b38930109cf82e71b8c40783d5cae252e0af38efa8a8b69cdc28f567f

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module Youku
  module V2
    class Searches < Base

      # Public: Get video API.
      #
      # Returns the instance of Youku::V2::Searches::Video.
      def video
        Video.new(client)
      end

      class Video < Base
        BASE_URI = "#{BASE_URI}/searches/video"

        # Public: Get videos by keyword.
        #
        # See: http://open.youku.com/docs?id=81
        #
        # keyword   - The space separated String of keywords.
        # period    - The String period.
        # orderby   - The String order of videos.
        # page      - The Integer page number.
        # count     - The Integer page size.
        #
        # Returns the instance of Youku::V2::Request.
        def by_keyword(keyword, period: 'week', orderby: 'published', page: 1, count: 20)
          Youku::V2::Request.new "#{BASE_URI}/by_keyword.json", {
            client_id: client.client_id,
            keyword:   keyword,
            period:    period,
            orderby:   orderby,
            page:      page,
            count:     count
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
youku_client-0.0.3 lib/youku/v2/searches.rb
youku_client-0.0.2 lib/youku/v2/searches.rb