Class: GoogleImageApi::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/google_image_api/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Result

Returns a new instance of Result.



3
4
5
6
7
# File 'lib/google_image_api/result.rb', line 3

def initialize(json)
  require 'json'
  @json = json
  @data = JSON::load(json)
end

Instance Method Details

#imagesObject



13
14
15
# File 'lib/google_image_api/result.rb', line 13

def images
  @data["responseData"]["results"]
end

#jsonObject



21
22
23
# File 'lib/google_image_api/result.rb', line 21

def json
  @json
end

#pageObject



9
10
11
# File 'lib/google_image_api/result.rb', line 9

def page
  @data.first
end

#raw_dataObject



17
18
19
# File 'lib/google_image_api/result.rb', line 17

def raw_data
  @data
end