Class: AzureMediaService::Locator

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

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(policy_id:, asset_id:, type: 1) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/azure_media_service/model/locator.rb', line 5

def create(policy_id:,asset_id:,type:1)
  post_body = {
    "AccessPolicyId" => policy_id,
    "AssetId" => asset_id,
    "Type" => type,
    "StartTime" => (Time.now - 5*60).gmtime.strftime('%Y-%m-%dT%H:%M:%SZ')
  }
  create_response(service.post("Locators", post_body))
end

Instance Method Details

#deleteObject



16
17
18
19
20
21
22
23
24
# File 'lib/azure_media_service/model/locator.rb', line 16

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