Sha256: e0a4f2bf7c1667b11145366232f9d1cbdb61f940c6670e5046adf60c04dae5bb

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

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

      def thumbnail
        cover_url(5)
      end

      def small
        cover_url(1)
      end

      def medium
        cover_url(2)
      end

      def large
        cover_url(3)
      end

      def extra_large
        cover_url(6)
      end

      private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
google-book-0.2.2 lib/google/book/cover.rb
google-book-0.2.1 lib/google/book/cover.rb
google-book-0.2.0 lib/google/book/cover.rb