Browse Source

Merge tag '0.3.0' into develop

Intermediate build for Heroku and demo at SIDN

* tag '0.3.0':
  Use local patched gems instead of vanilla
  Package all gems to ensure heroku uses our patched versions
feature/region-slug-gone
Bèr Kessels 5 months ago
parent
commit
a5688dd224
100 changed files with 1988 additions and 11 deletions
  1. 0
    1
      .gitignore
  2. 2
    2
      Gemfile
  3. 22
    8
      Gemfile.lock
  4. BIN
      vendor/cache/actionpack-5.2.3.gem
  5. BIN
      vendor/cache/actionview-5.2.3.gem
  6. BIN
      vendor/cache/activesupport-5.2.3.gem
  7. BIN
      vendor/cache/addressable-2.7.0.gem
  8. BIN
      vendor/cache/ast-2.4.0.gem
  9. BIN
      vendor/cache/autoprefixer-rails-9.6.1.1.gem
  10. BIN
      vendor/cache/awesome_print-1.8.0.gem
  11. BIN
      vendor/cache/babosa-1.0.3.gem
  12. BIN
      vendor/cache/backports-3.15.0.gem
  13. BIN
      vendor/cache/better_errors-2.5.0.gem
  14. BIN
      vendor/cache/bootstrap-4.3.1.gem
  15. BIN
      vendor/cache/builder-3.2.3.gem
  16. BIN
      vendor/cache/byebug-10.0.2.gem
  17. BIN
      vendor/cache/capybara-3.29.0.gem
  18. BIN
      vendor/cache/childprocess-3.0.0.gem
  19. BIN
      vendor/cache/coderay-1.1.2.gem
  20. BIN
      vendor/cache/concurrent-ruby-1.1.5.gem
  21. BIN
      vendor/cache/crass-1.0.4.gem
  22. BIN
      vendor/cache/database_cleaner-1.7.0.gem
  23. BIN
      vendor/cache/dotenv-2.6.0.gem
  24. BIN
      vendor/cache/erubi-1.8.0.gem
  25. BIN
      vendor/cache/erubis-2.7.0.gem
  26. BIN
      vendor/cache/event_sourcery-0.22.0.gem
  27. BIN
      vendor/cache/event_sourcery-postgres-0.8.0.gem
  28. BIN
      vendor/cache/execjs-2.7.0.gem
  29. BIN
      vendor/cache/faraday-0.15.4.gem
  30. BIN
      vendor/cache/ffi-1.11.1.gem
  31. BIN
      vendor/cache/ffi-compiler-1.0.1.gem
  32. BIN
      vendor/cache/foreman-0.85.0.gem
  33. BIN
      vendor/cache/geokdtree-0.2.0.gem
  34. BIN
      vendor/cache/georuby-2.5.2.gem
  35. BIN
      vendor/cache/hashie-3.6.0.gem
  36. BIN
      vendor/cache/i18n-1.6.0.gem
  37. BIN
      vendor/cache/jaro_winkler-1.5.2.gem
  38. BIN
      vendor/cache/json-2.2.0.gem
  39. BIN
      vendor/cache/json_expressions-0.9.0.gem
  40. BIN
      vendor/cache/jsonapi-deserializable-0.2.0.gem
  41. BIN
      vendor/cache/jsonapi-rb-0.5.0.gem
  42. BIN
      vendor/cache/jsonapi-renderer-0.2.0.gem
  43. BIN
      vendor/cache/jsonapi-serializable-0.3.1.gem
  44. BIN
      vendor/cache/loofah-2.2.3.gem
  45. BIN
      vendor/cache/method_source-0.9.2.gem
  46. BIN
      vendor/cache/mini_mime-1.0.2.gem
  47. BIN
      vendor/cache/mini_portile2-2.3.0.gem
  48. BIN
      vendor/cache/minitest-5.11.3.gem
  49. BIN
      vendor/cache/minitest-have_tag-0.1.0.gem
  50. BIN
      vendor/cache/multi_json-1.13.1.gem
  51. BIN
      vendor/cache/multipart-post-2.0.0.gem
  52. BIN
      vendor/cache/mustermann-1.0.3.gem
  53. BIN
      vendor/cache/nio4r-2.5.2.gem
  54. BIN
      vendor/cache/nokogiri-1.8.5.gem
  55. 0
    0
      vendor/cache/nominatim-dec16d522405/.bundlecache
  56. 21
    0
      vendor/cache/nominatim-dec16d522405/.gitignore
  57. 2
    0
      vendor/cache/nominatim-dec16d522405/.rspec
  58. 7
    0
      vendor/cache/nominatim-dec16d522405/.travis.yml
  59. 15
    0
      vendor/cache/nominatim-dec16d522405/CHANGELOG.md
  60. 8
    0
      vendor/cache/nominatim-dec16d522405/Gemfile
  61. 13
    0
      vendor/cache/nominatim-dec16d522405/Guardfile
  62. 22
    0
      vendor/cache/nominatim-dec16d522405/LICENSE
  63. 113
    0
      vendor/cache/nominatim-dec16d522405/README.md
  64. 11
    0
      vendor/cache/nominatim-dec16d522405/Rakefile
  65. 36
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim.rb
  66. 83
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/address.rb
  67. 40
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/client.rb
  68. 52
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/configuration.rb
  69. 93
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/place.rb
  70. 30
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/point.rb
  71. 13
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/polygon.rb
  72. 16
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/response/parse_json.rb
  73. 44
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/reverse.rb
  74. 117
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/search.rb
  75. 3
    0
      vendor/cache/nominatim-dec16d522405/lib/nominatim/version.rb
  76. 51
    0
      vendor/cache/nominatim-dec16d522405/nominatim.gemspec
  77. 1
    0
      vendor/cache/nominatim-dec16d522405/spec/fixtures/reverse.json
  78. 1
    0
      vendor/cache/nominatim-dec16d522405/spec/fixtures/search.json
  79. 209
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/address_spec.rb
  80. 23
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/client_spec.rb
  81. 172
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/place_spec.rb
  82. 53
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/point_spec.rb
  83. 19
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/polygon_spec.rb
  84. 68
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/reverse_spec.rb
  85. 185
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim/search_spec.rb
  86. 66
    0
      vendor/cache/nominatim-dec16d522405/spec/nominatim_spec.rb
  87. 38
    0
      vendor/cache/nominatim-dec16d522405/spec/spec_helper.rb
  88. BIN
      vendor/cache/offline_geocoder-0.1.0.gem
  89. 0
    0
      vendor/cache/offline_geocoder/.bundlecache
  90. 13
    0
      vendor/cache/offline_geocoder/.gitignore
  91. 2
    0
      vendor/cache/offline_geocoder/.rspec
  92. 1
    0
      vendor/cache/offline_geocoder/.ruby-version
  93. 5
    0
      vendor/cache/offline_geocoder/.travis.yml
  94. 16
    0
      vendor/cache/offline_geocoder/945471470
  95. 7
    0
      vendor/cache/offline_geocoder/CONTRIBUTING.md
  96. 5
    0
      vendor/cache/offline_geocoder/Gemfile
  97. 202
    0
      vendor/cache/offline_geocoder/LICENSE
  98. 83
    0
      vendor/cache/offline_geocoder/README.md
  99. 5
    0
      vendor/cache/offline_geocoder/Rakefile
  100. 0
    0
      vendor/cache/offline_geocoder/bin/console

+ 0
- 1
.gitignore View File

@@ -1,4 +1,3 @@
*.gem
*.rbc
/.config
/coverage/

+ 2
- 2
Gemfile View File

@@ -13,9 +13,9 @@ gem 'hashie'
gem 'json_expressions'
gem 'jsonapi-rb'
gem 'nominatim', github: 'lukaszsliwa/nominatim'
gem 'offline_geocoder'
gem 'offline_geocoder', path: '../libs/offline_geocoder'
gem 'open-location-code', require: 'plus_code'
gem 'opening_hours_converter'
gem 'opening_hours_converter', path: '../libs/opening_hours_converter'
gem 'pagy'
gem 'rake'
gem 'rgeo-geojson'

+ 22
- 8
Gemfile.lock View File

@@ -6,6 +6,18 @@ GIT
faraday
multi_json

PATH
remote: ../libs/offline_geocoder
specs:
offline_geocoder (0.1.0)
geokdtree

PATH
remote: ../libs/opening_hours_converter
specs:
opening_hours_converter (1.13.7)
json

GEM
remote: https://rubygems.org/
specs:
@@ -70,14 +82,21 @@ GEM
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
foreman (0.85.0)
thor (~> 0.19.1)
geokdtree (0.2.0)
ffi
ffi-compiler
rake
georuby (2.5.2)
hashie (3.6.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.2)
json (2.1.0)
json (2.2.0)
json_expressions (0.9.0)
jsonapi-deserializable (0.2.0)
jsonapi-rb (0.5.0)
@@ -86,7 +105,6 @@ GEM
jsonapi-renderer (0.2.0)
jsonapi-serializable (0.3.1)
jsonapi-renderer (~> 0.2.0)
kdtree (0.4)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
@@ -103,11 +121,7 @@ GEM
nio4r (2.5.2)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
offline_geocoder (0.1.0)
kdtree (~> 0.3)
open-location-code (1.0.2)
opening_hours_converter (1.7.20)
json
pagy (3.7.1)
parallel (1.12.1)
parser (2.5.0.5)
@@ -234,9 +248,9 @@ DEPENDENCIES
minitest-have_tag
nokogiri
nominatim!
offline_geocoder
offline_geocoder!
open-location-code
opening_hours_converter
opening_hours_converter!
pagy
pry
puma

BIN
vendor/cache/actionpack-5.2.3.gem View File


BIN
vendor/cache/actionview-5.2.3.gem View File


BIN
vendor/cache/activesupport-5.2.3.gem View File


BIN
vendor/cache/addressable-2.7.0.gem View File


BIN
vendor/cache/ast-2.4.0.gem View File


BIN
vendor/cache/autoprefixer-rails-9.6.1.1.gem View File


BIN
vendor/cache/awesome_print-1.8.0.gem View File


BIN
vendor/cache/babosa-1.0.3.gem View File


BIN
vendor/cache/backports-3.15.0.gem View File


BIN
vendor/cache/better_errors-2.5.0.gem View File


BIN
vendor/cache/bootstrap-4.3.1.gem View File


BIN
vendor/cache/builder-3.2.3.gem View File


BIN
vendor/cache/byebug-10.0.2.gem View File


BIN
vendor/cache/capybara-3.29.0.gem View File


BIN
vendor/cache/childprocess-3.0.0.gem View File


BIN
vendor/cache/coderay-1.1.2.gem View File


BIN
vendor/cache/concurrent-ruby-1.1.5.gem View File


BIN
vendor/cache/crass-1.0.4.gem View File


BIN
vendor/cache/database_cleaner-1.7.0.gem View File


BIN
vendor/cache/dotenv-2.6.0.gem View File


BIN
vendor/cache/erubi-1.8.0.gem View File


BIN
vendor/cache/erubis-2.7.0.gem View File


BIN
vendor/cache/event_sourcery-0.22.0.gem View File


BIN
vendor/cache/event_sourcery-postgres-0.8.0.gem View File


BIN
vendor/cache/execjs-2.7.0.gem View File


BIN
vendor/cache/faraday-0.15.4.gem View File


BIN
vendor/cache/ffi-1.11.1.gem View File


BIN
vendor/cache/ffi-compiler-1.0.1.gem View File


BIN
vendor/cache/foreman-0.85.0.gem View File


BIN
vendor/cache/geokdtree-0.2.0.gem View File


BIN
vendor/cache/georuby-2.5.2.gem View File


BIN
vendor/cache/hashie-3.6.0.gem View File


BIN
vendor/cache/i18n-1.6.0.gem View File


BIN
vendor/cache/jaro_winkler-1.5.2.gem View File


BIN
vendor/cache/json-2.2.0.gem View File


BIN
vendor/cache/json_expressions-0.9.0.gem View File


BIN
vendor/cache/jsonapi-deserializable-0.2.0.gem View File


BIN
vendor/cache/jsonapi-rb-0.5.0.gem View File


BIN
vendor/cache/jsonapi-renderer-0.2.0.gem View File


BIN
vendor/cache/jsonapi-serializable-0.3.1.gem View File


BIN
vendor/cache/loofah-2.2.3.gem View File


BIN
vendor/cache/method_source-0.9.2.gem View File


BIN
vendor/cache/mini_mime-1.0.2.gem View File


BIN
vendor/cache/mini_portile2-2.3.0.gem View File


BIN
vendor/cache/minitest-5.11.3.gem View File


BIN
vendor/cache/minitest-have_tag-0.1.0.gem View File


BIN
vendor/cache/multi_json-1.13.1.gem View File


BIN
vendor/cache/multipart-post-2.0.0.gem View File


BIN
vendor/cache/mustermann-1.0.3.gem View File


BIN
vendor/cache/nio4r-2.5.2.gem View File


BIN
vendor/cache/nokogiri-1.8.5.gem View File


+ 0
- 0
vendor/cache/nominatim-dec16d522405/.bundlecache View File


+ 21
- 0
vendor/cache/nominatim-dec16d522405/.gitignore View File

@@ -0,0 +1,21 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
coverage
*.swp
*.swo
*.rvmrc

+ 2
- 0
vendor/cache/nominatim-dec16d522405/.rspec View File

@@ -0,0 +1,2 @@
--color
--format progress

+ 7
- 0
vendor/cache/nominatim-dec16d522405/.travis.yml View File

@@ -0,0 +1,7 @@
language: ruby
rvm:
- 2.0.0
- 1.9.3
- 1.9.2
- rbx-19mode
script: "bundle exec rake"

+ 15
- 0
vendor/cache/nominatim-dec16d522405/CHANGELOG.md View File

@@ -0,0 +1,15 @@
## v0.0.3

* Added Polygon class.

* Fixed few typos.

* Added documentation to Place class.

* Added Point class.

* Returning ids as integers instead of strings.

## v0.0.1

* Initial release.

+ 8
- 0
vendor/cache/nominatim-dec16d522405/Gemfile View File

@@ -0,0 +1,8 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in nominatim.gemspec
gemspec

gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler'

+ 13
- 0
vendor/cache/nominatim-dec16d522405/Guardfile View File

@@ -0,0 +1,13 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'bundler' do
watch('Gemfile')
watch(/^.+\.gemspec/)
end

guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end

+ 22
- 0
vendor/cache/nominatim-dec16d522405/LICENSE View File

@@ -0,0 +1,22 @@
Copyright (c) 2012 Jakub Svehla

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 113
- 0
vendor/cache/nominatim-dec16d522405/README.md View File

@@ -0,0 +1,113 @@
# Nominatim

A Ruby wrapper for the Nominatim API. [![Build Status](https://secure.travis-ci.org/jakubsvehla/nominatim.png?branch=master)](http://travis-ci.org/jakubsvehla/nominatim)

## Installation

Add this line to your application's Gemfile:

gem 'nominatim'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nominatim

## Documentation

[http://rdoc.info/gems/nominatim][documentation]

[documentation]: http://rdoc.info/gems/nominatim

## Usage

```ruby
places = Nominatim.search('San Francisco').limit(10).address_details(true)

for place in places
puts "#{place.display_name} (#{place.type})"
end

puts "Found #{places.count} places."
```

### Structured requests

```ruby
places = Nominatim.search.city('San Antonio').country('Mexico').limit(10).address_details(true)

for place in places
puts "#{place.display_name} (#{place.type})"
end

puts "Found #{places.count} places."
```

Nominatim::Search has the following methods to craft structures requests:

- street: accepts house number and street name as parameters
- city
- county
- state
- country
- postalcode

See http://wiki.openstreetmap.org/wiki/Nominatim#Parameters

## Configuration

```ruby
Nominatim.configure do |config|
config.email = 'your-email-address@example.com'
config.endpoint = 'http://open.mapquestapi.com/nominatim/v1'
end
```

## Contributing

1. [Fork the repository.][fork]
2. [Create a topic branch.][branch]
3. Add specs for your unimplemented feature or bug fix.
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
5. Implement your feature or bug fix.
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
7. Run `open coverage/index.html`. If your changes are not completely covered
by your tests, return to step 3.
8. Add, commit, and push your changes.
9. [Submit a pull request.][pr]

[fork]: http://help.github.com/fork-a-repo/
[branch]: http://learn.github.com/p/branching.html
[pr]: http://help.github.com/send-pull-requests/

## Supported Ruby Versions

Nominatim is tested under 1.9.2 and 1.9.3.

## Copyright

Copyright (c) 2012 Jakub Svehla

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 11
- 0
vendor/cache/nominatim-dec16d522405/Rakefile View File

@@ -0,0 +1,11 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

task :test => :spec
task :default => :spec

require 'yard'
YARD::Rake::YardocTask.new

+ 36
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim.rb View File

@@ -0,0 +1,36 @@
require "nominatim/version"
require "nominatim/configuration"
require "nominatim/point"
require "nominatim/polygon"
require "nominatim/address"
require "nominatim/place"
require "nominatim/response/parse_json"
require "nominatim/client"
require "nominatim/search"
require "nominatim/reverse"

module Nominatim

# @return [Nominatim::Search]
def self.search(q = nil)
search = Nominatim::Search.new
search.query(q) if q
search
end

# @return [Nominatim::Reverse]
def self.reverse(lat = nil, lon = nil)
search = Nominatim::Reverse.new
search.lat(lat).lon(lon) if lat && lon
search
end

# @return [Nominatim::Configuration]
def self.config
@config ||= Configuration.new
end

def self.configure(&block)
config.configure &block
end
end

+ 83
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/address.rb View File

@@ -0,0 +1,83 @@
module Nominatim
class Address
def initialize(attrs = {})
@attrs = attrs
end

def attraction
@attraction ||= @attrs[:attraction]
end

def clothes
@clothes ||= @attrs[:clothes]
end

def house_number
@house_number ||= @attrs[:house_number]
end

def road
@road ||= @attrs[:road]
end

def commercial
@commercial ||= @attrs[:commercial]
end

def pedestrian
@pedestrian ||= @attrs[:pedestrian]
end

def suburb
@suburb ||= @attrs[:suburb]
end

def city_district
@city_district ||= @attrs[:city_district]
end

def city
@city ||= @attrs[:city]
end

def administrative
@administrative ||= @attrs[:administrative]
end

def county
@county ||= @attrs[:county]
end

def state_district
@state_district ||= @attrs[:state_district]
end

def state
@state ||= @attrs[:state]
end

def postcode
@postcode ||= @attrs[:postcode]
end

def country
@country ||= @attrs[:country]
end

def country_code
@country_code ||= @attrs[:country_code]
end

def place
@place ||= @attrs[:place]
end

def town
@town ||= @attrs[:town]
end

def village
@village ||= @attrs[:village]
end
end
end

+ 40
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/client.rb View File

@@ -0,0 +1,40 @@
require 'faraday'

module Nominatim
class Client

# Performs an HTTP GET request
def get(path, params = {})
connection.get path, params
end

private

# Returns a Faraday::Connection object
#
# @return [Faraday::Connection]
def connection
return @connection if defined? @connection

options = {
request: {
timeout: Nominatim.config.timeout
}
}

@connection = Faraday.new Nominatim.config.endpoint, options do |builder|
builder.use Nominatim::Response::ParseJson
builder.adapter Faraday.default_adapter
end

@connection.params[:format] = 'json'
@connection.params[:email] = Nominatim.config.email if Nominatim.config.email
@connection.params[:key] = Nominatim.config.key if Nominatim.config.key

@connection.headers[:user_agent] = Nominatim.config.user_agent
@connection.headers[:"accept-language"] = Nominatim.config.accept_language

@connection
end
end
end

+ 52
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/configuration.rb View File

@@ -0,0 +1,52 @@
module Nominatim
class Configuration

DEFAULT_ENDPOINT = 'https://nominatim.openstreetmap.org'

DEFAULT_KEY = nil

DEFAULT_USER_AGENT = "Nominatim Ruby Gem #{Nominatim::VERSION}"

DEFAULT_EMAIL = nil

DEFAULT_LANGUAGE = 'en'

DEFAULT_TIMEOUT = nil

DEFAULT_SEARCH_URL = 'search'
DEFAULT_REVERSE_URL = 'reverse'

VALID_OPTIONS_KEYS = [
:endpoint,
:key,
:user_agent,
:email,
:accept_language,
:timeout,
:search_url,
:reverse_url
]

attr_accessor *VALID_OPTIONS_KEYS

def initialize
reset!
end

def configure
yield self
self
end

def reset!
self.endpoint = DEFAULT_ENDPOINT
self.key = DEFAULT_KEY
self.user_agent = DEFAULT_USER_AGENT
self.email = DEFAULT_EMAIL
self.accept_language = DEFAULT_LANGUAGE
self.timeout = DEFAULT_TIMEOUT
self.search_url = DEFAULT_SEARCH_URL
self.reverse_url = DEFAULT_REVERSE_URL
end
end
end

+ 93
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/place.rb View File

@@ -0,0 +1,93 @@
module Nominatim
class Place
# attr_reader :attrs
# alias to_hash attrs

def initialize(attrs = {})
@attrs = attrs
end

# Return display name
#
# @return [String]
def display_name
@display_name ||= @attrs[:display_name]
end

# Return a class
#
# @return [String]
def class
@class ||= @attrs[:class]
end

# Return a type
#
# @return [String]
def type
@type ||= @attrs[:type]
end

# Return an address
#
# @return [Nominatim::Address]
def address
@address ||= Nominatim::Address.new(@attrs[:address]) if @attrs[:address]
end

# Return a latitude
#
# @return [Float]
def lat
point.lat
end
alias latitude lat

# Return a longitude
#
# @return [Float]
def lon
point.lon
end
alias longitude lon

def boundingbox
@boundingbox ||= @attrs[:boundingbox]
end
alias bounding_box boundingbox

# Return a polygon
#
# @return [Nominatim::Polygon]
def polygonpoints
@polygonpoints ||= Nominatim::Polygon.new(@attrs[:polygonpoints]) if @attrs[:polygonpoints]
end

# Return a place id
#
# @return [Integer]
def place_id
@place_id ||= @attrs[:place_id].to_i if @attrs[:place_id]
end

# Return an OSM id
#
# @return [Integer]
def osm_id
@osm_id ||= @attrs[:osm_id].to_i if @attrs[:osm_id]
end

# Return an OSM type
#
# @return [String]
def osm_type
@osm_type ||= @attrs[:osm_type]
end

private

def point
@point ||= Nominatim::Point.new(@attrs[:lat], @attrs[:lon])
end
end
end

+ 30
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/point.rb View File

@@ -0,0 +1,30 @@
module Nominatim
class Point
attr_reader :lat, :lon
alias latitude lat
alias longitude lon

# @param lat [Float]
# @param lon [Float]
def initialize(lat, lon)
@lat, @lon = lat.to_f, lon.to_f if lat && lon
end

# @return [Array]
def to_a
[lat, lon]
end

# Return a string representation of the point
#
# @return [String]
def to_s
to_a.to_s
end

# @return [true, false]
def ==(other)
self.to_a == other.to_a
end
end
end

+ 13
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/polygon.rb View File

@@ -0,0 +1,13 @@
module Nominatim
class Polygon
attr_reader :coordinates

# @param coordinates [Array<Array<Float, String>>]
def initialize(coordinates)
@coordinates = []
coordinates.each do |c|
@coordinates.push(Nominatim::Point.new(c[0], c[1]))
end
end
end
end

+ 16
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/response/parse_json.rb View File

@@ -0,0 +1,16 @@
require 'faraday'
require 'multi_json'

module Nominatim
module Response
class ParseJson < Faraday::Response::Middleware
def on_complete(env)
if env[:body].empty?
env[:body] = nil
else
env[:body] = MultiJson.load(env[:body], symbolize_keys: true)
end
end
end
end
end

+ 44
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/reverse.rb View File

@@ -0,0 +1,44 @@
module Nominatim
class Reverse < Client
attr_reader :criteria

def initialize
@criteria = {}
end

# Returns search result or nil if no results received.
def fetch
body = get(Nominatim.config.reverse_url, @criteria).body
return nil if body.empty?
Nominatim::Place.new(body)
end

# Latitude string to search for.
#
# @param lat [String] Latitude
# @return [Nominatim::Reverse]
def lat(lat)
@criteria[:lat] = lat
self
end

# Longitude string to search for.
#
# @param lon [String] Longitude
# @return [Nominatim::Reverse]
def lon(lon)
@criteria[:lon] = lon
self
end

# Include a breakdown of the address into elements.
#
# @param bool [true, false]
# @return [Nominatim::Reverse]
def address_details(bool)
@criteria[:addressdetails] = bool ? 1 : 0
self
end

end
end

+ 117
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/search.rb View File

@@ -0,0 +1,117 @@
module Nominatim
class Search < Client
include Enumerable
attr_reader :criteria

def initialize
@criteria = {}
end

# Iterates over the search results.
def each(&block)
@criteria.delete(:q) if (@criteria.keys & [:street, :city, :county, :state, :country, :postalcode]).count > 0
@results ||= get(Nominatim.config.search_url, @criteria).body.map! { |attrs| Nominatim::Place.new(attrs) }
@results.each(&block)
end

# Structured search requests
# @see https://wiki.openstreetmap.org/wiki/Nominatim
%w(city county state country postalcode).to_a.each do |criterion|
define_method(criterion) do |param|
@criteria[criterion.to_sym] = param
self
end
end

# Structured street search request
#
# @see https://wiki.openstreetmap.org/wiki/Nominatim
def street housenumber, streetname
@criteria[:street] = "#{housenumber} #{streetname}"
self
end

# Query string to search for.
#
# @param q [String] Query string
# @return [Nominatim::Search]
def query(q)
@criteria[:q] = q
self
end

# Limit search results to a specific country (or a list of countries).
#
# @param codes [Array<String>, String]
# @see https://wiki.openstreetmap.org/wiki/Nominatim
# @return [Nominatim::Search]
def country_codes(codes)
if codes.instance_of? Array
@criteria[:countrycodes] = codes.join(',')
else
@criteria[:countrycodes] = codes
end
self
end

# The preferred area to find search results.
#
# @param viewbox [Array<String>]
# @return [Nominatim::Search]
def viewbox(viewbox)
@criteria[:viewbox] = viewbox.join(',')
self
end

# Restrict the results to only items contained with the bounding box.
#
# @param bool [true, false]
# @see https://wiki.openstreetmap.org/wiki/Nominatim
# @return [Nominatim::Search]
def bounded(bool)
@criteria[:bounded] = bool ? 1 : 0
self
end

# Output polygon outlines for items found.
#
# @param bool [true, false]
# @return [Nominatim::Search]
def polygon(bool)
@criteria[:polygon] = bool ? 1 : 0
self
end

# Include a breakdown of the address into elements.
#
# @param bool [true, false]
# @return [Nominatim::Search]
def address_details(bool)
@criteria[:addressdetails] = bool ? 1 : 0
self
end

# Exclude given place ids from the search result.
#
# @param ids [Array<String>, String] Place ids
# @return [Nominatim::Search]
def exclude_place_ids(ids)
if ids.instance_of? Array
@criteria[:exclude_place_ids] = ids.join(',')
else
@criteria[:exclude_place_ids] = ids
end
self
end

# Limit the number of returned results.
#
# @param limit [Integer]
# @return [Nominatim::Search]
def limit(limit)
@criteria[:limit] = limit
self
end

end
end

+ 3
- 0
vendor/cache/nominatim-dec16d522405/lib/nominatim/version.rb View File

@@ -0,0 +1,3 @@
module Nominatim
VERSION = "0.0.6"
end

+ 51
- 0
vendor/cache/nominatim-dec16d522405/nominatim.gemspec View File

@@ -0,0 +1,51 @@
# -*- encoding: utf-8 -*-
# stub: nominatim 0.0.6 ruby lib

Gem::Specification.new do |s|
s.name = "nominatim".freeze
s.version = "0.0.6"

s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Jakub Svehla".freeze]
s.date = "2020-01-15"
s.description = "A Ruby wrapper for the Nominatim API.".freeze
s.email = ["jakub.svehla@gmail.com".freeze]
s.files = [".gitignore".freeze, ".rspec".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Guardfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "lib/nominatim.rb".freeze, "lib/nominatim/address.rb".freeze, "lib/nominatim/client.rb".freeze, "lib/nominatim/configuration.rb".freeze, "lib/nominatim/place.rb".freeze, "lib/nominatim/point.rb".freeze, "lib/nominatim/polygon.rb".freeze, "lib/nominatim/response/parse_json.rb".freeze, "lib/nominatim/reverse.rb".freeze, "lib/nominatim/search.rb".freeze, "lib/nominatim/version.rb".freeze, "nominatim.gemspec".freeze, "spec/fixtures/reverse.json".freeze, "spec/fixtures/search.json".freeze, "spec/nominatim/address_spec.rb".freeze, "spec/nominatim/client_spec.rb".freeze, "spec/nominatim/place_spec.rb".freeze, "spec/nominatim/point_spec.rb".freeze, "spec/nominatim/polygon_spec.rb".freeze, "spec/nominatim/reverse_spec.rb".freeze, "spec/nominatim/search_spec.rb".freeze, "spec/nominatim_spec.rb".freeze, "spec/spec_helper.rb".freeze]
s.homepage = "https://github.com/jakubsvehla/nominatim".freeze
s.rubygems_version = "3.0.4".freeze
s.summary = "A Ruby wrapper for the Nominatim API.".freeze
s.test_files = ["spec/fixtures/reverse.json".freeze, "spec/fixtures/search.json".freeze, "spec/nominatim/address_spec.rb".freeze, "spec/nominatim/client_spec.rb".freeze, "spec/nominatim/place_spec.rb".freeze, "spec/nominatim/point_spec.rb".freeze, "spec/nominatim/polygon_spec.rb".freeze, "spec/nominatim/reverse_spec.rb".freeze, "spec/nominatim/search_spec.rb".freeze, "spec/nominatim_spec.rb".freeze, "spec/spec_helper.rb".freeze]

s.installed_by_version = "3.0.4" if s.respond_to? :installed_by_version

if s.respond_to? :specification_version then
s.specification_version = 4

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<faraday>.freeze, [">= 0"])
s.add_runtime_dependency(%q<multi_json>.freeze, [">= 0"])
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
s.add_development_dependency(%q<rspec>.freeze, ["~> 2.10"])
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
s.add_development_dependency(%q<yard>.freeze, [">= 0"])
else
s.add_dependency(%q<faraday>.freeze, [">= 0"])
s.add_dependency(%q<multi_json>.freeze, [">= 0"])
s.add_dependency(%q<rake>.freeze, [">= 0"])
s.add_dependency(%q<rspec>.freeze, ["~> 2.10"])
s.add_dependency(%q<webmock>.freeze, [">= 0"])
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
s.add_dependency(%q<yard>.freeze, [">= 0"])
end
else
s.add_dependency(%q<faraday>.freeze, [">= 0"])
s.add_dependency(%q<multi_json>.freeze, [">= 0"])
s.add_dependency(%q<rake>.freeze, [">= 0"])
s.add_dependency(%q<rspec>.freeze, ["~> 2.10"])
s.add_dependency(%q<webmock>.freeze, [">= 0"])
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
s.add_dependency(%q<yard>.freeze, [">= 0"])
end
end

+ 1
- 0
vendor/cache/nominatim-dec16d522405/spec/fixtures/reverse.json View File

@@ -0,0 +1 @@
{"place_id":"13686660","licence":"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.","osm_type":"node","osm_id":"1241690521","lat":"37.733976","lon":"-122.3912081","display_name":"4900, 3rd Street, San Francisco, California, 94124, United States of America","address":{"house_number":"4900","road":"3rd Street","city":"San Francisco","county":"San Francisco","state":"California","postcode":"94124","country":"United States of America","country_code":"us"}}

+ 1
- 0
vendor/cache/nominatim-dec16d522405/spec/fixtures/search.json
File diff suppressed because it is too large
View File


+ 209
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/address_spec.rb View File

@@ -0,0 +1,209 @@
require 'spec_helper'

describe Nominatim::Address do

describe '#attraction' do
it 'returns a attraction when set with attraction' do
address = Nominatim::Address.new(attraction: 'Eiffel Tower')
address.attraction.should eq 'Eiffel Tower'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.attraction.should be_nil
end
end

describe '#clothes' do
it 'returns clothes when set with clothes' do
address = Nominatim::Address.new(clothes: 'XXI')
address.clothes.should eq 'XXI'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.clothes.should be_nil
end
end

describe '#house_number' do
it 'returns a house number when set with house_number' do
address = Nominatim::Address.new(house_number: 1)
address.house_number.should eq 1
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.house_number.should be_nil
end
end

describe '#road' do
it 'returns a road when set with road' do
address = Nominatim::Address.new(road: 'Infinite Loop')
address.road.should eq 'Infinite Loop'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.road.should be_nil
end
end

describe '#commercial' do
it 'returns a commercial when set with commercial' do
address = Nominatim::Address.new(commercial: 'Apple, Inc.')
address.commercial.should eq 'Apple, Inc.'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.commercial.should be_nil
end
end

describe '#pedestrian' do
it 'returns a pedestrian when set with pedestrian' do
address = Nominatim::Address.new(pedestrian: 'Avenue Pierre Loti')
address.pedestrian.should eq 'Avenue Pierre Loti'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.pedestrian.should be_nil
end
end

describe '#suburb' do
it 'returns a suburb when set with suburb' do
address = Nominatim::Address.new(suburb: 'Quartier du Gros Caillou')
address.suburb.should eq 'Quartier du Gros Caillou'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.suburb.should be_nil
end
end

describe '#city_district' do
it 'returns a city district when set with city_district' do
address = Nominatim::Address.new(city_district: '7th Arrondissement')
address.city_district.should eq '7th Arrondissement'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.city_district.should be_nil
end
end

describe '#city' do
it 'returns a city when set with city' do
address = Nominatim::Address.new(city: 'Santa Clara')
address.city.should eq 'Santa Clara'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.city.should be_nil
end
end

describe '#administrative' do
it 'returns a administrative when set with administrative' do
address = Nominatim::Address.new(administrative: 'Paris')
address.administrative.should eq 'Paris'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.administrative.should be_nil
end
end

describe '#county' do
it 'returns a county when set with county' do
address = Nominatim::Address.new(county: 'Santa Clara County')
address.county.should eq 'Santa Clara County'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.county.should be_nil
end
end

describe '#state_district' do
it 'returns a state disctrict when set with state_district' do
address = Nominatim::Address.new(state_district: 'West Midlands')
address.state_district.should eq 'West Midlands'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.state_district.should be_nil
end
end

describe '#state' do
it 'returns a state when set with state' do
address = Nominatim::Address.new(state: 'California')
address.state.should eq 'California'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.state.should be_nil
end
end

describe '#postcode' do
it 'returns a postcode when set with postcode' do
address = Nominatim::Address.new(postcode: '95014')
address.postcode.should eq '95014'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.postcode.should be_nil
end
end

describe '#country' do
it 'returns a country when set with country' do
address = Nominatim::Address.new(country: 'United States of America')
address.country.should eq 'United States of America'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.country.should be_nil
end
end

describe '#country_code' do
it 'returns a country code when set with country_code' do
address = Nominatim::Address.new(country_code: 'us')
address.country_code.should eq 'us'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.country_code.should be_nil
end
end

describe '#place' do
it 'returns a place when set with place' do
address = Nominatim::Address.new(place: 'Europe')
address.place.should eq 'Europe'
end

it 'returns nil when not set' do
address = Nominatim::Address.new
address.place.should be_nil
end
end

end

+ 23
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/client_spec.rb View File

@@ -0,0 +1,23 @@
require 'spec_helper'

describe Nominatim::Client do
after do
WebMock.reset!
end

describe '#get' do
before do
stub_get('/search').to_return(body: "[]")
end

it 'requests the correct resource' do
Nominatim::Client.new.get('/search')
a_get('/search').should have_been_requested
end

it 'parses the body' do
response = Nominatim::Client.new.get('/search')
response.body.should eq []
end
end
end

+ 172
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/place_spec.rb View File

@@ -0,0 +1,172 @@
require 'spec_helper'

describe Nominatim::Place do
describe '#display_name' do
it 'returns a full name when set with display_name' do
place = Nominatim::Place.new(display_name: 'Los Angeles, California, United States of America')
place.display_name.should eq 'Los Angeles, California, United States of America'
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.display_name.should be_nil
end
end

describe '#class' do
it 'returns a class when set with class' do
place = Nominatim::Place.new(class: 'place')
place.class.should eq 'place'
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.class.should be_nil
end
end

describe '#type' do
it 'returns a type when set with type' do
place = Nominatim::Place.new(type: 'county')
place.type.should eq 'county'
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.type.should be_nil
end
end

describe '#address' do
it 'returns a Nominatim::Address when set' do
place = Nominatim::Place.new(address: {county: 'Los Angeles', state: 'California', country: 'United States of America'})
place.address.should be_a Nominatim::Address
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.address.should be_nil
end
end

describe '#lat' do
it 'returns a latitude when set with lat' do
place = Nominatim::Place.new(lat: '52.5487969264788', lon: '-1.81642935385411')
place.lat.should eq 52.5487969264788
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.lat.should be_nil
end
end

describe '#latitude' do
it 'returns a latitude when set with lat' do
place = Nominatim::Place.new(lat: '52.5487969264788', lon: '-1.81642935385411')
place.latitude.should eq 52.5487969264788
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.latitude.should be_nil
end
end

describe '#lon' do
it 'returns a longitude when set with lon' do
place = Nominatim::Place.new(lat: '52.5487969264788', lon: '-1.81642935385411')
place.lon.should eq -1.81642935385411
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.lon.should be_nil
end
end

describe '#longitude' do
it 'returns a longitude when set with lon' do
place = Nominatim::Place.new(lat: '52.5487969264788', lon: '-1.81642935385411')
place.longitude.should eq -1.81642935385411
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.longitude.should be_nil
end
end

describe '#boundingbox' do
it 'returns a boundingbox when set with boundingbox' do
place = Nominatim::Place.new(boundingbox: ["52.5487442016602", "52.5488510131836", "-1.81651306152344", "-1.81634628772736"])
place.boundingbox.should eq ["52.5487442016602", "52.5488510131836", "-1.81651306152344", "-1.81634628772736"]
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.boundingbox.should be_nil
end
end

describe '#bounding_box' do
it 'returns a bounding box when set with boundingbox' do
place = Nominatim::Place.new(boundingbox: ["52.5487442016602", "52.5488510131836", "-1.81651306152344", "-1.81634628772736"])
place.bounding_box.should eq ["52.5487442016602", "52.5488510131836", "-1.81651306152344", "-1.81634628772736"]
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.bounding_box.should be_nil
end
end

describe '#polygonpoints' do
it 'returns polygon points when set with polygonpoints' do
place = Nominatim::Place.new(polygonpoints: [["-1.816513", "52.5487566"], ["-1.8164913", "52.548824"], ["-1.8164685", "52.5488213"]])
place.polygonpoints.should be_a Nominatim::Polygon
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.polygonpoints.should be_nil
end
end

describe '#place_id' do
it 'returns a place id when set with place_id' do
place = Nominatim::Place.new(place_id: '84327444')
place.place_id.should eq 84327444
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.place_id.should be_nil
end
end

describe '#osm_id' do
it 'returns an osm id when set with osm_id' do
place = Nominatim::Place.new(osm_id: '90394480')
place.osm_id.should eq 90394480
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.osm_id.should be_nil
end
end

describe '#osm_type' do
it 'returns an osm type when set with osm_type' do
place = Nominatim::Place.new(osm_type: 'way')
place.osm_type.should eq 'way'
end

it 'returns nil when not set' do
place = Nominatim::Place.new
place.osm_type.should be_nil
end
end

end

+ 53
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/point_spec.rb View File

@@ -0,0 +1,53 @@
require 'spec_helper'

describe Nominatim::Point do
let(:point) { Nominatim::Point.new(52.5487969264788, -1.81642935385411) }

describe '#lat' do
it 'returns the latitude' do
point.lat.should eq 52.5487969264788
end
end

describe '#latitude' do
it 'returns the latitude' do
point.latitude.should eq 52.5487969264788
end
end

describe '#lon' do
it 'returns the longitude' do
point.lon.should eq -1.81642935385411
end
end

describe '#longitude' do
it 'returns the longitude' do
point.longitude.should eq -1.81642935385411
end
end

describe '#to_a' do
it 'returns an array representing the point' do
point.to_a.should eq [52.5487969264788, -1.81642935385411]
end
end

describe '#to_s' do
it 'returns a string representing the point' do
point.to_s.should eq '[52.5487969264788, -1.81642935385411]'
end
end

describe '#==' do
it 'returns true when objects coordinates are the same' do
other = Nominatim::Point.new(52.5487969264788, -1.81642935385411)
(point == other).should be_true
end

it 'returns false when objects coordinates are different' do
other = Nominatim::Point.new(-1.81642935385411, 52.5487969264788)
(point == other).should be_false
end
end
end

+ 19
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/polygon_spec.rb View File

@@ -0,0 +1,19 @@
require 'spec_helper'

describe Nominatim::Polygon do

let(:polygon) { Nominatim::Polygon.new([[-1.816513, 52.5487566], [-1.8164913, 52.548824], [-1.8164685, 52.5488213]]) }

it 'sets coordinates correctly' do
polygon.coordinates.first.lat.should eq -1.816513
polygon.coordinates.first.lon.should eq 52.5487566
end

describe '#coordinates' do
it 'retruns an array of coordinates' do
polygon.coordinates.each do |p|
p.should be_a Nominatim::Point
end
end
end
end

+ 68
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/reverse_spec.rb View File

@@ -0,0 +1,68 @@
require 'spec_helper'

describe Nominatim::Reverse do

let(:reverse) { Nominatim::Reverse.new }

it 'has no criteria set' do
reverse.criteria.should be_empty
end

it 'allows chaining of criterions' do
reverse.lat('37.733976').lon('-122.3912081').address_details(1)
reverse.criteria[:lat].should eq '37.733976'
reverse.criteria[:lon].should eq '-122.3912081'
reverse.criteria[:addressdetails].should eq 1
end

describe '#each' do
let(:reverse) { Nominatim::Reverse.new.lat('37.733976').lon('-122.3912081').address_details(1) }

before do
stub_get('/reverse').
with(query: { lat: '37.733976', lon: '-122.3912081', addressdetails: 1 }).
to_return(body: fixture('reverse.json'))
end

it 'iterates over the matching places' do
reverse.fetch.should be_a Nominatim::Place
end

it 'returns correct places' do
reverse.fetch.display_name.should eq '4900, 3rd Street, San Francisco, California, 94124, United States of America'
reverse.fetch.address.city.should eq 'San Francisco'
reverse.fetch.address.state.should eq 'California'
end
end

describe '#lat' do
it 'adds a latitude criterion' do
reverse.lat('37.733976')
reverse.criteria[:lat].should eq '37.733976'
end
end

describe '#lon' do
it 'adds a longitude criterion' do
reverse.lon('-122.3912081')
reverse.criteria[:lon].should eq '-122.3912081'
end
end

describe '#address_details' do
it 'adds an address details criterion' do
reverse.address_details(true)
reverse.criteria[:addressdetails].should eq 1
end

it 'sets 1 when set with true' do
reverse.address_details(true)
reverse.criteria[:addressdetails].should eq 1
end

it 'sets 0 when set with false' do
reverse.address_details(false)
reverse.criteria[:addressdetails].should eq 0
end
end
end

+ 185
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim/search_spec.rb View File

@@ -0,0 +1,185 @@
require 'spec_helper'

describe Nominatim::Search do

let(:search) { Nominatim::Search.new }

it 'has no criteria set' do
search.criteria.should be_empty
end

it 'allows chaining of criterions' do
search.query('Los Angeles').limit(1)
search.criteria[:q].should eq 'Los Angeles'
search.criteria[:limit].should eq 1
end

describe '#each' do

let(:search) { Nominatim::Search.new.query('Los Angeles').limit(1) }

let(:structured_search){ Nominatim::Search.new.query('Text').city('Los Angeles').country('us').limit(1) }

before do
stub_get('/search').
with(query: { q: 'Los Angeles', limit: 1 }).
to_return(body: fixture('search.json'))
stub_get('/search').
with(query: { city: 'Los Angeles', country: 'us', limit: 1 }).
to_return(body: fixture('search.json'))
end

it 'iterates over the matching places' do
search.each do |place|
place.should be_a Nominatim::Place
end
end

it 'returns all matching places' do
search.count.should eq 1
end

it 'returns correct places' do
search.first.display_name.should eq 'Los Angeles, California, United States of America'
search.first.lat.should eq 34.0966764
search.first.lon.should eq -117.7196785
end

it 'omits q parameter from structured search' do
structured_search.first.display_name.should eq 'Los Angeles, California, United States of America'
structured_search.first.lat.should eq 34.0966764
structured_search.first.lon.should eq -117.7196785
end
end

describe '#query' do
it 'adds a query criterion' do
search.query('Los Angeles')
search.criteria[:q].should eq 'Los Angeles'
end
end

describe '#country_codes' do
it 'adds a country codes criterion' do
search.country_codes('us')
search.criteria[:countrycodes].should eq 'us'
end

it 'adds all country codes when set with an array' do
search.country_codes(['us', 'ca'])
search.criteria[:countrycodes].should eq 'us,ca'
end
end

describe '#viewbox' do
it 'adds a viewbox criterion' do
search.viewbox(["52.5487442016602", "-1.81651306152344", "52.5488510131836", "-1.81634628772736"])
search.criteria[:viewbox].should eq "52.5487442016602,-1.81651306152344,52.5488510131836,-1.81634628772736"
end
end

describe '#street' do
it 'adds a street criterion' do
search.street('1000', 'street name')
search.criteria[:street].should eq "1000 street name"
end
end
describe '#city' do
it 'adds a city criterion' do
search.city('City name')
search.criteria[:city].should eq "City name"
end
end
describe '#county' do
it 'adds a county criterion' do
search.county('County name')
search.criteria[:county].should eq "County name"
end
end

describe '#state' do
it 'adds a state criterion' do
search.state('State name')
search.criteria[:state].should eq "State name"
end
end

describe '#country' do
it 'adds a country criterion' do
search.country('Country name')
search.criteria[:country].should eq "Country name"
end
end


describe '#bounded' do
it 'adds a bounded criterion' do
search.bounded(true)
search.criteria[:bounded].should eq 1
end

it 'sets 1 when set with true' do
search.bounded(true)
search.criteria[:bounded].should eq 1
end

it 'sets 0 when set with false' do
search.bounded(false)
search.criteria[:bounded].should eq 0
end
end

describe '#polygon' do
it 'adds a polygon criterion' do
search.polygon(true)
search.criteria[:polygon].should eq 1
end

it 'sets 1 when set with true' do
search.polygon(true)
search.criteria[:polygon].should eq 1
end

it 'sets 0 when set with false' do
search.polygon(false)
search.criteria[:polygon].should eq 0
end
end

describe '#address_details' do
it 'adds an address details criterion' do
search.address_details(true)
search.criteria[:addressdetails].should eq 1
end

it 'sets 1 when set with true' do
search.address_details(true)
search.criteria[:addressdetails].should eq 1
end

it 'sets 0 when set with false' do
search.address_details(false)
search.criteria[:addressdetails].should eq 0
end
end

describe '#exclude_place_ids' do
it 'excludes given place ids' do
search.exclude_place_ids('1')
search.criteria[:exclude_place_ids].should eq '1'
end

it 'adds all place ids when set with an array' do
search.exclude_place_ids(['1', '2', '3'])
search.criteria[:exclude_place_ids].should eq '1,2,3'
end
end

describe '#limit' do
it 'adds a limit criterion' do
search.limit(1)
search.criteria[:limit].should eq 1
end
end

end

+ 66
- 0
vendor/cache/nominatim-dec16d522405/spec/nominatim_spec.rb View File

@@ -0,0 +1,66 @@
require 'spec_helper'

describe Nominatim do
describe '.search' do
it 'returns a Nominatim::Search' do
Nominatim.search.should be_a Nominatim::Search
end

it 'adds a query criterion if given as a parameter' do
search = Nominatim.search('San Francisco')
search.criteria[:q].should eq 'San Francisco'
end
end

describe '.reverse' do
it 'returns a Nominatim::Reverse' do
Nominatim.reverse.should be_a Nominatim::Reverse
end

it 'adds a reverse query criteria if given as a parameters' do
reverse = Nominatim.reverse('37.733976', '-122.3912081')
reverse.criteria[:lat].should eq '37.733976'
reverse.criteria[:lon].should eq '-122.3912081'
end
end

describe '.configure' do

before do
Nominatim.config.reset!
end

it 'has a default endpoint' do
Nominatim.config.endpoint.should eq "https://nominatim.openstreetmap.org"
end

it 'sets the endpoint' do
Nominatim.configure do |config|
config.endpoint = "http://nominatim.org/"
end
Nominatim.config.endpoint.should eq "http://nominatim.org/"
end

it 'has a default user agent' do
Nominatim.config.user_agent.should eq "Nominatim Ruby Gem #{Nominatim::VERSION}"
end

it 'sets the user agent' do
Nominatim.configure do |config|
config.user_agent = "MyApp"
end
Nominatim.config.user_agent.should eq "MyApp"
end

it 'has a default email' do
Nominatim.config.email.should be_nil
end

it 'sets the email' do
Nominatim.configure do |config|
config.email = "foo@bar.com"
end
Nominatim.config.email.should eq "foo@bar.com"
end
end
end

+ 38
- 0
vendor/cache/nominatim-dec16d522405/spec/spec_helper.rb View File

@@ -0,0 +1,38 @@
unless ENV['CI']
require 'simplecov'

SimpleCov.start do
add_filter 'spec'
end
end

require 'nominatim'
require 'webmock/rspec'

WebMock.disable_net_connect!

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus

config.before do
Nominatim.config.reset!
end
end

def a_get(path)
a_request(:get, "#{Nominatim.config.endpoint}#{path}").with(query: { format: 'json' })
end

def stub_get(path)
stub_request(:get, "#{Nominatim.config.endpoint}#{path}").with(query: { format: 'json' })
end

def fixture_path
File.expand_path('../fixtures', __FILE__)
end

def fixture(file)
File.new(fixture_path + '/' + file)
end

BIN
vendor/cache/offline_geocoder-0.1.0.gem View File


+ 0
- 0
vendor/cache/offline_geocoder/.bundlecache View File


+ 13
- 0
vendor/cache/offline_geocoder/.gitignore View File

@@ -0,0 +1,13 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
/*gem

# Ignore RubyMine files
/.idea/

+ 2
- 0
vendor/cache/offline_geocoder/.rspec View File

@@ -0,0 +1,2 @@
--format documentation
--color

+ 1
- 0
vendor/cache/offline_geocoder/.ruby-version View File

@@ -0,0 +1 @@
2.6.5

+ 5
- 0
vendor/cache/offline_geocoder/.travis.yml View File

@@ -0,0 +1,5 @@
language: ruby
rvm:
- 2.6.5
before_install:
- gem install bundler

+ 16
- 0
vendor/cache/offline_geocoder/945471470 View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.7.5 (17453 thorn-01.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<node id="945471470" visible="true" version="6" changeset="73694109" timestamp="2019-08-24T11:19:46Z" user="wheelmap_visitor" uid="290680" lat="51.6902270" lon="5.2966174">
<tag k="addr:city" v="'s-Hertogenbosch"/>
<tag k="addr:housenumber" v="24"/>
<tag k="addr:postcode" v="5211TW"/>
<tag k="addr:street" v="Stationsweg"/>
<tag k="name" v="Jan de Groot"/>
<tag k="shop" v="bakery"/>
<tag k="source" v="BAG"/>
<tag k="source:date" v="2014-02-11"/>
<tag k="toilets:wheelchair" v="no"/>
<tag k="website" v="https://www.bosschebollen.nl/"/>
<tag k="wheelchair" v="limited"/>
</node>
</osm>

+ 7
- 0
vendor/cache/offline_geocoder/CONTRIBUTING.md View File

@@ -0,0 +1,7 @@
# Contributing

1. Fork it ( [https://github.com/inaka/offline_geocoder/fork](https://github.com/inaka/offline_geocoder/fork) )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

+ 5
- 0
vendor/cache/offline_geocoder/Gemfile View File

@@ -0,0 +1,5 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in offline_geocoder.gemspec
gemspec
gem 'coveralls', require: false

+ 202
- 0
vendor/cache/offline_geocoder/LICENSE View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or