Sha256: cc693448a3fcf76282bc785f8b04ed2a63c14fd3ac9dff6c15d22076cccbff2a

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

require 'memoizable'
require 'twitter/identity'
require 'twitter/media/video_info'

module Twitter
  module Media
    class Video < Twitter::Identity
      include Memoizable

      # @return [Array<Integer>]
      attr_reader :indices
      display_uri_attr_reader
      uri_attr_reader :expanded_uri, :media_uri, :media_uri_https, :uri

      # Returns an array of photo sizes
      #
      # @return [Array<Twitter::Size>]
      def sizes
        @attrs.fetch(:sizes, []).inject({}) do |object, (key, value)|
          object[key] = Size.new(value)
          object
        end
      end
      memoize :sizes

      # Returns video info
      #
      # @return [Twitter::Media::VideoInfo]
      def video_info
        VideoInfo.new(@attrs[:video_info]) unless @attrs[:video_info].nil?
      end
      memoize :video_info
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter-5.17.0 lib/twitter/media/video.rb
twitter-5.16.0 lib/twitter/media/video.rb
twitter-5.15.0 lib/twitter/media/video.rb