datahunter 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/datahunter +16 -2
- data/datahunter.gemspec +2 -1
- data/lib/datahunter/version.rb +1 -1
- data/spec/datahunter_spec.rb +43 -6
- data/spec/hunter_spec.rb +9 -0
- data/spec/spec_helper.rb +13 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b50c600165b2628c5e20d29b61b62802c76013
|
4
|
+
data.tar.gz: 1a43ff8e7266b0230d18b31f47440312345e5698
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d8a85e31ed63becdfc72f9df8db0d2bef78751d89d4d79c3e8a348146de4baaaa4af2af36870aa356f598d4854be39614509bb002483630a7f5493f78557791
|
7
|
+
data.tar.gz: f154349edacb0813c3233db16b54272fe489e555402f4e88f5621a7797f4402671506226e648d84276475b9969f80eaeb94bda8894af22c7da66c829288580c3
|
data/bin/datahunter
CHANGED
@@ -3,5 +3,19 @@
|
|
3
3
|
require 'datahunter'
|
4
4
|
require 'colorize'
|
5
5
|
|
6
|
-
puts
|
7
|
-
|
6
|
+
puts ('$ hunter find <keyword> <geo-coverage> <temporal-coverage> '.colorize(:blue) +
|
7
|
+
'
|
8
|
+
* Returns the 3 most popular (most reused, viewed, etc) datasets corresponding to the query
|
9
|
+
* Allow you to either download the dataset or to open your favorite browser directly at the good page')
|
10
|
+
|
11
|
+
puts ('$ hunter search <keyword> <geo-coverage> <temporal-coverage>'.colorize(:blue) +
|
12
|
+
'
|
13
|
+
* Returns all the datasets corresponding to the query, sorted by popularity.
|
14
|
+
* WARNING: this command is going to be modified soon!')
|
15
|
+
|
16
|
+
puts ('$ hunter about'.colorize(:blue) +
|
17
|
+
'
|
18
|
+
* Vision
|
19
|
+
* Value Proposition
|
20
|
+
* Stats
|
21
|
+
* Last datasets indexed')
|
data/datahunter.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "aruba-rspec"
|
26
27
|
|
27
28
|
spec.add_runtime_dependency "json", "~> 1.8.1"
|
28
29
|
spec.add_runtime_dependency "commander", "~> 4.2.1"
|
@@ -30,4 +31,4 @@ Gem::Specification.new do |spec|
|
|
30
31
|
spec.add_runtime_dependency "launchy", "~> 2.4.3"
|
31
32
|
spec.add_runtime_dependency "colorize", "~> 0.7.3"
|
32
33
|
spec.add_runtime_dependency "downloadr", "0.0.41"
|
33
|
-
end
|
34
|
+
end
|
data/lib/datahunter/version.rb
CHANGED
data/spec/datahunter_spec.rb
CHANGED
@@ -1,15 +1,52 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
2
4
|
|
3
|
-
describe "Datahunter
|
5
|
+
describe "Datahunter API calls" do
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
describe 'create correct datasets_url' do
|
7
|
+
DATASETS_URL = "http://shrouded-harbor-5877.herokuapp.com/api/datasets/"
|
8
|
+
|
9
|
+
describe 'Should create a correct datasets_url to call the API' do
|
10
10
|
it 'should return a correct url' do
|
11
11
|
url = Datahunter.datasets_url("population", "france", "2010")
|
12
12
|
expect(url).to eq("#{DATASETS_URL}?tags=population&spatial=france&temporal=2010")
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
describe 'Should get the right HTTP codes when calling the API' do
|
17
|
+
response_ok = RestClient.get("#{DATASETS_URL}?tags=population",
|
18
|
+
:content_type => :json)
|
19
|
+
response_ni = RestClient.get(DATASETS_URL,
|
20
|
+
:content_type => :json){|response, request, result| response}
|
21
|
+
response_nf = RestClient.get("#{DATASETS_URL}?tags=foo",
|
22
|
+
:content_type => :json){|response, request, result| response}
|
23
|
+
response_nff = RestClient.get("http://shrouded-harbor-5877.herokuapp.com/api/foo",
|
24
|
+
:content_type => :json){|response, request, result| response}
|
25
|
+
|
26
|
+
it 'should return an HTTP 200 with a correct url' do
|
27
|
+
response_ok.code.should eq(200)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should return an HTTP 501 when calling api/datasets/' do
|
31
|
+
response_ni.code.should eq(501)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should return an HTTP 500 when a query has no result' do
|
35
|
+
response_nf.code.should eq(500)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return an HTTP 404 when calling a non defined URL' do
|
39
|
+
response_nff.code.should eq(404)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'Should receive a dataset corresponding to the query' do
|
44
|
+
response = RestClient.get("#{DATASETS_URL}?tags=population",
|
45
|
+
:content_type => :json)
|
46
|
+
res = JSON.parse(response.body).reverse.first
|
47
|
+
|
48
|
+
it 'should have the tag corresponding to the query keyword' do
|
49
|
+
res["tags"].should include("population")
|
50
|
+
end
|
51
|
+
end
|
15
52
|
end
|
data/spec/hunter_spec.rb
ADDED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datahunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terpo
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +171,7 @@ files:
|
|
157
171
|
- lib/datahunter/base.rb
|
158
172
|
- lib/datahunter/version.rb
|
159
173
|
- spec/datahunter_spec.rb
|
174
|
+
- spec/hunter_spec.rb
|
160
175
|
- spec/spec_helper.rb
|
161
176
|
homepage: https://github.com/NTerpo/datahunter
|
162
177
|
licenses:
|
@@ -184,4 +199,5 @@ specification_version: 4
|
|
184
199
|
summary: A Command Line Interface to find Open Datasets
|
185
200
|
test_files:
|
186
201
|
- spec/datahunter_spec.rb
|
202
|
+
- spec/hunter_spec.rb
|
187
203
|
- spec/spec_helper.rb
|