Class: Giphy::Gif

Inherits:
Object
  • Object
show all
Defined in:
lib/giphy/gif.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Gif

Returns a new instance of Gif.



7
8
9
# File 'lib/giphy/gif.rb', line 7

def initialize(hash)
  @hash = hash
end

Class Method Details

.build_batch_from(array) ⇒ Object



3
4
5
# File 'lib/giphy/gif.rb', line 3

def self.build_batch_from(array)
  array.map { |gif| new(gif) }
end

Instance Method Details

#bitly_fullscreen_urlObject



23
24
25
# File 'lib/giphy/gif.rb', line 23

def bitly_fullscreen_url
  URI(hash.fetch('bitly_fullscreen_url', ''))
end

#bitly_gif_urlObject



19
20
21
# File 'lib/giphy/gif.rb', line 19

def bitly_gif_url
  URI(hash.fetch('bitly_gif_url', ''))
end

#bitly_tiled_urlObject



27
28
29
# File 'lib/giphy/gif.rb', line 27

def bitly_tiled_url
  URI(hash.fetch('bitly_tiled_url', ''))
end

#embed_urlObject



31
32
33
# File 'lib/giphy/gif.rb', line 31

def embed_url
  URI(hash.fetch('embed_url', ''))
end

#fixed_height_downsampled_imageObject



43
44
45
# File 'lib/giphy/gif.rb', line 43

def fixed_height_downsampled_image
  @fixed_height_downsampled_image ||= image(images['fixed_height_downsampled'])
end

#fixed_height_imageObject



35
36
37
# File 'lib/giphy/gif.rb', line 35

def fixed_height_image
  @fixed_height_image ||= image(images['fixed_height'])
end

#fixed_height_still_imageObject



39
40
41
# File 'lib/giphy/gif.rb', line 39

def fixed_height_still_image
  @fixed_height_still_image ||= image(images['fixed_height_still'])
end

#fixed_width_downsampled_imageObject



55
56
57
# File 'lib/giphy/gif.rb', line 55

def fixed_width_downsampled_image
  @fixed_width_downsampled_image ||= image(images['fixed_width_downsampled'])
end

#fixed_width_imageObject



47
48
49
# File 'lib/giphy/gif.rb', line 47

def fixed_width_image
  @fixed_width_image ||= image(images['fixed_width'])
end

#fixed_width_still_imageObject



51
52
53
# File 'lib/giphy/gif.rb', line 51

def fixed_width_still_image
  @fixed_width_still_image ||= image(images['fixed_width_still'])
end

#idObject



11
12
13
# File 'lib/giphy/gif.rb', line 11

def id
  hash.fetch('id')
end

#image_original_urlObject



63
64
65
# File 'lib/giphy/gif.rb', line 63

def image_original_url
  URI(hash.fetch('image_original_url', ''))
end

#original_imageObject



59
60
61
# File 'lib/giphy/gif.rb', line 59

def original_image
  @original_image ||= image(images['original'])
end

#urlObject



15
16
17
# File 'lib/giphy/gif.rb', line 15

def url
  URI(hash.fetch('url', ''))
end