lib/sorenson/services/asset.rb in 360_services-1.0.8 vs lib/sorenson/services/asset.rb in 360_services-1.0.9
- old
+ new
@@ -9,11 +9,11 @@
attr_accessor :encode_date, :frame_rate, :height, :date_last_modified, :video_bitrate_mode,
:media_type, :id, :account_id, :number_of_views, :application, :audio_codec,
:permalink_location, :status, :description, :video_duration, :abstract_file_id, :version_id,
:date_retrieved, :audio_data_rate, :audio_bitrate_mode, :video_codec, :display_name, :name,
:video_data_rate, :author_id, :width, :file_size, :thumbnail_image_url, :direct_asset_url,
- :password, :metadata, :embed_list, :group_id
+ :password, :metadata, :embed_list, :group_id, :video_guid, :streaming_server_and_video_path
# Get all of the assets as a list of guids. Use offset and quantity to return subsets.
# Sorenson::Services::Account.login('username', 'password')
# assets = Sorenson::Services::Asset.all
# names = assets.collect {|asset| asset.name}
@@ -121,15 +121,26 @@
Group.new(Base.get_from("/groups/#{group_id}")['group'])
end
def add_group(group)
data = Base.put_to("/groups/#{group.id}/assets/#{id}")
- if data["status"].eql?("Success")
+ if data['status'].eql?('Success')
@group_id = group.id
+ else
+ data['status']
end
end
+ def streaming_server_and_video_path
+ data = Base.get_from("/videos/#{id}/streaming_url")
+ if data['status'].eql?("not found")
+ nil
+ else
+ data
+ end
+ end
+
def initialize(data)
@encode_date = data['encode_date']
@frame_rate = data['frame_rate']
@height = data['height']
@date_last_modified = data['date_last_modified']
@@ -158,9 +169,10 @@
@file_size = data['file_size']
@thumbnail_image_url = data['thumbnail_image_url']
@direct_asset_url = data['direct_asset_url']
@group_id = data['group_id']
@embed_list = data['embed_list']
+ @video_guid = @embed_list.empty? ? nil : @embed_list.first[1].match(/videoGUID=(.*?)&/)[1]
end
end
end
end
\ No newline at end of file