Module: WowzaRest::Applications
- Included in:
- API
- Defined in:
- lib/wowza_rest/applications.rb
Instance Method Summary collapse
- #applications ⇒ Object
- #create_application(app_body, use_default_config = true) ⇒ Object
- #delete_application(app_name) ⇒ Object
- #get_application(app_name) ⇒ Object (also: #application)
- #update_application(app_name, config) ⇒ Object
Instance Method Details
#applications ⇒ Object
6 7 8 9 10 11 |
# File 'lib/wowza_rest/applications.rb', line 6 def applications response = connection.request(:get, '/applications') return unless response.code == 200 response.parsed_response['applications'] .map { |e| WowzaRest::Data::ApplicationShort.new(e) } end |
#create_application(app_body, use_default_config = true) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wowza_rest/applications.rb', line 20 def create_application(app_body, use_default_config = true) unless app_body.include?(:name) && app_body.include?(:appType) raise WowzaRest::Errors::MissingRequiredKeys, '{ name } and/or { appType } Keys on application hash is required' end if use_default_config app_body = default_application_config.merge(app_body) end connection.request(:post, '/applications', body: app_body.to_json) end |
#delete_application(app_name) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/wowza_rest/applications.rb', line 37 def delete_application(app_name) unless app_name.is_a?(String) raise WowzaRest::Errors::InvalidArgumentType, "First argument expected to be String got #{app_name.class}" end connection.request(:delete, "/applications/#{app_name}")['success'] end |
#get_application(app_name) ⇒ Object Also known as: application
13 14 15 16 17 |
# File 'lib/wowza_rest/applications.rb', line 13 def get_application(app_name) response = connection.request(:get, "/applications/#{app_name}") return unless response.code == 200 WowzaRest::Data::Application.new(response.parsed_response) end |
#update_application(app_name, config) ⇒ Object
31 32 33 34 35 |
# File 'lib/wowza_rest/applications.rb', line 31 def update_application(app_name, config) apply_update_application_checks(app_name, config) connection.request(:put, "/applications/#{app_name}", body: config.to_json)['success'] end |