Sha256: ebac529135d4490580e018d16aa5a88541b1b76a8e65abfa53c478e9e4055ef2

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

module VimeoRuby
  class Video < Base
    attr_reader :description, :duration, :embed_html, :link, :name, :player_embed_url, :type, :user

    def initialize(attrs: {}, user_class: VimeoRuby::User)
      @description = attrs.delete("description")
      @duration = attrs.delete("duration")
      @embed_html = attrs.delete("embed").delete("html")
      @link = attrs.delete("link")
      @name = attrs.delete("name")
      @player_embed_url = attrs.delete("player_embed_url")
      @type = attrs.delete("type")
      @user = user_class.new(attrs: attrs.delete("user"))
      vimeo_uri_with_id = attrs.delete("uri")
      super(vimeo_id: vimeo_uri_with_id, remaining_attrs: attrs)
    end

    class << self
      def get_video(video_id)
        video_info = get("#{base_uri}/videos/#{video_id}")
        new(attrs: video_info)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vimeo_ruby-0.5.0 lib/vimeo_ruby/video.rb