Class: Youku::V2::Videos

Inherits:
Base
  • Object
show all
Defined in:
lib/youku/v2/videos.rb

Constant Summary collapse

BASE_URI =
"#{BASE_URI}/videos"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Instance Method Details

#by_user(user_id: nil, user_name: nil, orderby: 'published', page: 1, count: 20) ⇒ Object

Public: Get videos for given Youku user.

See: open.youku.com/docs?id=49

user_id - The String Youku user ID. user_name - The String Youku user name. orderby - The String order of videos. page - The Integer page number. count - The Integer page size.

Returns the instance of Youku::V2::Request.



17
18
19
20
21
22
23
24
25
26
# File 'lib/youku/v2/videos.rb', line 17

def by_user(user_id: nil, user_name: nil, orderby: 'published', page: 1, count: 20)
  Youku::V2::Request.new "#{BASE_URI}/by_user.json", {
    client_id: client.client_id,
    user_id:   user_id,
    user_name: user_name,
    orderby:   orderby,
    page:      page,
    count:     count
  }
end

#show(video_id, ext: nil) ⇒ Object

Public: Get video by ID

See: open.youku.com/docs?id=46

video_id - The String video ID. ext - The String video extension information.

Returns the instance of Youku::V2::Request.



36
37
38
39
40
41
42
# File 'lib/youku/v2/videos.rb', line 36

def show(video_id, ext: nil)
  Youku::V2::Request.new "#{BASE_URI}/show.json", {
    client_id: client.client_id,
    video_id:  video_id,
    ext:       ext
  }
end

#show_batch(video_ids: nil, ext: nil) ⇒ Object

Public: Get videos by IDs

See: open.youku.com/docs?id=47

video_ids - The comma separated String of video IDs. ext - The String video extension information.

Returns the instance of Youku::V2::Request.



52
53
54
55
56
57
58
# File 'lib/youku/v2/videos.rb', line 52

def show_batch(video_ids: nil, ext: nil)
  Youku::V2::Request.new "#{BASE_URI}/show_batch.json", {
    client_id: client.client_id,
    video_ids: video_ids,
    ext:       ext
  }
end