class Pexels::Photo
Attributes
avg_color[R]
height[R]
id[R]
src[R]
url[R]
user[R]
width[R]
Public Class Methods
new(attrs)
click to toggle source
# File lib/pexels/photo.rb, line 10 def initialize(attrs) @id = attrs.fetch('id') @height = attrs.fetch('height') @width = attrs.fetch('width') @url = attrs.fetch('url') @user = Pexels::User.new( id: attrs.fetch('photographer_id'), name: attrs.fetch('photographer'), url: attrs.fetch('photographer_url') ) @src = attrs.fetch('src') @avg_color = attrs.fetch('avg_color') rescue KeyError => exception raise Pexels::MalformedAPIResponseError.new(exception) end
Public Instance Methods
photo?()
click to toggle source
# File lib/pexels/photo.rb, line 31 def photo? true end
type()
click to toggle source
# File lib/pexels/photo.rb, line 27 def type 'Photo' end
video?()
click to toggle source
# File lib/pexels/photo.rb, line 35 def video? false end