Class: WowzaRest::Client

Inherits:
Object
  • Object
show all
Includes:
API, Errors
Defined in:
lib/wowza_rest/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Publishers

#create_publisher, #delete_publisher

Methods included from Instances

#get_incoming_stream_stats, #get_instance, #instances

Methods included from Applications

#applications, #create_application, #delete_application, #get_application, #update_application

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
20
# File 'lib/wowza_rest/client.rb', line 14

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

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def api_version
  @api_version
end

#connectionObject (readonly)

Returns the value of attribute connection.



12
13
14
# File 'lib/wowza_rest/client.rb', line 12

def connection
  @connection
end

#hostObject

Returns the value of attribute host.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def host
  @host
end

#passwordObject

Returns the value of attribute password.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def password
  @password
end

#portObject

Returns the value of attribute port.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def port
  @port
end

#server_nameObject

Returns the value of attribute server_name.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def server_name
  @server_name
end

#usernameObject

Returns the value of attribute username.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def username
  @username
end

#vhostObject

Returns the value of attribute vhost.



10
11
12
# File 'lib/wowza_rest/client.rb', line 10

def vhost
  @vhost
end

Instance Method Details

#base_uriObject



44
45
46
# File 'lib/wowza_rest/client.rb', line 44

def base_uri
  "#{server_path}/vhosts/#{vhost}"
end

#server_pathObject



40
41
42
# File 'lib/wowza_rest/client.rb', line 40

def server_path
  "#{host}:#{port}/#{api_version}/servers/#{server_name}"
end

#server_statusObject



22
23
24
25
26
# File 'lib/wowza_rest/client.rb', line 22

def server_status
  connection.request(:get, '/status', base_uri: server_path).parsed_response
rescue
  nil
end