Class: Nelumba::Video

Inherits:
Object
  • Object
show all
Includes:
Object
Defined in:
lib/nelumba/video.rb

Constant Summary

Constants included from Object

Object::USERNAME_REGULAR_EXPRESSION

Instance Attribute Summary collapse

Attributes included from Object

#author, #content, #display_name, #html, #image, #published, #summary, #text, #title, #uid, #updated, #url

Instance Method Summary collapse

Methods included from Object

#mentions, #reply_to, #to_as1, #to_html, #to_json, #to_text

Constructor Details

#initialize(options = {}, &blk) ⇒ Video

Creates a new Video activity object.



14
15
16
# File 'lib/nelumba/video.rb', line 14

def initialize(options = {}, &blk)
  init(options, &blk)
end

Instance Attribute Details

#embed_codeObject (readonly)

A fragment of HTML markup that, when embedded within another HTML page, provides an interactive user-interface for viewing or listening to the video stream.



8
9
10
# File 'lib/nelumba/video.rb', line 8

def embed_code
  @embed_code
end

#streamObject (readonly)

A MediaLink to the video content itself.



11
12
13
# File 'lib/nelumba/video.rb', line 11

def stream
  @stream
end

Instance Method Details

#init(options = {}, &blk) ⇒ Object



18
19
20
21
22
23
# File 'lib/nelumba/video.rb', line 18

def init(options = {}, &blk)
  super(options, &blk)

  @embed_code = options[:embed_code]
  @stream     = options[:stream]
end

#to_hashObject

Returns a hash of all relevant fields.



26
27
28
29
30
31
# File 'lib/nelumba/video.rb', line 26

def to_hash
  {
    :embed_code => @embed_code,
    :stream     => @stream
  }.merge(super)
end

#to_json_hashObject

Returns a hash of all relevant fields with JSON activity streams conventions.



35
36
37
38
39
40
41
# File 'lib/nelumba/video.rb', line 35

def to_json_hash
  {
    :objectType => "video",
    :embedCode  => @embed_code,
    :stream     => @stream
  }.merge(super)
end