class Pexels::Video
Attributes
duration[R]
files[R]
height[R]
id[R]
image[R]
pictures[R]
url[R]
user[R]
width[R]
Public Class Methods
new(attrs)
click to toggle source
# File lib/pexels/video.rb, line 13 def initialize(attrs) @id = attrs.fetch('id') @height = attrs.fetch('height') @width = attrs.fetch('width') @url = attrs.fetch('url') @image = attrs.fetch('image') @duration = attrs.fetch('duration') @user = Pexels::User.new( id: attrs.fetch('user').fetch('id'), name: attrs.fetch('user').fetch('name'), url: attrs.fetch('user').fetch('url') ) @files = attrs.fetch('video_files', []).map { |vf| Pexels::Video::File.new(vf) } @pictures = attrs.fetch('video_pictures', []).map { |vp| Pexels::Video::Picture.new(vp) } rescue KeyError => exception raise Pexels::MalformedAPIResponseError.new(exception) end
Public Instance Methods
photo?()
click to toggle source
# File lib/pexels/video.rb, line 39 def photo? false end
type()
click to toggle source
# File lib/pexels/video.rb, line 35 def type 'Video' end
video?()
click to toggle source
# File lib/pexels/video.rb, line 43 def video? true end