epok 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +10 -0
- data/bin/console +9 -0
- data/bin/setup +7 -0
- data/epok.gemspec +26 -0
- data/lib/epok.rb +17 -0
- data/lib/epok/api.rb +24 -0
- data/lib/epok/collectable.rb +17 -0
- data/lib/epok/collection.rb +23 -0
- data/lib/epok/geocoder.rb +21 -0
- data/lib/epok/object.rb +30 -0
- data/lib/epok/search.rb +17 -0
- data/lib/epok/version.rb +3 -0
- data/test/epok/geocoder_test.rb +29 -0
- data/test/epok/object_test.rb +41 -0
- data/test/epok/search_test.rb +28 -0
- data/test/epok_test.rb +15 -0
- data/test/test_helper.rb +13 -0
- metadata +162 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 387ff0cf39fe626399e0c9e3c3100403040a9b632c7d2a6f0b32a7831bd5fe35
|
|
4
|
+
data.tar.gz: 892468b7a7ac3cd9663e04f9aec7bdd241570db8b05c9b3f6c5baa3f0c1b0f0a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b300e878806a3cf7ebf3336eaae481e55576ac89e5677d1b177ef6c42e2e40a59368893aaeb34e5f78e168c437bb1f0507496900f133c8b9d6652995a0bcc52a
|
|
7
|
+
data.tar.gz: f79a5fab0614a5cbd6a146cff6693a5ffc195d9bff4d04d2551d06f76103d46ea5565e6f4a7a3efcf1b2e28cebe71071d7c228ab07905dab259b5146907a7e17
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at arzezak@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
epok (0.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
addressable (2.6.0)
|
|
10
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
11
|
+
ansi (1.5.0)
|
|
12
|
+
builder (3.2.3)
|
|
13
|
+
byebug (11.0.1)
|
|
14
|
+
crack (0.4.3)
|
|
15
|
+
safe_yaml (~> 1.0.0)
|
|
16
|
+
hashdiff (0.3.9)
|
|
17
|
+
minitest (5.11.3)
|
|
18
|
+
minitest-reporters (1.3.6)
|
|
19
|
+
ansi
|
|
20
|
+
builder
|
|
21
|
+
minitest (>= 5.0)
|
|
22
|
+
ruby-progressbar
|
|
23
|
+
public_suffix (3.0.3)
|
|
24
|
+
rake (10.5.0)
|
|
25
|
+
ruby-progressbar (1.10.0)
|
|
26
|
+
safe_yaml (1.0.5)
|
|
27
|
+
vcr (4.0.0)
|
|
28
|
+
webmock (3.5.1)
|
|
29
|
+
addressable (>= 2.3.6)
|
|
30
|
+
crack (>= 0.3.2)
|
|
31
|
+
hashdiff
|
|
32
|
+
|
|
33
|
+
PLATFORMS
|
|
34
|
+
ruby
|
|
35
|
+
|
|
36
|
+
DEPENDENCIES
|
|
37
|
+
bundler (~> 1.17)
|
|
38
|
+
byebug
|
|
39
|
+
epok!
|
|
40
|
+
minitest (~> 5.0)
|
|
41
|
+
minitest-reporters (~> 1.3, >= 1.3.6)
|
|
42
|
+
rake (~> 10.0)
|
|
43
|
+
vcr (~> 4.0)
|
|
44
|
+
webmock (~> 3.5, >= 3.5.1)
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.17.2
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Ariel Rzezak
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Epok
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/epok`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'epok'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install epok
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/arzezak/epok. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
40
|
+
|
|
41
|
+
## Code of Conduct
|
|
42
|
+
|
|
43
|
+
Everyone interacting in the Epok project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/arzezak/epok/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/epok.gemspec
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
|
|
4
|
+
require "epok/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "epok"
|
|
8
|
+
spec.version = Epok::VERSION
|
|
9
|
+
spec.authors = ["Ariel Rzezak"]
|
|
10
|
+
spec.email = ["arzezak@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "GCBA EPOk wrapper."
|
|
13
|
+
spec.description = "GCBA EPOk wrapper to query indexed geographic objects."
|
|
14
|
+
spec.homepage = "https://github.com/arzezak/epok"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files`.split("\n")
|
|
18
|
+
spec.require_paths = ["lib"]
|
|
19
|
+
|
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
21
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
|
22
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.3", ">= 1.3.6"
|
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
24
|
+
spec.add_development_dependency "vcr", "~> 4.0"
|
|
25
|
+
spec.add_development_dependency "webmock", "~> 3.5", ">= 3.5.1"
|
|
26
|
+
end
|
data/lib/epok.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "epok/api"
|
|
2
|
+
require "epok/collectable"
|
|
3
|
+
require "epok/collection"
|
|
4
|
+
require "epok/geocoder"
|
|
5
|
+
require "epok/object"
|
|
6
|
+
require "epok/search"
|
|
7
|
+
require "epok/version"
|
|
8
|
+
|
|
9
|
+
module Epok
|
|
10
|
+
def self.search(query)
|
|
11
|
+
Search.new(query)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.geocoder(location, categories)
|
|
15
|
+
Geocoder.new(location, categories)
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/epok/api.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "json"
|
|
3
|
+
|
|
4
|
+
module Epok
|
|
5
|
+
class API
|
|
6
|
+
BASE_URL = "epok.buenosaires.gob.ar"
|
|
7
|
+
|
|
8
|
+
def self.object(id)
|
|
9
|
+
response = Net::HTTP.get_response(BASE_URL, "/getObjectContent/?id=#{id}")
|
|
10
|
+
JSON.parse(response.body)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.search(query)
|
|
14
|
+
response = Net::HTTP.get_response(BASE_URL, "/buscar/?texto=#{query}")
|
|
15
|
+
JSON.parse(response.body)["instancias"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.geocoder(x, y, categories)
|
|
19
|
+
response = Net::HTTP.get_response(BASE_URL,
|
|
20
|
+
"/reverseGeocoderLugares/?x=#{x}&y=#{y}&categorias=#{categories}&radio=500")
|
|
21
|
+
JSON.parse(response.body)["instancias"]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "forwardable"
|
|
2
|
+
|
|
3
|
+
module Epok
|
|
4
|
+
module Collectable
|
|
5
|
+
def self.included(base)
|
|
6
|
+
base.class_eval do
|
|
7
|
+
extend Forwardable
|
|
8
|
+
|
|
9
|
+
def_delegators :results, :entries, :first
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def collection(object)
|
|
14
|
+
Collection.new object
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Epok
|
|
2
|
+
class Collection
|
|
3
|
+
include Enumerable
|
|
4
|
+
|
|
5
|
+
attr_reader :data
|
|
6
|
+
|
|
7
|
+
def initialize(data, id = "id")
|
|
8
|
+
@data = collection(data, id)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def each(&block)
|
|
12
|
+
data.each(&block)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def collection(data, id)
|
|
18
|
+
data.map do |item|
|
|
19
|
+
Object.new(item[id])
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Epok
|
|
2
|
+
Location = Struct.new(:x, :y, keyword_init: true)
|
|
3
|
+
|
|
4
|
+
class Geocoder
|
|
5
|
+
include Collectable
|
|
6
|
+
|
|
7
|
+
attr_reader :x, :y, :categories
|
|
8
|
+
|
|
9
|
+
def initialize(location, categories)
|
|
10
|
+
@x = location.x
|
|
11
|
+
@y = location.y
|
|
12
|
+
@categories = categories
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def results
|
|
18
|
+
collection API.geocoder(x, y, categories)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/epok/object.rb
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Epok
|
|
2
|
+
class Object
|
|
3
|
+
attr_reader :id
|
|
4
|
+
|
|
5
|
+
def initialize(id)
|
|
6
|
+
@id = id
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def name
|
|
10
|
+
content["Nombre"]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def normalized_address
|
|
14
|
+
object["direccionNormalizada"]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def content
|
|
18
|
+
object["contenido"].each_with_object({}) do |entry, hash|
|
|
19
|
+
name, value = entry.values_at("nombre", "valor")
|
|
20
|
+
hash[name] = value unless value.empty?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def object
|
|
27
|
+
API.object(id)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/epok/search.rb
ADDED
data/lib/epok/version.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
module Epok
|
|
4
|
+
class GeocoderTest < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
VCR.insert_cassette("geocoder", record: :new_episodes)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
VCR.eject_cassette("geocoder")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_that_geocoder_results_are_epok_objects
|
|
14
|
+
assert_instance_of Object, result
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_that_a_single_geocoder_result_has_a_name
|
|
18
|
+
assert_match "Línea D", result.name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def result
|
|
24
|
+
obelisco = Location.new(x: -58.381570, y: -34.603738)
|
|
25
|
+
results = Geocoder.new(obelisco, "estaciones_de_subte")
|
|
26
|
+
results.first
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
module Epok
|
|
4
|
+
class ObjectTest < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
VCR.insert_cassette("object")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
VCR.eject_cassette("object")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_that_an_object_has_a_name
|
|
14
|
+
assert_equal "Calesita del Parque Saavedra", object.name
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_that_an_object_has_a_normalized_address
|
|
18
|
+
assert_equal "GARCIA DEL RIO y CONDE", object.normalized_address
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_that_an_object_has_content
|
|
22
|
+
expected_content = {
|
|
23
|
+
"Nombre" => "Calesita del Parque Saavedra",
|
|
24
|
+
"Dirección" => "GARCIA DEL RIO y CONDE (CP 1430) - Saavedra - Comuna 12",
|
|
25
|
+
"Actividad Principal" => "Calesita",
|
|
26
|
+
"Días y Horarios" => "Todos los días de 10:00 a 12:00 y de 14:00 a 19:30.",
|
|
27
|
+
"Observaciones" => "Los días de lluvia la calesita se encuentra cerrada.",
|
|
28
|
+
"Sector" => "Privado",
|
|
29
|
+
"Público" => "Niños"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
assert_equal expected_content, object.content
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def object
|
|
38
|
+
Object.new("dependencias_culturales|1635")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
module Epok
|
|
4
|
+
class SearchTest < Minitest::Test
|
|
5
|
+
def setup
|
|
6
|
+
VCR.insert_cassette("search")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def teardown
|
|
10
|
+
VCR.eject_cassette("search")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_that_search_results_are_epok_objects
|
|
14
|
+
assert_instance_of Object, result
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_that_a_single_search_result_has_a_name
|
|
18
|
+
assert_match "San Miguel de Garicoits", result.name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def result
|
|
24
|
+
results = Search.new("garicoits")
|
|
25
|
+
results.first
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/test/epok_test.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class EpokTest < Minitest::Test
|
|
4
|
+
def test_that_it_has_a_version_number
|
|
5
|
+
refute_nil Epok::VERSION
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_responds_to_search
|
|
9
|
+
assert_respond_to Epok, :search
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_responds_to_geocoder
|
|
13
|
+
assert_respond_to Epok, :geocoder
|
|
14
|
+
end
|
|
15
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
|
2
|
+
|
|
3
|
+
require "epok"
|
|
4
|
+
require "minitest/autorun"
|
|
5
|
+
require "minitest/reporters"
|
|
6
|
+
require "vcr"
|
|
7
|
+
|
|
8
|
+
Minitest::Reporters.use!
|
|
9
|
+
|
|
10
|
+
VCR.configure do |config|
|
|
11
|
+
config.cassette_library_dir = "test/fixtures"
|
|
12
|
+
config.hook_into :webmock
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: epok
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ariel Rzezak
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.17'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.17'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: minitest
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '5.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '5.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: minitest-reporters
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.3'
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 1.3.6
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - "~>"
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '1.3'
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 1.3.6
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rake
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '10.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '10.0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: vcr
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '4.0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '4.0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: webmock
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '3.5'
|
|
96
|
+
- - ">="
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: 3.5.1
|
|
99
|
+
type: :development
|
|
100
|
+
prerelease: false
|
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - "~>"
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '3.5'
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: 3.5.1
|
|
109
|
+
description: GCBA EPOk wrapper to query indexed geographic objects.
|
|
110
|
+
email:
|
|
111
|
+
- arzezak@gmail.com
|
|
112
|
+
executables: []
|
|
113
|
+
extensions: []
|
|
114
|
+
extra_rdoc_files: []
|
|
115
|
+
files:
|
|
116
|
+
- ".gitignore"
|
|
117
|
+
- CODE_OF_CONDUCT.md
|
|
118
|
+
- Gemfile
|
|
119
|
+
- Gemfile.lock
|
|
120
|
+
- LICENSE.txt
|
|
121
|
+
- README.md
|
|
122
|
+
- Rakefile
|
|
123
|
+
- bin/console
|
|
124
|
+
- bin/setup
|
|
125
|
+
- epok.gemspec
|
|
126
|
+
- lib/epok.rb
|
|
127
|
+
- lib/epok/api.rb
|
|
128
|
+
- lib/epok/collectable.rb
|
|
129
|
+
- lib/epok/collection.rb
|
|
130
|
+
- lib/epok/geocoder.rb
|
|
131
|
+
- lib/epok/object.rb
|
|
132
|
+
- lib/epok/search.rb
|
|
133
|
+
- lib/epok/version.rb
|
|
134
|
+
- test/epok/geocoder_test.rb
|
|
135
|
+
- test/epok/object_test.rb
|
|
136
|
+
- test/epok/search_test.rb
|
|
137
|
+
- test/epok_test.rb
|
|
138
|
+
- test/test_helper.rb
|
|
139
|
+
homepage: https://github.com/arzezak/epok
|
|
140
|
+
licenses:
|
|
141
|
+
- MIT
|
|
142
|
+
metadata: {}
|
|
143
|
+
post_install_message:
|
|
144
|
+
rdoc_options: []
|
|
145
|
+
require_paths:
|
|
146
|
+
- lib
|
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
|
+
requirements:
|
|
154
|
+
- - ">="
|
|
155
|
+
- !ruby/object:Gem::Version
|
|
156
|
+
version: '0'
|
|
157
|
+
requirements: []
|
|
158
|
+
rubygems_version: 3.0.1
|
|
159
|
+
signing_key:
|
|
160
|
+
specification_version: 4
|
|
161
|
+
summary: GCBA EPOk wrapper.
|
|
162
|
+
test_files: []
|