lib/sorenson/services/asset.rb in 360_services-1.0.5 vs lib/sorenson/services/asset.rb in 360_services-1.0.6
- 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, :groups, :embed_list, :group_id
+ :password, :metadata, :embed_list, :group_id
# 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}
@@ -39,11 +39,13 @@
def self.count
Base.get_from("/assets/count")["count"]
end
def self.find(id)
- new(get_from("/assets/#{id}"))
+ data = get_from("/assets/#{id}")
+ return nil if data[:status].eql?('invalid asset id')
+ new(data)
end
def preset_xml
Base.get_from("/assets/#{id}/preset_xml")["preset_xml"]
end
@@ -115,9 +117,16 @@
end
def group
return nil if @group_id.nil?
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")
+ @group_id = group.id
+ end
end
def initialize(data)
@encode_date = data['encode_date']
@frame_rate = data['frame_rate']
\ No newline at end of file