Sha256: 8464b38be060d6ff0b8c73c5b1b4422e94a9e2327b2041710ab79b32415d69b5

Contents?: true

Size: 491 Bytes

Versions: 5

Compression:

Stored size: 491 Bytes

Contents

module Google
  module Book
    class Cover
      def initialize(url)
        @url = url
      end

      def thumbnail
        urlify(5)
      end

      def small
        urlify(1)
      end

      def medium
        urlify(2)
      end

      def large
        urlify(3)
      end

      def extra_large
        urlify(6)
      end

      private

      def urlify(zoom)
        @url.
          gsub('zoom=5', "zoom=#{zoom}").
          gsub('&edge=curl', '')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
google-book-0.4.0 lib/google/book/cover.rb
google-book-0.3.3 lib/google/book/cover.rb
google-book-0.3.2 lib/google/book/cover.rb
google-book-0.3.1 lib/google/book/cover.rb
google-book-0.3.0 lib/google/book/cover.rb