lib/link_thumbnailer/models/website.rb in link_thumbnailer-2.1.0 vs lib/link_thumbnailer/models/website.rb in link_thumbnailer-2.2.0
- old
+ new
@@ -2,16 +2,27 @@
module LinkThumbnailer
module Models
class Website < ::LinkThumbnailer::Model
- attr_accessor :url, :title, :description, :images
+ attr_accessor :url, :title, :description, :images, :videos
def initialize
@images = []
+ @videos = []
end
+ def video=(video)
+ self.videos = video
+ end
+
+ def videos=(videos)
+ Array(videos).each do |video|
+ @videos << video
+ end
+ end
+
def image=(image)
self.images = image
end
def images=(images)
@@ -28,10 +39,11 @@
def as_json(*)
{
url: url.to_s,
title: title,
description: description,
- images: images
+ images: images,
+ videos: videos
}
end
end
end