class Loadgif::Gif

Attributes

hash[R]

Public Class Methods

build_batch_from(array_or_hash) click to toggle source
# File lib/loadgif/gif.rb, line 3
def self.build_batch_from(array_or_hash)
  if array_or_hash.is_a?(Array)
    array_or_hash.map { |gif| new(gif) }
  else
    new(array_or_hash)
  end
end
new(hash) click to toggle source
# File lib/loadgif/gif.rb, line 11
def initialize(hash)
  @hash = hash
end

Public Instance Methods

bitly_fullscreen_url() click to toggle source
# File lib/loadgif/gif.rb, line 27
def bitly_fullscreen_url
  URI(hash.fetch('bitly_fullscreen_url', ''))
end
bitly_gif_url() click to toggle source
# File lib/loadgif/gif.rb, line 23
def bitly_gif_url
  URI(hash.fetch('bitly_gif_url', ''))
end
bitly_tiled_url() click to toggle source
# File lib/loadgif/gif.rb, line 31
def bitly_tiled_url
  URI(hash.fetch('bitly_tiled_url', ''))
end
embed_url() click to toggle source
# File lib/loadgif/gif.rb, line 35
def embed_url
  URI(hash.fetch('embed_url', ''))
end
fixed_height_downsampled_image() click to toggle source
# File lib/loadgif/gif.rb, line 47
def fixed_height_downsampled_image
  @fixed_height_downsampled_image ||= image(images['fixed_height_downsampled'])
end
fixed_height_image() click to toggle source
# File lib/loadgif/gif.rb, line 39
def fixed_height_image
  @fixed_height_image ||= image(images['fixed_height'])
end
fixed_height_still_image() click to toggle source
# File lib/loadgif/gif.rb, line 43
def fixed_height_still_image
  @fixed_height_still_image ||= image(images['fixed_height_still'])
end
fixed_width_downsampled_image() click to toggle source
# File lib/loadgif/gif.rb, line 59
def fixed_width_downsampled_image
  @fixed_width_downsampled_image ||= image(images['fixed_width_downsampled'])
end
fixed_width_image() click to toggle source
# File lib/loadgif/gif.rb, line 51
def fixed_width_image
  @fixed_width_image ||= image(images['fixed_width'])
end
fixed_width_still_image() click to toggle source
# File lib/loadgif/gif.rb, line 55
def fixed_width_still_image
  @fixed_width_still_image ||= image(images['fixed_width_still'])
end
id() click to toggle source
# File lib/loadgif/gif.rb, line 15
def id
  hash.fetch('id')
end
image_original_url() click to toggle source
# File lib/loadgif/gif.rb, line 67
def image_original_url
  URI(hash.fetch('image_original_url', ''))
end
original_image() click to toggle source
# File lib/loadgif/gif.rb, line 63
def original_image
  @original_image ||= image(images['original'])
end
url() click to toggle source
# File lib/loadgif/gif.rb, line 19
def url
  URI(hash.fetch('url', ''))
end

Private Instance Methods

image(image_hash) click to toggle source
# File lib/loadgif/gif.rb, line 79
def image(image_hash)
  image_hash ? Loadgif::Image.new(image_hash) : null_image
end
images() click to toggle source
# File lib/loadgif/gif.rb, line 75
def images
  @images ||= hash.fetch('images', {})
end
null_image() click to toggle source
# File lib/loadgif/gif.rb, line 83
def null_image
  NullImage.new
end