geocoder-olleh 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -12
- data/.travis.yml +8 -10
- data/Gemfile +0 -31
- data/LICENSE +20 -0
- data/README.md +6 -74
- data/Rakefile +1 -70
- data/lib/geocoder/{olleh/lookups → lookups}/olleh.rb +4 -31
- data/lib/geocoder/olleh/version.rb +1 -1
- data/lib/geocoder/olleh.rb +11 -4
- data/lib/geocoder_olleh.rb +1 -0
- metadata +6 -5
- data/LICENSE.txt +0 -21
- /data/lib/geocoder/{olleh/results → results}/olleh.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc80f269fca7b636c670d2982c0abc0062ba012
|
4
|
+
data.tar.gz: 2beeb582301bed694100c15b7d645db1df8499a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d40fd93449d03a737112009d4b5908a2bc9699a89164089ff80bd57b1599aacb6ae3f6ebab411e0149b20ddc19a01e7031991ff519aa18c28917f1fc47b96c4
|
7
|
+
data.tar.gz: 3d14a3ea60fec075ff62fcf48400f06dd5290ccd9e0286f787ea8dea27b0ac3fda2edefe672b9568fe16142cd2f803f0c52f191130fdb9a217d5ded2aaa9fce5
|
data/.gitignore
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
/
|
9
|
-
/
|
10
|
-
|
11
|
-
/test/geocoder_test.sqlite
|
12
|
-
/test/fixtures/dump.rdb
|
1
|
+
coverage/*
|
2
|
+
pkg/*
|
3
|
+
rdoc/*
|
4
|
+
*.gem
|
5
|
+
.bundle
|
6
|
+
Gemfile.lock
|
7
|
+
api_keys.yml
|
8
|
+
test/geocoder_test.sqlite
|
9
|
+
test/fixtures/dump.rdb
|
10
|
+
|
data/.travis.yml
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
on_failure: change
|
12
|
-
on_success: never
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.2
|
6
|
+
- 2.2.0
|
7
|
+
- jruby-19mode
|
8
|
+
- rbx-2
|
9
|
+
gemfile:
|
10
|
+
- Gemfile
|
data/Gemfile
CHANGED
@@ -3,43 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in geocoder-olleh.gemspec
|
4
4
|
gem 'geocoder'
|
5
5
|
group :development, :test do
|
6
|
-
gem 'mongoid', '2.6.0'
|
7
|
-
gem 'bson_ext', platforms: :ruby
|
8
|
-
gem 'geoip'
|
9
|
-
gem 'rubyzip'
|
10
|
-
gem 'rails'
|
11
6
|
gem 'test-unit' # needed for Ruby >=2.2.0
|
12
|
-
gem 'byebug', platforms: :mri
|
13
7
|
gem 'guard'
|
14
8
|
gem 'guard-test'
|
15
9
|
gem 'coveralls'
|
16
10
|
gem 'pry'
|
17
11
|
gem 'pry-remote'
|
18
12
|
gem 'pry-nav'
|
19
|
-
platforms :jruby do
|
20
|
-
gem 'jruby-openssl'
|
21
|
-
gem 'jgeoip'
|
22
|
-
end
|
23
|
-
|
24
|
-
platforms :rbx do
|
25
|
-
gem 'rubysl', '~> 2.0'
|
26
|
-
gem 'rubysl-test-unit'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
group :test do
|
31
|
-
gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
|
32
|
-
|
33
|
-
platforms :ruby do
|
34
|
-
gem 'pg'
|
35
|
-
gem 'mysql2'
|
36
|
-
end
|
37
|
-
|
38
|
-
platforms :jruby do
|
39
|
-
gem 'jdbc-mysql'
|
40
|
-
gem 'jdbc-sqlite3'
|
41
|
-
gem 'activerecord-jdbcpostgresql-adapter'
|
42
|
-
end
|
43
13
|
end
|
44
|
-
|
45
14
|
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 GoGoVan
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,29 +1,12 @@
|
|
1
|
-
Geocoder Olleh
|
2
|
-
|
1
|
+
Geocoder - Olleh
|
2
|
+
========
|
3
3
|
|
4
|
-
|
4
|
+
This is an extension to the Geocoder gem
|
5
|
+
that adds support for Olleh.
|
5
6
|
|
6
|
-
|
7
|
+
#### Olleh (`:olleh`)
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
gem 'geocoder-olleh'
|
14
|
-
```
|
15
|
-
|
16
|
-
And then execute:
|
17
|
-
|
18
|
-
$ bundle
|
19
|
-
|
20
|
-
Or install it yourself as:
|
21
|
-
|
22
|
-
$ gem install geocoder-olleh
|
23
|
-
|
24
|
-
## Olleh (`:olleh`)
|
25
|
-
|
26
|
-
* **API key**: required (set `Geocoder.configure(:api_key => [app_id, app_key])`)
|
9
|
+
* **API key**: Basic auth (set `Geocoder.configure(:basic_auth => {:user => app_id, :password => app_key})`)
|
27
10
|
* **Quota**: Dependant on service plan
|
28
11
|
* **Region**: South Korea
|
29
12
|
* **SSL support**: no
|
@@ -31,54 +14,3 @@ Or install it yourself as:
|
|
31
14
|
* **Documentation**: https://www.ollehmap.com/spacedata/
|
32
15
|
* **Terms of Service**: https://www.ollehmap.com/spacedata/#이용약관
|
33
16
|
* **Limitations**: Only for commercial use. For commercial usage please check https://www.ollehmap.com/guide/
|
34
|
-
|
35
|
-
Caching
|
36
|
-
-------
|
37
|
-
|
38
|
-
It's a good idea, when relying on any external service, to cache retrieved data. When implemented correctly it improves your app's response time and stability. It's easy to cache geocoding results with Geocoder, just configure a cache store:
|
39
|
-
|
40
|
-
Geocoder.configure(:cache => Redis.new)
|
41
|
-
|
42
|
-
This example uses Redis, but the cache store can be any object that supports these methods:
|
43
|
-
|
44
|
-
* `store#[](key)` or `#get` or `#read` - retrieves a value
|
45
|
-
* `store#[]=(key, value)` or `#set` or `#write` - stores a value
|
46
|
-
* `store#del(url)` - deletes a value
|
47
|
-
|
48
|
-
Even a plain Ruby hash will work, though it's not a great choice (cleared out when app is restarted, not shared between app instances, etc).
|
49
|
-
|
50
|
-
You can also set a custom prefix to be used for cache keys:
|
51
|
-
|
52
|
-
Geocoder.configure(:cache_prefix => "...")
|
53
|
-
|
54
|
-
By default the prefix is `geocoder:`
|
55
|
-
|
56
|
-
If you need to expire cached content:
|
57
|
-
|
58
|
-
Geocoder::Lookup.get(Geocoder.config[:lookup]).cache.expire(:all) # expire cached results for current Lookup
|
59
|
-
Geocoder::Lookup.get(:google).cache.expire("http://...") # expire cached result for a specific URL
|
60
|
-
Geocoder::Lookup.get(:google).cache.expire(:all) # expire cached results for Google Lookup
|
61
|
-
# expire all cached results for all Lookups.
|
62
|
-
# Be aware that this methods spawns a new Lookup object for each Service
|
63
|
-
Geocoder::Lookup.all_services.each{|service| Geocoder::Lookup.get(service).cache.expire(:all)}
|
64
|
-
|
65
|
-
Do *not* include the prefix when passing a URL to be expired. Expiring `:all` will only expire keys with the configured prefix (won't kill every entry in your key/value store).
|
66
|
-
|
67
|
-
For an example of a cache store with URL expiry please see examples/autoexpire_cache.rb
|
68
|
-
|
69
|
-
_Before you implement caching in your app please be sure that doing so does not violate the Terms of Service for your geocoding service._
|
70
|
-
|
71
|
-
|
72
|
-
## Development
|
73
|
-
|
74
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
75
|
-
|
76
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
|
-
|
78
|
-
## Contributing
|
79
|
-
|
80
|
-
1. Fork it ( https://github.com/[my-github-username]/geocoder-olleh/fork )
|
81
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
82
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
83
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
84
|
-
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,80 +1,11 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
ACCEPTED_DB_VALUES = %w(sqlite postgres mysql)
|
5
|
-
DATABASE_CONFIG_FILE = 'test/database.yml'
|
6
|
-
|
7
|
-
def config
|
8
|
-
require 'yaml'
|
9
|
-
YAML.load(File.open(DATABASE_CONFIG_FILE))
|
10
|
-
end
|
11
|
-
|
12
|
-
namespace :db do
|
13
|
-
task :create do
|
14
|
-
if ACCEPTED_DB_VALUES.include? ENV['DB']
|
15
|
-
Rake::Task["db:#{ENV['DB']}:create"].invoke
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
task :drop do
|
20
|
-
if ACCEPTED_DB_VALUES.include? ENV['DB']
|
21
|
-
Rake::Task["db:#{ENV['DB']}:drop"].invoke
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
task :reset => [:drop, :create]
|
26
|
-
|
27
|
-
namespace :mysql do
|
28
|
-
desc 'Create the MySQL test databases'
|
29
|
-
task :create do
|
30
|
-
`mysql --user=#{config['mysql']['username']} -e "create DATABASE #{config['mysql']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci "`
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'Drop the MySQL test databases'
|
34
|
-
task :drop do
|
35
|
-
`mysqladmin --user=#{config['mysql']['username']} -f drop #{config['mysql']['database']}`
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
namespace :postgres do
|
40
|
-
desc 'Create the PostgreSQL test databases'
|
41
|
-
task :create do
|
42
|
-
`createdb -E UTF8 -T template0 #{config['postgres']['database']}`
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Drop the PostgreSQL test databases'
|
46
|
-
task :drop do
|
47
|
-
`dropdb #{config['postgres']['database']}`
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
namespace :sqlite do
|
52
|
-
task :drop
|
53
|
-
task :create
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
4
|
require 'rake/testtask'
|
58
|
-
desc "Use DB to test with #{ACCEPTED_DB_VALUES}, otherwise test standalone"
|
59
5
|
Rake::TestTask.new(:test) do |test|
|
60
|
-
Rake::Task['db:reset'].invoke if ACCEPTED_DB_VALUES.include? ENV['DB']
|
61
6
|
test.libs << 'lib' << 'test'
|
62
7
|
test.pattern = 'test/unit/**/*_test.rb'
|
63
8
|
test.verbose = true
|
64
9
|
end
|
65
10
|
|
66
|
-
|
67
|
-
# test.libs << 'lib' << 'test'
|
68
|
-
# test.pattern = 'test/integration/*_test.rb'
|
69
|
-
# test.verbose = true
|
70
|
-
# end
|
71
|
-
|
72
|
-
task :default => [:test]
|
73
|
-
|
74
|
-
require 'rdoc/task'
|
75
|
-
Rake::RDocTask.new do |rdoc|
|
76
|
-
rdoc.rdoc_dir = 'rdoc'
|
77
|
-
rdoc.title = "Geocoder #{Geocoder::Olleh::VERSION}"
|
78
|
-
rdoc.rdoc_files.include('*.rdoc')
|
79
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
80
|
-
end
|
11
|
+
task :default => [:test]
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'geocoder'
|
2
|
-
|
1
|
+
require 'geocoder/lookups/base'
|
2
|
+
require "geocoder/results/olleh"
|
3
3
|
require 'base64'
|
4
4
|
require 'uri'
|
5
5
|
require 'json'
|
@@ -59,22 +59,14 @@ module Geocoder::Lookup
|
|
59
59
|
'utmk' => 7
|
60
60
|
}
|
61
61
|
|
62
|
-
def
|
63
|
-
|
64
|
-
Geocoder.configure(
|
65
|
-
:use_https => true,
|
66
|
-
:http_headers => {"Authorization" => "Basic #{token}"}
|
67
|
-
)
|
62
|
+
def use_ssl?
|
63
|
+
true
|
68
64
|
end
|
69
65
|
|
70
66
|
def name
|
71
67
|
"Olleh"
|
72
68
|
end
|
73
69
|
|
74
|
-
def required_api_key_parts
|
75
|
-
["app_id", "app_key"]
|
76
|
-
end
|
77
|
-
|
78
70
|
def query_url(query)
|
79
71
|
base_url(query) + url_query_string(query)
|
80
72
|
end
|
@@ -154,17 +146,6 @@ module Geocoder::Lookup
|
|
154
146
|
end
|
155
147
|
end
|
156
148
|
|
157
|
-
def make_api_request(query)
|
158
|
-
timeout(configuration.timeout) do
|
159
|
-
uri = URI.parse(query_url(query))
|
160
|
-
Geocoder.log(:debug, "Geocoder: HTTP request being made for #{uri.to_s}")
|
161
|
-
http_client.start(uri.host, uri.port, :use_ssl => true) do |client|
|
162
|
-
req = Net::HTTP::Get.new(uri.request_uri, configuration.http_headers)
|
163
|
-
client.request(req)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
149
|
def base_url(query)
|
169
150
|
case Olleh.check_query_type(query)
|
170
151
|
when "route_search"
|
@@ -240,14 +221,6 @@ module Geocoder::Lookup
|
|
240
221
|
end
|
241
222
|
end
|
242
223
|
|
243
|
-
def token
|
244
|
-
if a = configuration.api_key
|
245
|
-
if a.is_a?(Array)
|
246
|
-
return Base64.encode64("#{a.first}:#{a.last}").strip
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
224
|
def now
|
252
225
|
Time.now.strftime("%Y%m%d%H%M%S%L")
|
253
226
|
end
|
data/lib/geocoder/olleh.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'geocoder'
|
2
|
+
require 'geocoder/lookups/olleh'
|
3
|
+
require 'geocoder/results/olleh'
|
4
|
+
require 'geocoder/olleh/version'
|
5
|
+
|
6
|
+
module Geocoder
|
7
|
+
module Olleh
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Geocoder::Lookup.street_services << :olleh
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'geocoder/olleh'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geocoder-olleh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaigouk Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -49,17 +49,18 @@ files:
|
|
49
49
|
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
51
|
- Guardfile
|
52
|
-
- LICENSE
|
52
|
+
- LICENSE
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
55
55
|
- bin/console
|
56
56
|
- bin/setup
|
57
57
|
- geocoder-olleh.gemspec
|
58
|
+
- lib/geocoder/lookups/olleh.rb
|
58
59
|
- lib/geocoder/olleh.rb
|
59
60
|
- lib/geocoder/olleh/lookup.rb
|
60
|
-
- lib/geocoder/olleh/lookups/olleh.rb
|
61
|
-
- lib/geocoder/olleh/results/olleh.rb
|
62
61
|
- lib/geocoder/olleh/version.rb
|
62
|
+
- lib/geocoder/results/olleh.rb
|
63
|
+
- lib/geocoder_olleh.rb
|
63
64
|
homepage: https://github.com/jaigouk/geocoder-olleh
|
64
65
|
licenses:
|
65
66
|
- MIT
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 Jaigouk Kim
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
File without changes
|