./lib/animoto/resources/storyboard.rb in animoto-0.1.1.beta1 vs ./lib/animoto/resources/storyboard.rb in animoto-1.0.0

- old
+ new

@@ -1,20 +1,36 @@ module Animoto module Resources class Storyboard < Animoto::Resources::Base - # @return [Hash<Symbol,Object>] + # @private + # @return [Hash{String=>Object}] + # @see Animoto::Support::Support::ClassMethods#unpack_standard_envelope + def self.unpack_metadata body = {} + unpack_payload(body)['metadata'] || {} + end + + # @return [Hash{Symbol=>Object}] # @see Animoto::Support::StandardEnvelope::ClassMethods#unpack_standard_envelope def self.unpack_standard_envelope body = {} + metadata = unpack_metadata(body) super.merge({ - :duration => body['response']['payload'][payload_key]['metadata']['duration'], - :visuals_count => body['response']['payload'][payload_key]['metadata']['visuals_count'], - :preview_url => body['response']['payload'][payload_key]['links']['preview'] + :duration => metadata['duration'], + :visuals_count => metadata['visuals_count'], + :preview_url => unpack_links(body)['preview'] }) end + # The duration (in seconds) that the video, once rendered, will be. + # @return [Float] attr_reader :duration + + # The number of visuals (title cards, images, etc.) in this storyboard. + # @return [Integer] attr_reader :visuals_count + + # If available, the URL to the low-resolution 'preview' video. + # @return [String] attr_reader :preview_url # Sets the attributes for a new storyboard. # # @param [Hash] attributes \ No newline at end of file