Class: Geocoder::Result::Bing

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/bing.rb

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #longitude, #province, #province_code

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Class Method Details

.response_attributesObject



42
43
44
# File 'lib/geocoder/results/bing.rb', line 42

def self.response_attributes
  %w[bbox name confidence entityType]
end

Instance Method Details

#address(format = :full) ⇒ Object



6
7
8
# File 'lib/geocoder/results/bing.rb', line 6

def address(format = :full)
  @data['address']['formattedAddress']
end

#address_dataObject



34
35
36
# File 'lib/geocoder/results/bing.rb', line 34

def address_data
  @data['address']
end

#cityObject



10
11
12
# File 'lib/geocoder/results/bing.rb', line 10

def city
  @data['address']['locality']
end

#coordinatesObject



30
31
32
# File 'lib/geocoder/results/bing.rb', line 30

def coordinates
  @data['point']['coordinates']
end

#countryObject Also known as: country_code



20
21
22
# File 'lib/geocoder/results/bing.rb', line 20

def country
  @data['address']['countryRegion']
end

#postal_codeObject



26
27
28
# File 'lib/geocoder/results/bing.rb', line 26

def postal_code
  @data['address']['postalCode'].to_s
end

#state_codeObject Also known as: state



14
15
16
# File 'lib/geocoder/results/bing.rb', line 14

def state_code
  @data['address']['adminDistrict']
end

#viewportObject



38
39
40
# File 'lib/geocoder/results/bing.rb', line 38

def viewport
  @data['bbox']
end