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.



15
16
17
18
19
20
21
# 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

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

#connectionObject (readonly)

Returns the value of attribute connection.



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

def connection
  @connection
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#server_nameObject

Returns the value of attribute server_name.



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

def server_name
  @server_name
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

#vhostObject

Returns the value of attribute vhost.



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

def vhost
  @vhost
end

Instance Method Details

#base_uriObject



46
47
48
# File 'lib/wowza_rest/client.rb', line 46

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

#server_pathObject



42
43
44
# File 'lib/wowza_rest/client.rb', line 42

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

#server_statusObject



23
24
25
26
27
28
# 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