Class: Giphy::Image

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Image

Returns a new instance of Image.



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

def initialize(hash)
  @hash = hash
end

Instance Method Details

#framesObject



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

def frames
  hash.fetch('frames', 0).to_i
end

#heightObject



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

def height
  hash.fetch('height').to_i
end

#sizeObject



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

def size
  hash.fetch('size', 0).to_i
end

#urlObject



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

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

#widthObject



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

def width
  hash.fetch('width').to_i
end