class WowzaRest::Client
Attributes
api_version[RW]
connection[R]
host[RW]
password[RW]
port[RW]
server_name[RW]
username[RW]
vhost[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/wowza_rest/client.rb, line 15 def initialize(options = {}) check_required_attrs(options) options.each do |key, value| instance_variable_set("@#{key}", value) end @connection = WowzaRest::Connection.new(base_uri, @username, @password) end
Public Instance Methods
base_uri()
click to toggle source
# File lib/wowza_rest/client.rb, line 46 def base_uri "#{server_path}/vhosts/#{vhost}" end
server_path()
click to toggle source
# File lib/wowza_rest/client.rb, line 42 def server_path "#{host}:#{port}/#{api_version}/servers/#{server_name}" end
server_status()
click to toggle source
# File lib/wowza_rest/client.rb, line 23 def server_status response = connection.request(:get, '/status', base_uri: server_path) WowzaRest::Data::ServerStatus.new(response.parsed_response) rescue nil end
Private Instance Methods
check_required_attrs(options)
click to toggle source
# File lib/wowza_rest/client.rb, line 52 def check_required_attrs(options) required_attrs = %i[host port username password] missing_attrs = [] required_attrs.each do |attr| missing_attrs << attr unless options.include? attr end return if missing_attrs.empty? raise WowzaRest::Errors::MissingRequiredKeys, "{ #{missing_attrs.join(' | ')} } missing" end