Class: Sorenson::ThreeSixty::Asset
- Defined in:
- lib/sorenson/threesixty/asset.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#abstractFileId ⇒ Object
Attributes.
-
#account ⇒ Object
Attributes.
-
#accountId ⇒ Object
Attributes.
-
#application ⇒ Object
Attributes.
-
#audioBitrateMode ⇒ Object
Attributes.
-
#audioCodec ⇒ Object
Attributes.
-
#audioDataRate ⇒ Object
Attributes.
-
#authorId ⇒ Object
Attributes.
-
#dateLastModified ⇒ Object
Attributes.
-
#dateRetrieved ⇒ Object
Attributes.
-
#defaultEmbed ⇒ Object
Attributes.
-
#description ⇒ Object
Attributes.
-
#directAssetUrl ⇒ Object
Attributes.
-
#displayName ⇒ Object
Attributes.
-
#embedList ⇒ Object
Attributes.
-
#encodeDate ⇒ Object
Attributes.
-
#fileSize ⇒ Object
Attributes.
-
#filters ⇒ Object
Attributes.
-
#frameRate ⇒ Object
Attributes.
-
#height ⇒ Object
Attributes.
-
#httpLocation ⇒ Object
Attributes.
-
#id ⇒ Object
Attributes.
-
#mediaType ⇒ Object
Attributes.
-
#name ⇒ Object
Attributes.
-
#numberOfViews ⇒ Object
Attributes.
-
#permalinkLocation ⇒ Object
Attributes.
-
#presetXml ⇒ Object
Attributes.
-
#status ⇒ Object
Attributes.
-
#subaccountId ⇒ Object
Attributes.
-
#thumbnailImageUrl ⇒ Object
Attributes.
-
#versionId ⇒ Object
Attributes.
-
#videoBitrateMode ⇒ Object
Attributes.
-
#videoCodec ⇒ Object
Attributes.
-
#videoDataRate ⇒ Object
Attributes.
-
#videoDuration ⇒ Object
Attributes.
-
#videoGuid ⇒ Object
Attributes.
-
#width ⇒ Object
Attributes.
Class Method Summary collapse
- .find(account, id) ⇒ Object
-
.find_all(account, offset = nil, quantity = nil) ⇒ Object
Class Methods.
- .get_embed_codes(video_guid, sessionId, account) ⇒ Object
- .get_streaming_server_url ⇒ Object
Instance Method Summary collapse
- #activate ⇒ Object
- #deactivate ⇒ Object
- #delete ⇒ Object
- #get_streaming_video_path ⇒ Object
- #getAllSubaccounts ⇒ Object
-
#initialize(account, data) ⇒ Asset
constructor
Instance Methods.
- #setDescription(description) ⇒ Object
- #setName(name) ⇒ Object
- #setPassword(password) ⇒ Object
Methods inherited from Base
debug=, debug?, host, #post_to, post_to, protocol, token_for, use_ssl=, use_ssl?
Constructor Details
#initialize(account, data) ⇒ Asset
Instance Methods
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/sorenson/threesixty/asset.rb', line 36 def initialize(account, data) self.account = account self.presetXml = data['presetXml'] self.subaccountId = data['subaccountId'] self.encodeDate = data['encodeDate'] self.frameRate = data['frameRate'] self.height = data['height'] self.dateLastModified = data['dateLastModified'] self.videoBitrateMode = data['videoBitrateMode'] self.mediaType = data['mediaType'] self.id = data['id'] self.accountId = data['accountId'] self.numberOfViews = data['numberOfViews'] self.application = data['application'] self.audioCodec = data['audioCodec'] self.permalinkLocation = data['permalink'] self.status = data['status'] self.description = data['description'] self.videoDuration = data['videoDuration'] self.abstractFileId = data['abstractFileId'] self.versionId = data['versionId'] self.dateRetrieved = data['dateRetrieved'] self.audioDataRate = data['audioDataRate'] self.audioBitrateMode = data['audioBitrateMode'] self.videoCodec = data['videoCodec'] self.displayName = data['displayName'] self.name = data['name'] self.videoDataRate = data['videoDataRate'] self. = data['authorId'] self.width = data['width'] self.fileSize = data['fileSize'] self.thumbnailImageUrl = data['thumbnail']['httpLocation'] if data['thumbnail'] self.thumbnailImageUrl = data['thumbLocation'] if data['thumbLocation'] self.httpLocation = data['httpLocation'] self.directAssetUrl = "http://360.sorensonmedia.com/redirector/fetchFile?vguid=#{self.id}" self.videoGuid self.filters = [] if data['filters'] data['filters'].each do |filter| self.filters << filter['filterDescription'] end end self. = {} self.videoGuid = self..empty? ? nil : self..to_a.first[1].match(/videoGUID=(.*?)&/)[1] end |
Instance Attribute Details
#abstractFileId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def abstractFileId @abstractFileId end |
#account ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def account @account end |
#accountId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def accountId @accountId end |
#application ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def application @application end |
#audioBitrateMode ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def audioBitrateMode @audioBitrateMode end |
#audioCodec ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def audioCodec @audioCodec end |
#audioDataRate ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def audioDataRate @audioDataRate end |
#authorId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def @authorId end |
#dateLastModified ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def dateLastModified @dateLastModified end |
#dateRetrieved ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def dateRetrieved @dateRetrieved end |
#defaultEmbed ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def defaultEmbed @defaultEmbed end |
#description ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def description @description end |
#directAssetUrl ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def directAssetUrl @directAssetUrl end |
#displayName ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def displayName @displayName end |
#embedList ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def @embedList end |
#encodeDate ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def encodeDate @encodeDate end |
#fileSize ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def fileSize @fileSize end |
#filters ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def filters @filters end |
#frameRate ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def frameRate @frameRate end |
#height ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def height @height end |
#httpLocation ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def httpLocation @httpLocation end |
#id ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def id @id end |
#mediaType ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def mediaType @mediaType end |
#name ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def name @name end |
#numberOfViews ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def numberOfViews @numberOfViews end |
#permalinkLocation ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def permalinkLocation @permalinkLocation end |
#presetXml ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def presetXml @presetXml end |
#status ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def status @status end |
#subaccountId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def subaccountId @subaccountId end |
#thumbnailImageUrl ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def thumbnailImageUrl @thumbnailImageUrl end |
#versionId ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def versionId @versionId end |
#videoBitrateMode ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def videoBitrateMode @videoBitrateMode end |
#videoCodec ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def videoCodec @videoCodec end |
#videoDataRate ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def videoDataRate @videoDataRate end |
#videoDuration ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def videoDuration @videoDuration end |
#videoGuid ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def videoGuid @videoGuid end |
#width ⇒ Object
Attributes
6 7 8 |
# File 'lib/sorenson/threesixty/asset.rb', line 6 def width @width end |
Class Method Details
.find(account, id) ⇒ Object
21 22 23 24 |
# File 'lib/sorenson/threesixty/asset.rb', line 21 def self.find(account, id) data = post_to("/api/getAsset?mguid=#{id}&sessionId=#{account.sessionId}") Asset.new(account, data['media'].merge({'thumbLocation' => data['thumbLocation'], 'permalink' => data['permalinkLocation']})) end |
.find_all(account, offset = nil, quantity = nil) ⇒ Object
Class Methods
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sorenson/threesixty/asset.rb', line 9 def self.find_all(account, offset = nil, quantity = nil) data = post_to("/api/getMediaList?offset=#{offset}&quantity=#{quantity}&accountId=#{account.id}&sessionId=#{account.sessionId}&status=Live&sort=uploadDate") assets = [] data['mediaList'].each do |entry| assets << Asset.new(account, entry) if account.subaccountId.blank? || account.subaccountId == entry['subaccountId'] end assets end |
.get_embed_codes(video_guid, sessionId, account) ⇒ Object
26 27 28 29 |
# File 'lib/sorenson/threesixty/asset.rb', line 26 def self.(video_guid, sessionId, account) data = post_to("/api/getAllEmbedcodes?vguid=#{video_guid}&sessionId=#{account.sessionId}") data['embedList'] end |
.get_streaming_server_url ⇒ Object
31 32 33 |
# File 'lib/sorenson/threesixty/asset.rb', line 31 def self.get_streaming_server_url "rtmp://cdnstreamingvideos.sorensonmedia.com/cfx/st" end |
Instance Method Details
#activate ⇒ Object
99 100 101 |
# File 'lib/sorenson/threesixty/asset.rb', line 99 def activate data = post_to("/api/activateAsset?fileVersionId=#{id}&sessionId=#{account.sessionId}") end |
#deactivate ⇒ Object
95 96 97 |
# File 'lib/sorenson/threesixty/asset.rb', line 95 def deactivate data = post_to("/api/deactivateAsset?fileVersionId=#{id}&sessionId=#{account.sessionId}") end |
#delete ⇒ Object
91 92 93 |
# File 'lib/sorenson/threesixty/asset.rb', line 91 def delete data = post_to("/api/deleteAsset?fileVersionId=#{id}&sessionId=#{account.sessionId}") end |
#get_streaming_video_path ⇒ Object
86 87 88 89 |
# File 'lib/sorenson/threesixty/asset.rb', line 86 def get_streaming_video_path data = post_to("/api/getPlayerData?vguid=#{self.videoGuid}&cms=true") data['media']['accessLocation']['s3KeyName'] end |
#getAllSubaccounts ⇒ Object
121 122 123 124 |
# File 'lib/sorenson/threesixty/asset.rb', line 121 def getAllSubaccounts data = post_to("/api/getAllSubaccount?accountId=#{id}&sessionId=#{sessionId}") data end |
#setDescription(description) ⇒ Object
107 108 109 |
# File 'lib/sorenson/threesixty/asset.rb', line 107 def setDescription(description) data = post_to("/api/setAssetDescription?fileVersionId=#{id}&newDescription=#{description}&sessionId=#{account.sessionId}") end |
#setName(name) ⇒ Object
103 104 105 |
# File 'lib/sorenson/threesixty/asset.rb', line 103 def setName(name) data = post_to("/api/setAssetName?fileVersionId=#{id}&newName=#{name}&sessionId=#{account.sessionId}") end |
#setPassword(password) ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'lib/sorenson/threesixty/asset.rb', line 111 def setPassword(password) data = nil if password == '' || password.nil? data = post_to("/api/removeAssetSecurity?fileVersionId=#{id}&security=#{password}&sessionId=#{account.sessionId}") else data = post_to("/api/setAssetSecurity?fileVersionId=#{id}&security=#{password}&sessionId=#{account.sessionId}") end data end |