Class: Regio::Core

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/regio/core.rb

Direct Known Subclasses

Gazetteer, Geocode, ReverseGeocode, Routing

Constant Summary collapse

COMPONENTS =
[
  { name: :country, type: 'A0' },
  { name: :county, type: 'A1' },
  { name: :municipality, type: 'A2' },
  { name: :settlement, type: 'A3' },
  { name: :small_place, type: 'A4' },
  { name: :street, type: 'A5' },
  { name: :farmstead, type: 'A6' },
  { name: :house, type: 'A7' },
  { name: :apartment, type: 'A8' }
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Core

Returns a new instance of Core.



13
14
15
# File 'lib/regio/core.rb', line 13

def initialize(options = {})
  @options = default_options.merge(options)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/regio/core.rb', line 11

def options
  @options
end

Instance Method Details

#run(path, params = {}) ⇒ Object



29
30
31
# File 'lib/regio/core.rb', line 29

def run(path, params = {})
  JSON.parse(self.class.get(path, query: params).body, symbolize_names: true)
end