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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2272bbb42482362c6e4abd579c13850e3e123278
4
- data.tar.gz: eab3bb95e222811d5748f0b303d56bd52c5b93c6
3
+ metadata.gz: 27b50c600165b2628c5e20d29b61b62802c76013
4
+ data.tar.gz: 1a43ff8e7266b0230d18b31f47440312345e5698
5
5
  SHA512:
6
- metadata.gz: cead404cb7ea2fb67c964b8af49e65241511e4c23ebc483056980d8bd9cb8ef06ea6ba95eaf8eae2cfbeeeefcd9ce39eebe9cf655cdfdd9df59c921b9e5ff54b
7
- data.tar.gz: 0b742fb32ef46f83d91a1bb78ccdd7b0bcbfd3f50b8321f26b6f015932e086ddd4b0e2681b5440595acabee55b314647d991b2af5daa5ec58228ac8083846ba2
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 "usage: ".colorize(:red)
7
- puts "$ hunter find keyword [geo] [temp]".colorize(:blue)
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
@@ -1,3 +1,3 @@
1
1
  module Datahunter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,15 +1,52 @@
1
1
  require 'spec_helper'
2
+ require 'rest_client'
3
+ require 'json'
2
4
 
3
- describe "Datahunter Base" do
5
+ describe "Datahunter API calls" do
4
6
 
5
- before(:each) do
6
- DATASETS_URL = "http://shrouded-harbor-5877.herokuapp.com/api/datasets/"
7
- end
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
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Hunter CLI' do
4
+
5
+
6
+ it 'find command should be working' do
7
+
8
+ end
9
+ end
data/spec/spec_helper.rb CHANGED
@@ -1 +1,14 @@
1
1
  require 'datahunter'
2
+ require 'aruba/rspec'
3
+
4
+ RSpec.configure do |config|
5
+ config.include ArubaDoubles
6
+
7
+ config.before :each do
8
+ Aruba::RSpec.setup
9
+ end
10
+
11
+ config.after :each do
12
+ Aruba::RSpec.teardown
13
+ end
14
+ end
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.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