Class: Psapi::Channel

Inherits:
API_Object show all
Defined in:
lib/psapi/channel.rb

Defined Under Namespace

Classes: Connection, Info, Output, Status, Track

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from API_Object

accessors_for, define_all_with, inherited, #mass_assign

Methods included from Internal

camel_to_snake

Methods included from PeercastStation

initialize, #method_missing

Constructor Details

#initialize(hash = {}) ⇒ Channel

Returns a new instance of Channel.



11
12
13
14
15
16
17
# File 'lib/psapi/channel.rb', line 11

def initialize(hash = {})
  @status = Status.new(hash['status'] || {})
  @info   = Info.new(hash['info'] || {})
  @track  = Track.new(hash['track'])

  @yellow_pages = (hash['yellowPages'] || [])
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Psapi::PeercastStation

Instance Attribute Details

#infoObject

Returns the value of attribute info.



8
9
10
# File 'lib/psapi/channel.rb', line 8

def info
  @info
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/psapi/channel.rb', line 8

def status
  @status
end

#trackObject

Returns the value of attribute track.



9
10
11
# File 'lib/psapi/channel.rb', line 9

def track
  @track
end

Class Method Details

.find(id) ⇒ Object



4
5
6
# File 'lib/psapi/channel.rb', line 4

def self.find(id)
  Channel.new({ 'channelId' => id, 'status' => getChannelStatus(id) }.merge(getChannelInfo(id)))
end

Instance Method Details

#broadcastObject



45
46
# File 'lib/psapi/channel.rb', line 45

def broadcast
end

#bumpObject



48
49
# File 'lib/psapi/channel.rb', line 48

def bump
end

#connectionsObject



42
43
# File 'lib/psapi/channel.rb', line 42

def connections
end

#outputsObject



51
52
# File 'lib/psapi/channel.rb', line 51

def outputs
end

#relay_treeObject



54
55
56
# File 'lib/psapi/channel.rb', line 54

def relay_tree
  # tree of sessions
end

#restart_announce(yellow_page) ⇒ Object

このチャンネルの yellow_page へのアナウンス接続をはりなおす



63
64
# File 'lib/psapi/channel.rb', line 63

def restart_announce(yellow_page)
end

#stopObject



36
37
# File 'lib/psapi/channel.rb', line 36

def stop
end

#stop_announce(yellow_page) ⇒ Object

このチャンネルの yellow_page へのアナウンス接続を切断する



59
60
# File 'lib/psapi/channel.rb', line 59

def stop_announce(yellow_page)
end

#yellow_pagesObject



19
20
21
22
23
24
# File 'lib/psapi/channel.rb', line 19

def yellow_pages
  yps = YellowPage.all
  @yellow_pages.map { |yellowPageId:|
    yps.find { |y| y.yellow_page_id == yellowPageId } or fail "yellow page id #{yellowPageId} not found"
  }
end