Module: Psapi::PeercastStation

Included in:
Psapi, API_Object, BroadcastHistory
Defined in:
lib/psapi/peercast_station.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*_args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/psapi/peercast_station.rb', line 12

def method_missing(*_args, &block)
  name, *args = _args

  helper = PeercastStation.instance_variable_get(:@helper)
  if args.size == 1 and args[0].is_a? Hash
    helper.process_call(name, *args, &block)
  else
    helper.process_call(name, args, &block)
  end
rescue Jimson::Client::Error::ServerError => e
  STDERR.puts("method: #{name}, args: #{args.inspect}")
  fail
end

Class Method Details

.initialize(host, port) ⇒ Object



6
7
8
# File 'lib/psapi/peercast_station.rb', line 6

def initialize(host, port)
  @helper = Jimson::ClientHelper.new("http://#{host}:#{port}/api/1")
end