Sha256: 4e85d355237c8aa5ed1662a3cb6b260f10d90ec1ae3839f3b3dfa2bcbb5c73eb

Contents?: true

Size: 886 Bytes

Versions: 4

Compression:

Stored size: 886 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

      # @return [String]
      attr_reader :type

      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, []).each_with_object({}) do |(key, value), object|
          object[key] = Size.new(value)
        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

4 entries across 4 versions & 1 rubygems

Version Path
twitter-8.1.0 lib/twitter/media/video.rb
twitter-8.0.1 lib/twitter/media/video.rb
twitter-8.0.0 lib/twitter/media/video.rb
twitter-8.0.0.rc.1 lib/twitter/media/video.rb