Class: Nelumba::Audio

Inherits:
Object
  • Object
show all
Includes:
Object
Defined in:
lib/nelumba/audio.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

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

Constructor Details

#initialize(options = {}) ⇒ Audio

Creates a new Audio activity object.



14
15
16
17
18
19
# File 'lib/nelumba/audio.rb', line 14

def initialize(options = {})
  super options

  @embed_code = options[:embed_code]
  @stream     = options[:stream]
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 audio stream.



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

def embed_code
  @embed_code
end

#streamObject (readonly)

A MediaLink to the audio content itself.



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

def stream
  @stream
end

Instance Method Details

#to_hashObject

Returns a hash of all relevant fields.



22
23
24
25
26
27
# File 'lib/nelumba/audio.rb', line 22

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.



31
32
33
34
35
36
37
# File 'lib/nelumba/audio.rb', line 31

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