Class: Icecast::Server
- Inherits:
-
Object
- Object
- Icecast::Server
- Includes:
- HTTParty
- Defined in:
- lib/icecast/server.rb
Defined Under Namespace
Classes: NullCache, Status, StreamStatus
Constant Summary collapse
- @@cache =
default_cache
Instance Attribute Summary collapse
-
#admin_password ⇒ Object
Returns the value of attribute admin_password.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
- #authentification ⇒ Object
-
#initialize(attributes = {}) ⇒ Server
constructor
A new instance of Server.
- #status ⇒ Object
- #url_for(path) ⇒ Object
- #xml_status ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
10 11 12 13 14 |
# File 'lib/icecast/server.rb', line 10 def initialize(attributes = {}) attributes.each do |k,v| send "#{k}=", v end end |
Instance Attribute Details
#admin_password ⇒ Object
Returns the value of attribute admin_password.
8 9 10 |
# File 'lib/icecast/server.rb', line 8 def admin_password @admin_password end |
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/icecast/server.rb', line 8 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/icecast/server.rb', line 8 def port @port end |
Class Method Details
Instance Method Details
#authentification ⇒ Object
20 21 22 |
# File 'lib/icecast/server.rb', line 20 def authentification { :username => 'admin', :password => admin_password } end |
#status ⇒ Object
46 47 48 |
# File 'lib/icecast/server.rb', line 46 def status Status.new xml_status end |
#url_for(path) ⇒ Object
16 17 18 |
# File 'lib/icecast/server.rb', line 16 def url_for(path) "http://#{host}:8000/#{path}" end |
#xml_status ⇒ Object
39 40 41 42 43 44 |
# File 'lib/icecast/server.rb', line 39 def xml_status cache.fetch("Icecast::Status::#{host}_#{port}", :expires_in => 60, :race_condition_ttl => 5) do Icecast.logger.info "Retrieve Icecast status from #{host}" self.class.get url_for("admin/stats"), :basic_auth => authentification end end |