Module: Yt::Annotations::For

Included in:
Yt::Annotations
Defined in:
lib/yt/annotations/for.rb

Instance Method Summary collapse

Instance Method Details

#for(video_id) ⇒ Object


13
14
15
16
17
18
# File 'lib/yt/annotations/for.rb', line 13

def for(video_id)
  request = Net::HTTP::Get.new "/annotations_invideo?video_id=#{video_id}"
  options = ['www.youtube.com', 443, {use_ssl: true}]
  response = Net::HTTP.start(*options) {|http| http.request request}
  xml_to_annotations(Hash.from_xml response.body).sort_by &:starts_at
end