Class: VimeoRuby::Video

Inherits:
Base
  • Object
show all
Defined in:
lib/vimeo_ruby/video.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#access_token, #additional_info, #vimeo_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

base_uri, client_identifier, client_secret, get

Constructor Details

#initialize(attrs: {}, user_class: VimeoRuby::User) ⇒ Video

Returns a new instance of Video.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vimeo_ruby/video.rb', line 5

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def description
  @description
end

#durationObject (readonly)

Returns the value of attribute duration.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def duration
  @duration
end

#embed_htmlObject (readonly)

Returns the value of attribute embed_html.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def embed_html
  @embed_html
end

Returns the value of attribute link.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def name
  @name
end

#player_embed_urlObject (readonly)

Returns the value of attribute player_embed_url.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def player_embed_url
  @player_embed_url
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def type
  @type
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'lib/vimeo_ruby/video.rb', line 3

def user
  @user
end

Class Method Details

.get_video(video_id) ⇒ Object



19
20
21
22
# File 'lib/vimeo_ruby/video.rb', line 19

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