Class: GeoNames::Base
- Inherits:
-
Object
- Object
- GeoNames::Base
- Defined in:
- lib/geo_names/base.rb
Direct Known Subclasses
Address, Astergdem, Children, Cities, Contains, CountryCode, CountryInfo, CountrySubdivision, Earthquakes, ExtendedFindNearby, FindNearByWeather, FindNearby, FindNearbyPOIsOSM, FindNearbyPlaceName, FindNearbyPostalCodes, FindNearbyStreets, FindNearbyStreetsOSM, FindNearbyWikipedia, FindNearestAddress, FindNearestIntersection, FindNearestIntersectionOSM, GeoCodeAddress, Get, Gtopo30, Hierarchy, Neighbourhood, Neighbours, Ocean, PostalCodeCountryInfo, PostalCodeLookup, PostalCodeSearch, Search, Siblings, Srtm1, Srtm3, Timezone, Weather, WeatherIcao, WikipediaBoundingBox, WikipediaSearch
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 |
# File 'lib/geo_names/base.rb', line 14 def initialize(params = {}) @url = "#{configuration.api_base}#{controller_name_for(self.class)}" @params = { username: configuration.username }.merge(params) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/geo_names/base.rb', line 8 def params @params end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/geo_names/base.rb', line 8 def url @url end |
Class Method Details
.search(params = {}) ⇒ Object
10 11 12 |
# File 'lib/geo_names/base.rb', line 10 def self.search(params = {}) new(params).call end |
Instance Method Details
#call ⇒ Object
21 22 23 24 |
# File 'lib/geo_names/base.rb', line 21 def call result = make_request parse(result) end |