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.



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

def initialize(hash = {})
  super
  @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

#channel_idObject

Returns the value of attribute channel_id.



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

def channel_id
  @channel_id
end

#infoObject

Returns the value of attribute info.



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

def info
  @info
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#trackObject

Returns the value of attribute track.



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

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



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

def broadcast
end

#bumpObject



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

def bump
end

#connectionsObject



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

def connections
end

#outputsObject



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

def outputs
end

#relay_treeObject



56
57
58
# File 'lib/psapi/channel.rb', line 56

def relay_tree
  # tree of sessions
end

#restart_announce(yellow_page) ⇒ Object

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



65
66
# File 'lib/psapi/channel.rb', line 65

def restart_announce(yellow_page)
end

#stopObject



38
39
# File 'lib/psapi/channel.rb', line 38

def stop
end

#stop_announce(yellow_page) ⇒ Object

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



61
62
# File 'lib/psapi/channel.rb', line 61

def stop_announce(yellow_page)
end

#yellow_pagesObject



21
22
23
24
25
26
# File 'lib/psapi/channel.rb', line 21

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