Sha256: 8f3339b9a26f2ae83b5f3b5640a936c8621c3c0ccfe2250e618c8f4f23f7abbb

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

module Tumblr
  class Post
    class Photo < Post
      def initialize(post_data = {})
        super(post_data)
        @type = :photo
        @source ||= first_photo_url_from_response
      end

      def caption
        @caption
      end

      def link
        @link
      end

      def source
        @source
      end

      def data
        @data
      end

      def first_photo_url_from_response
        @photos.first["original_size"]["url"] if @photos and !@photos.empty?
      end

      def self.post_body_keys
        [:source, :caption]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tumblr-rb-2.1.1 lib/tumblr/post/photo.rb
tumblr-rb-2.1.0 lib/tumblr/post/photo.rb
tumblr-rb-2.0.0 lib/tumblr/post/photo.rb
tumblr-rb-2.0.0.alpha lib/tumblr/post/photo.rb