regio 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/checks.yml +6 -2
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +28 -30
- data/README.md +63 -2
- data/lib/regio/gazetteer.rb +29 -0
- data/lib/regio/geocode.rb +1 -1
- data/lib/regio/reverse_geocode.rb +1 -1
- data/lib/regio/routing.rb +29 -0
- data/lib/regio/version.rb +1 -1
- data/lib/regio.rb +2 -0
- data/regio.gemspec +4 -4
- metadata +20 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e261a4a360140c0487bac9af20b744a6aaf08e3e7a8c3a0cbbe49db4fd5df71
|
|
4
|
+
data.tar.gz: 7c31479d24d0ec78bc9fc92453cf31edddea059a9289034efdab676483f61db5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a1690f9811b69963b9e385171a9f090982404efab18df5530cc409fa7f8c9b2544bc6c50366348fdec6c29d50906793534cf01a86ebc179b0fde4edca01a8cd
|
|
7
|
+
data.tar.gz: 55b472111aa1563f5cc30c66d318bdaf659d734103ae8c46fc6f973d3805967f2b7972a6ff3d9bd7902c49f1cf7991e13393af57ea91960da8d42250e800550c
|
|
@@ -7,13 +7,17 @@ concurrency:
|
|
|
7
7
|
cancel-in-progress: true
|
|
8
8
|
jobs:
|
|
9
9
|
rspec:
|
|
10
|
-
name: RSpec
|
|
10
|
+
name: RSpec with ruby ${{matrix.ruby}}
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
ruby: ['2.6', '2.7', '3.0', '3.1', head]
|
|
12
16
|
steps:
|
|
13
17
|
- uses: actions/checkout@v3
|
|
14
18
|
- uses: ruby/setup-ruby@v1
|
|
15
19
|
with:
|
|
16
|
-
ruby-version:
|
|
20
|
+
ruby-version: ${{matrix.ruby}}
|
|
17
21
|
bundler-cache: true
|
|
18
22
|
- name: Test with RSpec
|
|
19
23
|
run: COVERAGE=true bundle exec rspec
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## v0.3.1 (28.02.2023)
|
|
4
|
+
|
|
5
|
+
* 1 minor enhancement:
|
|
6
|
+
* Update httparty dependency
|
|
7
|
+
|
|
8
|
+
## v0.3.0 (02.01.2023)
|
|
9
|
+
|
|
10
|
+
* 2 major enhancements:
|
|
11
|
+
* Regio [routing](https://api.regio.ee/documentation/#docs/routing_and_directions)
|
|
12
|
+
* Regio [gazetteer](https://api.regio.ee/documentation/#docs/gazetteer)
|
|
13
|
+
* Minor refactoring
|
|
14
|
+
|
|
3
15
|
## v0.2.0 (15.10.2022)
|
|
4
16
|
|
|
5
17
|
* 1 major enhancement:
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
regio (0.
|
|
5
|
-
httparty (
|
|
4
|
+
regio (0.3.1)
|
|
5
|
+
httparty (>= 0.20, < 0.22)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -15,54 +15,52 @@ GEM
|
|
|
15
15
|
diff-lcs (1.5.0)
|
|
16
16
|
docile (1.4.0)
|
|
17
17
|
hashdiff (1.0.1)
|
|
18
|
-
httparty (0.
|
|
19
|
-
|
|
18
|
+
httparty (0.21.0)
|
|
19
|
+
mini_mime (>= 1.0.0)
|
|
20
20
|
multi_xml (>= 0.5.2)
|
|
21
|
-
json (2.6.
|
|
22
|
-
|
|
23
|
-
mime-types-data (~> 3.2015)
|
|
24
|
-
mime-types-data (3.2022.0105)
|
|
21
|
+
json (2.6.3)
|
|
22
|
+
mini_mime (1.1.2)
|
|
25
23
|
multi_xml (0.6.0)
|
|
26
24
|
parallel (1.22.1)
|
|
27
|
-
parser (3.1.
|
|
25
|
+
parser (3.1.3.0)
|
|
28
26
|
ast (~> 2.4.1)
|
|
29
27
|
public_suffix (5.0.0)
|
|
30
28
|
rainbow (3.1.1)
|
|
31
29
|
rake (13.0.6)
|
|
32
|
-
regexp_parser (2.6.
|
|
30
|
+
regexp_parser (2.6.1)
|
|
33
31
|
rexml (3.2.5)
|
|
34
|
-
rspec (3.
|
|
35
|
-
rspec-core (~> 3.
|
|
36
|
-
rspec-expectations (~> 3.
|
|
37
|
-
rspec-mocks (~> 3.
|
|
38
|
-
rspec-core (3.
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-expectations (3.
|
|
32
|
+
rspec (3.12.0)
|
|
33
|
+
rspec-core (~> 3.12.0)
|
|
34
|
+
rspec-expectations (~> 3.12.0)
|
|
35
|
+
rspec-mocks (~> 3.12.0)
|
|
36
|
+
rspec-core (3.12.0)
|
|
37
|
+
rspec-support (~> 3.12.0)
|
|
38
|
+
rspec-expectations (3.12.0)
|
|
41
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
42
|
-
rspec-support (~> 3.
|
|
43
|
-
rspec-mocks (3.
|
|
40
|
+
rspec-support (~> 3.12.0)
|
|
41
|
+
rspec-mocks (3.12.0)
|
|
44
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
45
|
-
rspec-support (~> 3.
|
|
46
|
-
rspec-support (3.
|
|
47
|
-
rubocop (1.
|
|
43
|
+
rspec-support (~> 3.12.0)
|
|
44
|
+
rspec-support (3.12.0)
|
|
45
|
+
rubocop (1.41.1)
|
|
48
46
|
json (~> 2.3)
|
|
49
47
|
parallel (~> 1.10)
|
|
50
48
|
parser (>= 3.1.2.1)
|
|
51
49
|
rainbow (>= 2.2.2, < 4.0)
|
|
52
50
|
regexp_parser (>= 1.8, < 3.0)
|
|
53
51
|
rexml (>= 3.2.5, < 4.0)
|
|
54
|
-
rubocop-ast (>= 1.
|
|
52
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
|
55
53
|
ruby-progressbar (~> 1.7)
|
|
56
54
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
57
|
-
rubocop-ast (1.
|
|
55
|
+
rubocop-ast (1.24.0)
|
|
58
56
|
parser (>= 3.1.1.0)
|
|
59
|
-
rubocop-performance (1.15.
|
|
57
|
+
rubocop-performance (1.15.2)
|
|
60
58
|
rubocop (>= 1.7.0, < 2.0)
|
|
61
59
|
rubocop-ast (>= 0.4.0)
|
|
62
|
-
rubocop-rspec (2.
|
|
60
|
+
rubocop-rspec (2.16.0)
|
|
63
61
|
rubocop (~> 1.33)
|
|
64
62
|
ruby-progressbar (1.11.0)
|
|
65
|
-
simplecov (0.
|
|
63
|
+
simplecov (0.22.0)
|
|
66
64
|
docile (~> 1.1)
|
|
67
65
|
simplecov-html (~> 0.11)
|
|
68
66
|
simplecov_json_formatter (~> 0.1)
|
|
@@ -84,11 +82,11 @@ DEPENDENCIES
|
|
|
84
82
|
bundler (~> 2.3.0)
|
|
85
83
|
rake (~> 13.0.6)
|
|
86
84
|
regio!
|
|
87
|
-
rspec (~> 3.
|
|
85
|
+
rspec (~> 3.12.0)
|
|
88
86
|
rubocop (~> 1.36)
|
|
89
87
|
rubocop-performance (~> 1.15)
|
|
90
|
-
rubocop-rspec (~> 2.
|
|
91
|
-
simplecov (~> 0.
|
|
88
|
+
rubocop-rspec (~> 2.16.0)
|
|
89
|
+
simplecov (~> 0.22.0)
|
|
92
90
|
webmock (~> 3.18.1)
|
|
93
91
|
|
|
94
92
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
Add this line to your application's Gemfile:
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
|
-
gem 'regio', '~> 0.
|
|
14
|
+
gem 'regio', '~> 0.3.1'
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
And then execute:
|
|
@@ -30,6 +30,15 @@ Get your own API key
|
|
|
30
30
|
REGIO_API_KEY=SECRET
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
```
|
|
34
|
+
export REGIO_API_KEY=SECRET && irb -I lib
|
|
35
|
+
|
|
36
|
+
irb(main):001:0> require 'regio'
|
|
37
|
+
=> true
|
|
38
|
+
|
|
39
|
+
...
|
|
40
|
+
```
|
|
41
|
+
|
|
33
42
|
### Geocoding
|
|
34
43
|
|
|
35
44
|
Use `Geocode` class in your code
|
|
@@ -56,7 +65,6 @@ end
|
|
|
56
65
|
|
|
57
66
|
Check Regio [geocode](https://api.regio.ee/documentation/#docs/geocode) documentation
|
|
58
67
|
|
|
59
|
-
|
|
60
68
|
### Reverse geocoding
|
|
61
69
|
|
|
62
70
|
Use `ReverseGeocode` class in your code
|
|
@@ -83,6 +91,59 @@ end
|
|
|
83
91
|
|
|
84
92
|
Check Regio [reverse geocode](https://api.regio.ee/documentation/#docs/reverse_geocode) documentation
|
|
85
93
|
|
|
94
|
+
### Gazetteer
|
|
95
|
+
|
|
96
|
+
Use `Gazetteer` class in your code
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
require 'regio'
|
|
100
|
+
|
|
101
|
+
class Geocoding
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
def results
|
|
106
|
+
@results ||= Regio::Gazetteer.new(options).results
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def options
|
|
110
|
+
{
|
|
111
|
+
id: 16004253,
|
|
112
|
+
query: 'address_children'
|
|
113
|
+
}
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Check Regio [Gazetteer](https://api.regio.ee/documentation/#docs/gazetteer) documentation
|
|
119
|
+
|
|
120
|
+
### Routing and directions
|
|
121
|
+
|
|
122
|
+
Use `Routing` class in your code
|
|
123
|
+
|
|
124
|
+
```ruby
|
|
125
|
+
require 'regio'
|
|
126
|
+
|
|
127
|
+
class Routing
|
|
128
|
+
|
|
129
|
+
private
|
|
130
|
+
|
|
131
|
+
def results
|
|
132
|
+
@results ||= Regio::Routing.new(options).results
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def options
|
|
136
|
+
{
|
|
137
|
+
coordinates: [[24.649138022268, 59.14048887149], [25.853136227622, 59.00678681919]],
|
|
138
|
+
service: 'optimize',
|
|
139
|
+
overview: 'full'
|
|
140
|
+
}
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Check Regio [routing and directions](https://api.regio.ee/documentation/#docs/routing_and_directions) documentation
|
|
146
|
+
|
|
86
147
|
## Development
|
|
87
148
|
|
|
88
149
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Regio
|
|
4
|
+
class Gazetteer < Core
|
|
5
|
+
def results
|
|
6
|
+
raise Unprocessable, response[:message] if response[:message]
|
|
7
|
+
|
|
8
|
+
response.merge(
|
|
9
|
+
collection: response[:data]&.map { |result| transform(result) } || []
|
|
10
|
+
)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def response
|
|
16
|
+
@response ||= run('/gazetteer', options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# NOTE: all options described in the documentation
|
|
20
|
+
# https://api.regio.ee/documentation/#docs/gazetteer
|
|
21
|
+
def default_options
|
|
22
|
+
{
|
|
23
|
+
apikey: Configuration.api_key,
|
|
24
|
+
address_format: 'long_address',
|
|
25
|
+
output_format: 'json'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/regio/geocode.rb
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Regio
|
|
4
|
+
class Routing < Core
|
|
5
|
+
def results
|
|
6
|
+
response.tap do |response|
|
|
7
|
+
raise Unprocessable, response[:message] if response[:message]
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def response
|
|
14
|
+
options[:coordinates]&.map { |lnglat| lnglat.join(',') }&.join(';')
|
|
15
|
+
|
|
16
|
+
@response ||= run('/routing', options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# NOTE: all options described in the documentation
|
|
20
|
+
# https://api.regio.ee/documentation/#docs/routing_and_directions
|
|
21
|
+
def default_options
|
|
22
|
+
{
|
|
23
|
+
apikey: Configuration.api_key,
|
|
24
|
+
output_format: 'json',
|
|
25
|
+
limit: 25
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/regio/version.rb
CHANGED
data/lib/regio.rb
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
require 'regio/configuration'
|
|
4
4
|
require 'regio/core'
|
|
5
|
+
require 'regio/gazetteer'
|
|
5
6
|
require 'regio/geocode'
|
|
6
7
|
require 'regio/reverse_geocode'
|
|
8
|
+
require 'regio/routing'
|
|
7
9
|
require 'regio/errors/failed'
|
|
8
10
|
require 'regio/errors/forbidden'
|
|
9
11
|
require 'regio/errors/not_found'
|
data/regio.gemspec
CHANGED
|
@@ -37,15 +37,15 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
38
38
|
spec.require_paths = ['lib']
|
|
39
39
|
|
|
40
|
-
spec.add_dependency 'httparty', '
|
|
40
|
+
spec.add_dependency 'httparty', '>= 0.20', '< 0.22'
|
|
41
41
|
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 2.3.0'
|
|
43
43
|
spec.add_development_dependency 'rake', '~> 13.0.6'
|
|
44
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
|
44
|
+
spec.add_development_dependency 'rspec', '~> 3.12.0'
|
|
45
45
|
spec.add_development_dependency 'rubocop', '~> 1.36'
|
|
46
46
|
spec.add_development_dependency 'rubocop-performance', '~> 1.15'
|
|
47
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.
|
|
48
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
|
47
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.16.0'
|
|
48
|
+
spec.add_development_dependency 'simplecov', '~> 0.22.0'
|
|
49
49
|
spec.add_development_dependency 'webmock', '~> 3.18.1'
|
|
50
50
|
|
|
51
51
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
metadata
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: regio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tab
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.20'
|
|
20
|
+
- - "<"
|
|
18
21
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
22
|
+
version: '0.22'
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0.20'
|
|
30
|
+
- - "<"
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
32
|
+
version: '0.22'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: bundler
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,14 +64,14 @@ dependencies:
|
|
|
58
64
|
requirements:
|
|
59
65
|
- - "~>"
|
|
60
66
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 3.
|
|
67
|
+
version: 3.12.0
|
|
62
68
|
type: :development
|
|
63
69
|
prerelease: false
|
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
71
|
requirements:
|
|
66
72
|
- - "~>"
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 3.
|
|
74
|
+
version: 3.12.0
|
|
69
75
|
- !ruby/object:Gem::Dependency
|
|
70
76
|
name: rubocop
|
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,28 +106,28 @@ dependencies:
|
|
|
100
106
|
requirements:
|
|
101
107
|
- - "~>"
|
|
102
108
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 2.
|
|
109
|
+
version: 2.16.0
|
|
104
110
|
type: :development
|
|
105
111
|
prerelease: false
|
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
113
|
requirements:
|
|
108
114
|
- - "~>"
|
|
109
115
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 2.
|
|
116
|
+
version: 2.16.0
|
|
111
117
|
- !ruby/object:Gem::Dependency
|
|
112
118
|
name: simplecov
|
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
|
114
120
|
requirements:
|
|
115
121
|
- - "~>"
|
|
116
122
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 0.
|
|
123
|
+
version: 0.22.0
|
|
118
124
|
type: :development
|
|
119
125
|
prerelease: false
|
|
120
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
127
|
requirements:
|
|
122
128
|
- - "~>"
|
|
123
129
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 0.
|
|
130
|
+
version: 0.22.0
|
|
125
131
|
- !ruby/object:Gem::Dependency
|
|
126
132
|
name: webmock
|
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -167,8 +173,10 @@ files:
|
|
|
167
173
|
- lib/regio/errors/forbidden.rb
|
|
168
174
|
- lib/regio/errors/not_found.rb
|
|
169
175
|
- lib/regio/errors/unprocessable.rb
|
|
176
|
+
- lib/regio/gazetteer.rb
|
|
170
177
|
- lib/regio/geocode.rb
|
|
171
178
|
- lib/regio/reverse_geocode.rb
|
|
179
|
+
- lib/regio/routing.rb
|
|
172
180
|
- lib/regio/version.rb
|
|
173
181
|
- regio.gemspec
|
|
174
182
|
homepage: https://github.com/tab/regio
|