wowza_rest 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ec144a5f9422b5be4d8b7d81bbaae75edd6ee06
4
- data.tar.gz: 9d3f98a07919d7a6a90d9d589a3543d78b31b285
3
+ metadata.gz: ca17e08c1c61bebc58e894af37d23e548cfd86c8
4
+ data.tar.gz: baa635c119d37463b793d222505d527909d29ca9
5
5
  SHA512:
6
- metadata.gz: c9701aed6a548562fde18d45e1342b26eef6b419cef04d106cf566247644ed5ca5e92bf3bf7af38ef6914d3c778e802712b231ab6a8593b711264e763125c256
7
- data.tar.gz: 20db8c2a418dfb1f1b109dcff7e754e3bc4ce4ed24f4528671904b7e61e3def0d6fa9326df9fcf9bdd4c3d30b10f70b8917f063eae39358e631bb3c708e6e13f
6
+ metadata.gz: b9b3c1bc4807823c8050573da246bb501a3b6cca7b316fdeb41f03d705239955bfc7707f7d2426852b26114e35c13df9db4b29e335c21a7ab1e7ed2a52c28ae0
7
+ data.tar.gz: 22d621a5c5228d953da4a789e02ff2ff13d69f4f6538d7ceafd1b00c23776373601314d29bc3d10d7b83f5d8b8f18c429c188e4be88d87c382116e89db62a52d
data/README.md CHANGED
@@ -3,9 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/hazemtaha/wowza-rest.svg?branch=master)](https://travis-ci.org/hazemtaha/wowza-rest)
4
4
  [![Code Climate](https://codeclimate.com/github/hazemtaha/wowza_rest/badges/gpa.svg)](https://codeclimate.com/github/hazemtaha/wowza_rest)
5
5
 
6
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/wowza_rest`. To experiment with that code, run `bin/console` for an interactive prompt.
7
-
8
- TODO: Delete this and the text above, and describe your gem
6
+ Ruby wrapper for Wowza Streaming Engine Rest API
9
7
 
10
8
  ## Installation
11
9
 
@@ -25,7 +23,68 @@ Or install it yourself as:
25
23
 
26
24
  ## Usage
27
25
 
28
- TODO: Write usage instructions here
26
+ Create Client:
27
+ ```ruby
28
+ client = WowzaRest::Client.new(
29
+ host: 'WOWZA_ENGINE_IP_OR_URL',
30
+ port: 'PORT_NUMBER',
31
+ username: 'WOWZA_ENGINE_USERNAME',
32
+ password: 'WOWZA_ENGINE_PASSWORD'
33
+ )
34
+ ```
35
+
36
+ #### Applications
37
+ - List All Applications
38
+ ```ruby
39
+ applications = client.applications
40
+ ```
41
+ - Fetch single application
42
+ ```ruby
43
+ application = client.get_application('APPLICATION_NAME')
44
+ ```
45
+ - Create a new application
46
+ ```ruby
47
+ client.create_application({
48
+ name: 'APPLICATION_NAME',
49
+ appType: 'LIVE|VOD'
50
+ })
51
+ ```
52
+ - Update Application
53
+ ```ruby
54
+ client.update_application('APPLICATION_NAME', {
55
+ # ... configs to be updated
56
+ })
57
+ ```
58
+ - Delete Application
59
+ ```ruby
60
+ client.delete_application('APPLICATION_NAME')
61
+ ```
62
+
63
+ ### Instances
64
+ - List all instances for an application
65
+ ```ruby
66
+ client.instances('APPLICATION_NAME')
67
+ ```
68
+ - Fetch single instance
69
+ ```ruby
70
+ client.get_instance('APPLICATION_NAME', 'INSTANCE_NAME')
71
+ # instance name can be ommited and defaults to the default instance
72
+ ```
73
+ - Get a single incoming stream monitoring stats
74
+ ```ruby
75
+ client.get_incoming_stream_stat('APPLICATION_NAME', 'STREAM_NAME', 'INSTANCE_NAME')
76
+ # instance name can be ommited and defaults to the default instance
77
+ ```
78
+
79
+ ### Publishers
80
+ - Create publisher (Wowza SE Source)
81
+ ```ruby
82
+ client.create_publisher('PUBLISHER_NAME', 'PUBLISHER_PASSWORD')
83
+ ```
84
+ - Delete publisher (Wowza SE Source)
85
+ ```ruby
86
+ client.delete_publisher('PUBLISHER_NAME')
87
+ ```
29
88
 
30
89
  ## Development
31
90
 
@@ -35,7 +94,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
35
94
 
36
95
  ## Contributing
37
96
 
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/wowza_rest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
97
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hazemtaha/wowza-rest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
98
 
40
99
 
41
100
  ## License
@@ -19,6 +19,15 @@ module WowzaRest
19
19
  @connection = WowzaRest::Connection.new(base_uri, @username, @password)
20
20
  end
21
21
 
22
+ def server_status
23
+ connection.class.base_uri "#{server_path}"
24
+ begin
25
+ connection.request(:get, '/status').parsed_response
26
+ rescue
27
+ nil
28
+ end
29
+ end
30
+
22
31
  def server_name
23
32
  @server_name || '_defaultServer_'
24
33
  end
@@ -31,8 +40,12 @@ module WowzaRest
31
40
  @vhost || '_defaultVHost_'
32
41
  end
33
42
 
43
+ def server_path
44
+ "#{host}:#{port}/#{api_version}/servers/#{server_name}"
45
+ end
46
+
34
47
  def base_uri
35
- "#{host}:#{port}/#{api_version}/servers/#{server_name}/vhosts/#{vhost}"
48
+ "#{server_path}/vhosts/#{vhost}"
36
49
  end
37
50
 
38
51
  private
@@ -1,3 +1,3 @@
1
1
  module WowzaRest
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wowza_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hazem Taha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler