From 76cb6645a54969edc7c9195e9e27e3728f5fd683 Mon Sep 17 00:00:00 2001 From: Nidev Plontra Date: Fri, 6 Feb 2015 19:51:50 +0900 Subject: [PATCH] Add Twitter::Media::AnimatedGif media entity. --- lib/twitter/media/animatedgif.rb | 9 +++++++++ lib/twitter/media/photo.rb | 3 +-- lib/twitter/media_factory.rb | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/twitter/media/animatedgif.rb diff --git a/lib/twitter/media/animatedgif.rb b/lib/twitter/media/animatedgif.rb new file mode 100644 index 000000000..055953591 --- /dev/null +++ b/lib/twitter/media/animatedgif.rb @@ -0,0 +1,9 @@ +require 'twitter/identity' +require 'twitter/media/photo' + +module Twitter + module Media + class AnimatedGif < Photo + end + end +end diff --git a/lib/twitter/media/photo.rb b/lib/twitter/media/photo.rb index 5e40e35b2..fa5ec3b90 100644 --- a/lib/twitter/media/photo.rb +++ b/lib/twitter/media/photo.rb @@ -12,9 +12,8 @@ class Photo < Twitter::Identity # # @return [Array] def sizes - @attrs.fetch(:sizes, []).inject({}) do |object, (key, value)| + @attrs.fetch(:sizes, []).each_with_object({}) do |(key, value), object| object[key] = Size.new(value) - object end end memoize :sizes diff --git a/lib/twitter/media_factory.rb b/lib/twitter/media_factory.rb index 31cf8ddbe..31477a134 100644 --- a/lib/twitter/media_factory.rb +++ b/lib/twitter/media_factory.rb @@ -1,5 +1,7 @@ require 'twitter/factory' require 'twitter/media/photo' +require 'twitter/media/animatedgif' +require 'twitter/media/video' module Twitter class MediaFactory < Twitter::Factory