Class: Google::Search::Item::Image

Inherits:
Google::Search::Item show all
Defined in:
lib/google-search/item/image.rb

Instance Attribute Summary collapse

Attributes inherited from Google::Search::Item

#content, #index, #thumbnail_height, #thumbnail_uri, #thumbnail_width, #title, #uri, #visible_uri

Instance Method Summary collapse

Methods inherited from Google::Search::Item

class_for

Constructor Details

#initialize(hash) ⇒ Image

Initialize with hash.


30
31
32
33
34
35
36
# File 'lib/google-search/item/image.rb', line 30

def initialize hash
  super
  @id = hash['imageId']
  @context_uri = hash['originalContextUrl']
  @width = hash['width'].to_i
  @height = hash['height'].to_i
end

Instance Attribute Details

#context_uriObject (readonly)

Context uri.


15
16
17
# File 'lib/google-search/item/image.rb', line 15

def context_uri
  @context_uri
end

#heightObject (readonly)

Image height in pixels.


25
26
27
# File 'lib/google-search/item/image.rb', line 25

def height
  @height
end

#idObject (readonly)

Image id.


10
11
12
# File 'lib/google-search/item/image.rb', line 10

def id
  @id
end

#widthObject (readonly)

Image width in pixels.


20
21
22
# File 'lib/google-search/item/image.rb', line 20

def width
  @width
end