Class: Google::Search::Item::Local

Inherits:
Google::Search::Item show all
Defined in:
lib/google-search/item/local.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) ⇒ Local

Initialize with hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/google-search/item/local.rb', line 85

def initialize hash
  super
  @country = hash['country']
  @region = hash['region']
  @city = hash['city']
  @type = hash['listingType']
  @accuracy = hash['accuracy'].to_i
  @max_age = hash['maxAge']
  @directions_uri = hash['ddUrl']
  @directions_to_here_uri = hash['ddUrlToHere']
  @directions_from_here_uri = hash['ddUrlFromHere']
  @thumbnail_uri = hash['staticMapUrl']
  @long = hash['lng'].to_f
  @lat = hash['lat'].to_f
  @viewport_mode = hash['viewportmode']
  @phone_numbers = hash['phoneNumbers'].map { |phone| phone['number'] }
  @street_address = hash['streetAddress']
  @address_lines = hash['addressLines']
end

Instance Attribute Details

#accuracyObject (readonly)

Accuracy.



30
31
32
# File 'lib/google-search/item/local.rb', line 30

def accuracy
  @accuracy
end

#address_linesObject (readonly)

Address lines array.



80
81
82
# File 'lib/google-search/item/local.rb', line 80

def address_lines
  @address_lines
end

#cityObject (readonly)

City.



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

def city
  @city
end

#countryObject (readonly)

Country.



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

def country
  @country
end

#directions_from_here_uriObject (readonly)

Google maps directions from here uri.



50
51
52
# File 'lib/google-search/item/local.rb', line 50

def directions_from_here_uri
  @directions_from_here_uri
end

#directions_to_here_uriObject (readonly)

Google maps directions to here uri.



45
46
47
# File 'lib/google-search/item/local.rb', line 45

def directions_to_here_uri
  @directions_to_here_uri
end

#directions_uriObject (readonly)

Google maps directions uri.



40
41
42
# File 'lib/google-search/item/local.rb', line 40

def directions_uri
  @directions_uri
end

#latObject (readonly)

Latitude float.



60
61
62
# File 'lib/google-search/item/local.rb', line 60

def lat
  @lat
end

#longObject (readonly)

Longitude float.



55
56
57
# File 'lib/google-search/item/local.rb', line 55

def long
  @long
end

#max_ageObject (readonly)

Max age in seconds.



35
36
37
# File 'lib/google-search/item/local.rb', line 35

def max_age
  @max_age
end

#phone_numbersObject (readonly)

Phone numbers array.



70
71
72
# File 'lib/google-search/item/local.rb', line 70

def phone_numbers
  @phone_numbers
end

#regionObject (readonly)

Region.



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

def region
  @region
end

#street_addressObject (readonly)

Street address.



75
76
77
# File 'lib/google-search/item/local.rb', line 75

def street_address
  @street_address
end

#typeObject (readonly)

Type.



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

def type
  @type
end

#viewport_modeObject (readonly)

Viewport mode.



65
66
67
# File 'lib/google-search/item/local.rb', line 65

def viewport_mode
  @viewport_mode
end