Class: AzureMediaService::AssetDeliveryPolicy

Inherits:
Model::Base
  • Object
show all
Defined in:
lib/azure_media_service/model/asset_delivery_policy.rb

Constant Summary collapse

Protocol =
{
  None:            0x0,
  SmoothStreaming: 0x1,
  Dash:            0x2,
  HLS:             0x4,
  Hds:             0x8,
  All:             0xFFFF
}
PolicyType =
{
  None:                      0,
  Blocked:                   1,
  NoDynamicEncryption:       2,
  DynamicEnvelopeEncryption: 3,
  DynamicCommonEncryption:   4
}
ConfigurationKey =
{
  None:                           0,
  EnvelopeKeyAcquisitionUrl:      1,
  EnvelopeBaseKeyAcquisitionUrl:  2,
  EnvelopeEncryptionIVAsBase64:   3,
  PlayReadyLicenseAcquisitionUrl: 4,
  PlayReadyCustomAttributes:      5,
  EnvelopeEncryptionIV:           6
}

Instance Attribute Summary

Attributes inherited from Model::Base

#original_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model::Base

create_response, #initialize, service

Constructor Details

This class inherits a constructor from AzureMediaService::Model::Base

Class Method Details

.create(name:, protocol:, policy_type:, configuration:) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/azure_media_service/model/asset_delivery_policy.rb', line 33

def create(name:, protocol:, policy_type:, configuration:)
  body = {
    "Name" => name,
    "AssetDeliveryProtocol" => protocol,
    "AssetDeliveryPolicyType" => policy_type,
    "AssetDeliveryConfiguration" => configuration
  }
  create_response(service.post("AssetDeliveryPolicies", body))
end

.get(asset_delivery_policy_id = nil) ⇒ Object



43
44
45
# File 'lib/azure_media_service/model/asset_delivery_policy.rb', line 43

def get(asset_delivery_policy_id=nil)
  service.get("AssetDeliveryPolicies", AssetDeliveryPolicy, asset_delivery_policy_id)
end

Instance Method Details

#deleteObject



48
49
50
51
52
53
54
55
# File 'lib/azure_media_service/model/asset_delivery_policy.rb', line 48

def delete
  begin 
    res = @request.delete("AssetDeliveryPolicies('#{self.Id}')")
  rescue => e
    raise MediaServiceError.new(e.message)
  end
  res
end