Class: Youku::V2::Comments

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

Defined Under Namespace

Classes: Hot

Constant Summary collapse

BASE_URI =
"#{BASE_URI}/comments"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Instance Method Details

#by_video(video_id: nil, page: 1, count: 20) ⇒ Object

Public: Get comments by a video ID

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

video_id - The string video ID. page - The Integer page number. count - The Integer page size.

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



15
16
17
18
19
20
21
22
# File 'lib/youku/v2/comments.rb', line 15

def by_video(video_id: nil, page: 1, count: 20)
  Youku::V2::Request.new "#{BASE_URI}/by_video.json", {
    client_id: client.client_id,
    video_id:  video_id,
    page:      page,
    count:     count,
  }
end

#hotObject

Public: Get hot API.

Returns the instance of Youku::V2::Comments::Hot.



55
56
57
# File 'lib/youku/v2/comments.rb', line 55

def hot
  Hot.new(client)
end

#show(comment_id: nil) ⇒ Object

Public: Get a comment by ID.

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

comment_id - The string comment ID.

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



31
32
33
34
35
36
# File 'lib/youku/v2/comments.rb', line 31

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

#show_batch(comment_ids: nil) ⇒ Object

Public: Get comments by their IDs.

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

comment_ids - The string comment IDs.

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



45
46
47
48
49
50
# File 'lib/youku/v2/comments.rb', line 45

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