Class: GoogleImages::Image

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items_hash = {}) ⇒ Image

Returns a new instance of Image.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/google_images/image.rb', line 7

def initialize(items_hash = {})
  @title            = items_hash['title']
  @link             = items_hash['link']
  @context_link     = items_hash['image']['context_link']
  @snippet          = items_hash['snippet']
  @mime             = items_hash['mime']
  @height           = items_hash['image']['height']
  @width            = items_hash['image']['width']
  @byte_size        = items_hash['image']['byte_size']
  @thumbnail_link   = items_hash['image']['thumbnailLink']
  @thumbnail_height = items_hash['image']['thumbnailHeight']
  @thumbnail_width  = items_hash['image']['thumbnailWidth']
end

Instance Attribute Details

#byte_sizeObject (readonly)

Returns the value of attribute byte_size.



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

def byte_size
  @byte_size
end

Returns the value of attribute context_link.



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

def context_link
  @context_link
end

#heightObject (readonly)

Returns the value of attribute height.



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

def height
  @height
end

Returns the value of attribute link.



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

def link
  @link
end

#mimeObject (readonly)

Returns the value of attribute mime.



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

def mime
  @mime
end

#snippetObject (readonly)

Returns the value of attribute snippet.



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

def snippet
  @snippet
end

#thumbnail_heightObject (readonly)

Returns the value of attribute thumbnail_height.



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

def thumbnail_height
  @thumbnail_height
end

Returns the value of attribute thumbnail_link.



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

def thumbnail_link
  @thumbnail_link
end

#thumbnail_widthObject (readonly)

Returns the value of attribute thumbnail_width.



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

def thumbnail_width
  @thumbnail_width
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#widthObject (readonly)

Returns the value of attribute width.



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

def width
  @width
end