geo_names 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -1
- data/README.md +100 -4
- data/geo_names.gemspec +1 -1
- data/lib/geo_names/base.rb +19 -18
- data/lib/geo_names/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db31a6de689635c0e398b2f48e13a9aebedc742c768ee0049f8a094105db05e2
|
4
|
+
data.tar.gz: 945daed55cf7d9c317681a92979fa24ab4d01b64da1f58bc4ba94423abfd6919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbd5be23ddda55ef52611525ac73868c3b3a149028b8704c4c87da3b6405a458f303956cf65976904e9c41e4577940ba5041cbaf51b5a4db229d7f74fee47adc
|
7
|
+
data.tar.gz: 3918a96712e5dc8fcde9091fdbd8fb6f1defcae577bc36618d315565bd9371f5386a582b03c9e32760f41873dde3ee3162fb7014a3e4f96c934929587aa17e5a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,14 @@
|
|
4
4
|
|
5
5
|
- ...
|
6
6
|
|
7
|
+
## 1.0.2
|
8
|
+
|
9
|
+
- GeoNames API changed the behavior and now we need to rescue RestClient::Unauthorized exception. [Pr #4](https://github.com/WaKeMaTTa/geo_names/pull/4)
|
10
|
+
- Fixed missing `GeoNames::DatabaseTimeoutError` class and fixed a typo in the class `GeoNames::NoResultFoundError`. [Pr #3](https://github.com/WaKeMaTTa/geo_names/pull/3) (thanks to @dgilperez)
|
11
|
+
|
7
12
|
## 1.0.1
|
8
13
|
|
9
|
-
- A typo in `GeoNames.configuration` -> `username`.
|
14
|
+
- A typo in `GeoNames.configuration` -> `username`. [commit 8d8d7e3](https://github.com/WaKeMaTTa/geo_names/commit/8d8d7e3329cc4ca08209d3d99f1263c665d51135)
|
10
15
|
|
11
16
|
## 1.0.0
|
12
17
|
|
data/README.md
CHANGED
@@ -49,11 +49,107 @@ end
|
|
49
49
|
|
50
50
|
### Searching
|
51
51
|
|
52
|
+
#### How to search?
|
53
|
+
|
54
|
+
First you need a `Hash` with the criteria that you want to search.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
# example of criteria
|
58
|
+
criteria = {
|
59
|
+
country_code: 'US',
|
60
|
+
name: 'New York',
|
61
|
+
featureClass: %w[P S],
|
62
|
+
maxRows: 1,
|
63
|
+
style: 'short'
|
64
|
+
}
|
65
|
+
```
|
66
|
+
|
67
|
+
Then you can search
|
68
|
+
```ruby
|
69
|
+
result = GeoNames::Search.search(criteria)
|
70
|
+
```
|
71
|
+
|
72
|
+
The `result` it will be a `Hash` if was successful, like this one:
|
73
|
+
```ruby
|
74
|
+
{ "totalResultsCount" => 1360,
|
75
|
+
"geonames" => [
|
76
|
+
{ "lng" => "-74.00597",
|
77
|
+
"geonameId" => 5128581,
|
78
|
+
"countryCode" => "US",
|
79
|
+
"name" => "New York",
|
80
|
+
"toponymName" => "New York City",
|
81
|
+
"lat" => "40.71427",
|
82
|
+
"fcl" => "P",
|
83
|
+
"fcode" => "PPL"
|
84
|
+
}
|
85
|
+
]
|
86
|
+
}
|
87
|
+
```
|
88
|
+
|
89
|
+
Or if something was wrong it will raise an error of this list:
|
90
|
+
```ruby
|
91
|
+
GeoNames::AuthorizationExceptionError
|
92
|
+
GeoNames::DatabaseTimeoutError
|
93
|
+
GeoNames::MissingOrInvalidParameterError
|
94
|
+
GeoNames::RecordDoesNotExistError
|
95
|
+
GeoNames::OtherError
|
96
|
+
GeoNames::NoResultFoundError
|
97
|
+
GeoNames::PostalCodeNotFoundError
|
98
|
+
GeoNames::DailyLimitOfCreditsExceededError
|
99
|
+
GeoNames::HourlyLimitOfCreditsExceededError
|
100
|
+
GeoNames::WeeklyLimitOfCreditsExceededError
|
101
|
+
GeoNames::InvalidInputError
|
102
|
+
GeoNames::ServerOverloadedExceptionError
|
103
|
+
GeoNames::ServiceNotImplementedError
|
104
|
+
GeoNames::RadiusTooLargeError
|
105
|
+
GeoNames::MaxRowsTooLargeError
|
106
|
+
GeoNames::StatusCodeNotImplementedError
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Search engines available
|
110
|
+
|
52
111
|
```ruby
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
112
|
+
GeoNames::Address
|
113
|
+
GeoNames::Astergdem
|
114
|
+
GeoNames::Children
|
115
|
+
GeoNames::Cities
|
116
|
+
GeoNames::Configuration
|
117
|
+
GeoNames::Contains
|
118
|
+
GeoNames::CountryCode
|
119
|
+
GeoNames::CountryInfo
|
120
|
+
GeoNames::CountrySubdivision
|
121
|
+
GeoNames::Earthquakes
|
122
|
+
GeoNames::ExtendedFindNearby
|
123
|
+
GeoNames::FindNearByWeather
|
124
|
+
GeoNames::FindNearby
|
125
|
+
GeoNames::FindNearbyPOIsOSM
|
126
|
+
GeoNames::FindNearbyPlaceName
|
127
|
+
GeoNames::FindNearbyPostalCodes
|
128
|
+
GeoNames::FindNearbyStreets
|
129
|
+
GeoNames::FindNearbyStreetsOSM
|
130
|
+
GeoNames::FindNearbyWikipedia
|
131
|
+
GeoNames::FindNearestAddress
|
132
|
+
GeoNames::FindNearestIntersection
|
133
|
+
GeoNames::FindNearestIntersectionOSM
|
134
|
+
GeoNames::GeoCodeAddress
|
135
|
+
GeoNames::Get
|
136
|
+
GeoNames::Gtopo30
|
137
|
+
GeoNames::Hierarchy
|
138
|
+
GeoNames::Neighbourhood
|
139
|
+
GeoNames::Neighbours
|
140
|
+
GeoNames::Ocean
|
141
|
+
GeoNames::PostalCodeCountryInfo
|
142
|
+
GeoNames::PostalCodeLookup
|
143
|
+
GeoNames::PostalCodeSearch
|
144
|
+
GeoNames::Search
|
145
|
+
GeoNames::Siblings
|
146
|
+
GeoNames::Srtm1
|
147
|
+
GeoNames::Srtm3
|
148
|
+
GeoNames::Timezone
|
149
|
+
GeoNames::Weather
|
150
|
+
GeoNames::WeatherIcao
|
151
|
+
GeoNames::WikipediaBoundingBox
|
152
|
+
GeoNames::WikipediaSearch
|
57
153
|
```
|
58
154
|
|
59
155
|
## Development
|
data/geo_names.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_runtime_dependency 'rest-client', '~> 2'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'bundler'
|
29
29
|
spec.add_development_dependency 'gem-release', '~> 2.0'
|
30
30
|
spec.add_development_dependency 'pry-byebug', '~> 3.6'
|
31
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/geo_names/base.rb
CHANGED
@@ -31,6 +31,8 @@ module GeoNames
|
|
31
31
|
|
32
32
|
def make_request
|
33
33
|
RestClient.get(url, params: params)
|
34
|
+
rescue RestClient::Unauthorized => e
|
35
|
+
e.response.to_s
|
34
36
|
end
|
35
37
|
|
36
38
|
def parse(json_string)
|
@@ -60,12 +62,10 @@ module GeoNames
|
|
60
62
|
raise(OtherError, message)
|
61
63
|
when 13
|
62
64
|
raise(DatabaseTimeoutError, message)
|
63
|
-
when 13
|
64
|
-
raise(DatabaseTimeoutError, message)
|
65
65
|
when 14
|
66
66
|
raise(MissingOrInvalidParameterError, message)
|
67
67
|
when 15
|
68
|
-
raise(
|
68
|
+
raise(NoResultFoundError, message)
|
69
69
|
when 16
|
70
70
|
raise(DuplicateExceptionError, message)
|
71
71
|
when 17
|
@@ -92,19 +92,20 @@ module GeoNames
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
class AuthorizationExceptionError
|
96
|
-
class
|
97
|
-
class
|
98
|
-
class
|
99
|
-
class
|
100
|
-
class
|
101
|
-
class
|
102
|
-
class
|
103
|
-
class
|
104
|
-
class
|
105
|
-
class
|
106
|
-
class
|
107
|
-
class
|
108
|
-
class
|
109
|
-
class
|
95
|
+
class AuthorizationExceptionError < StandardError; end
|
96
|
+
class DatabaseTimeoutError < StandardError; end
|
97
|
+
class MissingOrInvalidParameterError < StandardError; end
|
98
|
+
class RecordDoesNotExistError < StandardError; end
|
99
|
+
class OtherError < StandardError; end
|
100
|
+
class NoResultFoundError < StandardError; end
|
101
|
+
class PostalCodeNotFoundError < StandardError; end
|
102
|
+
class DailyLimitOfCreditsExceededError < StandardError; end
|
103
|
+
class HourlyLimitOfCreditsExceededError < StandardError; end
|
104
|
+
class WeeklyLimitOfCreditsExceededError < StandardError; end
|
105
|
+
class InvalidInputError < StandardError; end
|
106
|
+
class ServerOverloadedExceptionError < StandardError; end
|
107
|
+
class ServiceNotImplementedError < StandardError; end
|
108
|
+
class RadiusTooLargeError < StandardError; end
|
109
|
+
class MaxRowsTooLargeError < StandardError; end
|
110
|
+
class StatusCodeNotImplementedError < StandardError; end
|
110
111
|
end
|
data/lib/geo_names/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_names
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohamed Ziata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: gem-release
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
|
179
|
-
rubygems_version: 2.7.7
|
178
|
+
rubygems_version: 3.0.2
|
180
179
|
signing_key:
|
181
180
|
specification_version: 4
|
182
181
|
summary: An API wrapper for GeoNames API's
|