class Imgurapi::Image
Constants
- IMAGE_EXTENSION
- IMGUR_HOST
Public Instance Methods
link(use_ssl = false)
click to toggle source
# File lib/imgurapi/models/image.rb, line 7 def link(use_ssl = false) protocol = if use_ssl 'https://' else 'http://' end "#{protocol}#{IMGUR_HOST}/#{id}.#{IMAGE_EXTENSION}" end
url(size: nil, use_ssl: false)
click to toggle source
Provides the download URL in case you know a valid imgur hash and don't want to make a network trip with .find Just in case you don't need the full Imgurapi::Image
object
# File lib/imgurapi/models/image.rb, line 19 def url(size: nil, use_ssl: false) size = case size when :small_square, :small, :s 's' when :large_thumbnail, :large, :l 'l' else '' end splitted_link = link(use_ssl).split('.') splitted_link[splitted_link.size - 2] << size splitted_link.join '.' end