Sha256: a6ca89bdcca045a8726524186da0f7a63b1a35fd949310fe1a7260b02c6fb44d

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

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

    def initialize(attrs: {})
      @vimeo_id = extract_vimeo_id_from_uri(attrs.delete("uri"))
      @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 = VimeoRuby::User.new(attrs: attrs.delete("user"))
      @additional_info = OpenStruct.new(attrs)
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vimeo_ruby-0.4.2 lib/vimeo_ruby/video.rb
vimeo_ruby-0.4.1 lib/vimeo_ruby/video.rb
vimeo_ruby-0.3.0 lib/vimeo_ruby/video.rb