openkvk 0.0.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.
- data/.gitignore +12 -0
- data/Gemfile +3 -0
- data/LICENSE.mkd +7 -0
- data/README.mkd +45 -0
- data/Rakefile +19 -0
- data/lib/openkvk/api.rb +38 -0
- data/lib/openkvk/configuration.rb +36 -0
- data/lib/openkvk/version.rb +3 -0
- data/lib/openkvk.rb +31 -0
- data/openkvk.gemspec +29 -0
- data/spec/openkvk/api_spec.rb +33 -0
- data/spec/openkvk_spec.rb +105 -0
- data/spec/spec_helper.rb +17 -0
- metadata +169 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.mkd
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2011 Zilverline / Daniël van Hoesel
|
2
|
+
|
3
|
+
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:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
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.
|
data/README.mkd
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
OpenKVK: Ruby wrapper for the [OpenKVK api](http://api.openkvk.nl/)
|
2
|
+
====================
|
3
|
+
|
4
|
+
Installation
|
5
|
+
------------
|
6
|
+
gem install openkvk
|
7
|
+
|
8
|
+
Usage Examples
|
9
|
+
--------------
|
10
|
+
General:
|
11
|
+
|
12
|
+
require "openkvk"
|
13
|
+
|
14
|
+
company = OpenKVK.find("Zilverline B.V.", :count => :first)
|
15
|
+
company = OpenKVK.find("Zilverline").first
|
16
|
+
company = OpenKVK.find_by_bedrijfsnaam("Zilverline B.V.", :count => :first)
|
17
|
+
company = OpenKVK.find_by_kvk("343774520000", :count => :first)
|
18
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam = 'Zilverline B.V.'", "kvk = '343774520000'"], :count => :first)
|
19
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam = 'FooBar'", "kvk = '343774520000'"], :match => :any, :count => :first)
|
20
|
+
|
21
|
+
puts company.bedrijfsnaam
|
22
|
+
#=> "Zilverline B.V."
|
23
|
+
puts company.kvk
|
24
|
+
#=> "343774520000"
|
25
|
+
puts company.adres
|
26
|
+
#=> "Molukkenstraat 200 E4"
|
27
|
+
puts company.plaats
|
28
|
+
#=> "Amsterdam"
|
29
|
+
puts company.postcode
|
30
|
+
#=> "1098TW"
|
31
|
+
puts company.type
|
32
|
+
#=> "Hoofdvestiging"
|
33
|
+
puts company.website
|
34
|
+
#=> nil
|
35
|
+
|
36
|
+
Testing
|
37
|
+
-------
|
38
|
+
Run all tests:
|
39
|
+
|
40
|
+
rake
|
41
|
+
|
42
|
+
Copyright
|
43
|
+
---------
|
44
|
+
Copyright (c) 2011 Zilverline / Daniël van Hoesel.
|
45
|
+
See [LICENSE](https://github.com/zilverline/openkvk/blob/master/LICENSE.mkd) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
namespace :doc do
|
10
|
+
require 'yard'
|
11
|
+
YARD::Rake::YardocTask.new do |task|
|
12
|
+
task.files = ['HISTORY.mkd', 'LICENSE.mkd', 'lib/**/*.rb']
|
13
|
+
task.options = [
|
14
|
+
'--protected',
|
15
|
+
'--output-dir', 'doc/yard',
|
16
|
+
'--markup', 'markdown',
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
data/lib/openkvk/api.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
4
|
+
require 'hashie/mash'
|
5
|
+
|
6
|
+
module OpenKVK
|
7
|
+
class InvalidResponseException < Exception; end
|
8
|
+
|
9
|
+
class API
|
10
|
+
class << self
|
11
|
+
def query(query)
|
12
|
+
#puts query
|
13
|
+
result = JSON.parse(get(query)).first["RESULT"]
|
14
|
+
|
15
|
+
records = []
|
16
|
+
result["ROWS"].each do |row|
|
17
|
+
records << Hashie::Mash.new(Hash[*result["HEADER"].zip(row).flatten])
|
18
|
+
end
|
19
|
+
records
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def get(query)
|
25
|
+
begin
|
26
|
+
response = Net::HTTP.get_response(URI.parse("#{OpenKVK.host}json/#{URI.escape(query)}"))
|
27
|
+
if response.kind_of?(Net::HTTPRedirection)
|
28
|
+
response = Net::HTTP.get_response(URI.parse("#{OpenKVK.host}#{URI.escape(response["Location"])}"))
|
29
|
+
end
|
30
|
+
response.body
|
31
|
+
rescue Exception => e
|
32
|
+
raise InvalidResponseException.new("Couldn't get the response: #{$!}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module OpenKVK
|
2
|
+
# Defines constants and methods related to configuration
|
3
|
+
module Configuration
|
4
|
+
# An array of valid keys in the options hash when configuring an {OpenKVK::API}
|
5
|
+
VALID_OPTIONS_KEYS = [:host].freeze
|
6
|
+
|
7
|
+
# By default, set http://api.openkvk.nl/ as the server
|
8
|
+
DEFAULT_HOST = "http://api.openkvk.nl/".freeze
|
9
|
+
|
10
|
+
# @private
|
11
|
+
attr_accessor *VALID_OPTIONS_KEYS
|
12
|
+
|
13
|
+
# When this module is extended, set all configuration options to their default values
|
14
|
+
def self.extended(base)
|
15
|
+
base.reset
|
16
|
+
end
|
17
|
+
|
18
|
+
# Convenience method to allow configuration options to be set in a block
|
19
|
+
def configure
|
20
|
+
yield self
|
21
|
+
end
|
22
|
+
|
23
|
+
# Create a hash of options and their values
|
24
|
+
def options
|
25
|
+
VALID_OPTIONS_KEYS.inject({}) do |option, key|
|
26
|
+
option.merge!(key => send(key))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Reset all configuration options to defaults
|
31
|
+
def reset
|
32
|
+
self.host = DEFAULT_HOST
|
33
|
+
self
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/openkvk.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path('../openkvk/configuration', __FILE__)
|
2
|
+
require File.expand_path('../openkvk/api', __FILE__)
|
3
|
+
|
4
|
+
module OpenKVK
|
5
|
+
extend Configuration
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def find(options={})
|
9
|
+
if options.is_a?(String)
|
10
|
+
options = {:conditions => ["bedrijfsnaam LIKE '%#{options}%'"]}
|
11
|
+
end
|
12
|
+
options = {:limit => 1000, :select => ["*"], :count => :all, :match_condition => :all}.merge(options)
|
13
|
+
|
14
|
+
options[:limit] = 1 if options[:count] == :first
|
15
|
+
result = API.query("SELECT #{options[:select].join(", ")} FROM kvk WHERE #{options[:conditions].join(options[:match_condition] == :any ? " OR " : " AND ")} LIMIT #{options[:limit]}")
|
16
|
+
return result.first if options[:count] == :first
|
17
|
+
result
|
18
|
+
end
|
19
|
+
|
20
|
+
%w{kvk bedrijfsnaam kvks adres postcode plaats type website}.each do |field|
|
21
|
+
define_method("find_by_#{field}") do |value, options={}|
|
22
|
+
options = {:conditions => ["#{field} LIKE '%#{value}%'"]}.merge(options)
|
23
|
+
find(options)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
end
|
data/openkvk.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "openkvk/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.add_development_dependency('bundler', '~> 1.0')
|
7
|
+
s.add_development_dependency('rake', '~> 0.8')
|
8
|
+
s.add_development_dependency('rspec', '~> 2.3')
|
9
|
+
s.add_development_dependency('mocha', '~> 0.9.10')
|
10
|
+
s.add_development_dependency('simplecov', '~> 0.3')
|
11
|
+
s.add_development_dependency('maruku', '~> 0.6')
|
12
|
+
s.add_development_dependency('yard', '~> 0.6')
|
13
|
+
s.add_development_dependency('hashie', '~> 1.0.0')
|
14
|
+
s.add_development_dependency('json', '~> 1.5.1')
|
15
|
+
|
16
|
+
s.name = "openkvk"
|
17
|
+
s.version = OpenKVK::VERSION
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
s.authors = ["Daniel van Hoesel"]
|
20
|
+
s.email = ["daniel@zilverline.com"]
|
21
|
+
s.homepage = "http://zilverline.com/"
|
22
|
+
s.summary = %q{Ruby wrapper for the OpenKVK api}
|
23
|
+
s.description = %q{This is a ruby wrapper for the Dutch OpenKVK api}
|
24
|
+
|
25
|
+
s.files = `git ls-files`.split("\n")
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
4
|
+
|
5
|
+
describe OpenKVK do
|
6
|
+
|
7
|
+
describe ".get" do
|
8
|
+
it "should return an array with records" do
|
9
|
+
response = Hashie::Mash.new(:body => '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["342838240000","Zilverline Beheer B.V.","34283824","0","Finsenstraat 56","1098RJ","Amsterdam","Hoofdvestiging",null],["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
10
|
+
Net::HTTP.stubs(:get_response).returns(response)
|
11
|
+
|
12
|
+
OpenKVK::API.query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1000").size.should == 2
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should follow a redirect" do
|
16
|
+
response = Hashie::Mash.new(:Location => "new location", :body => '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["342838240000","Zilverline Beheer B.V.","34283824","0","Finsenstraat 56","1098RJ","Amsterdam","Hoofdvestiging",null],["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
17
|
+
|
18
|
+
response.stubs(:kind_of?).returns(Net::HTTPRedirection)
|
19
|
+
Net::HTTP.stubs(:get_response).returns(response)
|
20
|
+
|
21
|
+
OpenKVK::API.query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1000").size.should == 2
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should raise an exception when something goes wrong" do
|
25
|
+
Net::HTTP.stubs(:get_response).raises(Exception.new("test exception"))
|
26
|
+
lambda {
|
27
|
+
OpenKVK::API.query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1000")
|
28
|
+
}.should raise_error OpenKVK::InvalidResponseException
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe OpenKVK do
|
4
|
+
|
5
|
+
describe ".find" do
|
6
|
+
it "should find a company" do
|
7
|
+
expect_query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
8
|
+
|
9
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam LIKE '%Zilverline%'"], :count => :first)
|
10
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
11
|
+
company.kvk.should == "343774520000"
|
12
|
+
company.adres.should == "Molukkenstraat 200 E4"
|
13
|
+
company.postcode.should == "1098TW"
|
14
|
+
company.plaats.should == "Amsterdam"
|
15
|
+
company.type.should == "Hoofdvestiging"
|
16
|
+
company.website.should be nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should find multiple companies" do
|
20
|
+
expect_query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1000", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["342838240000","Zilverline Beheer B.V.","34283824","0","Finsenstraat 56","1098RJ","Amsterdam","Hoofdvestiging",null],["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
21
|
+
|
22
|
+
companies = OpenKVK.find("Zilverline")
|
23
|
+
companies.size.should == 2
|
24
|
+
|
25
|
+
company = companies.last
|
26
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should only return selected fields" do
|
30
|
+
expect_query("SELECT bedrijfsnaam FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1", '[{"RESULT":{"TYPES":["varchar"],"HEADER":["bedrijfsnaam"],"ROWS":[["Zilverline B.V."]]}}]')
|
31
|
+
|
32
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam LIKE '%Zilverline%'"], :count => :first, :select => [:bedrijfsnaam])
|
33
|
+
|
34
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
35
|
+
company.keys.should == %w{bedrijfsnaam}
|
36
|
+
|
37
|
+
expect_query("SELECT bedrijfsnaam, kvk FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' LIMIT 1", '[{"RESULT":{"TYPES":["varchar","bigint"],"HEADER":["bedrijfsnaam","kvk"],"ROWS":[["Zilverline B.V.","343774520000"]]}}]')
|
38
|
+
|
39
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam LIKE '%Zilverline%'"], :count => :first, :select => [:bedrijfsnaam, :kvk])
|
40
|
+
|
41
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
42
|
+
company.kvk.should == "343774520000"
|
43
|
+
company.keys.should == %w{bedrijfsnaam kvk}
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should find a company with multiple conditions" do
|
47
|
+
expect_query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline%' AND kvk = '343774520000' LIMIT 1", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
48
|
+
|
49
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam LIKE '%Zilverline%'", "kvk = '343774520000'"], :count => :first)
|
50
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
51
|
+
company.kvk.should == "343774520000"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should find a company with multiple conditions" do
|
55
|
+
expect_query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%FooBar%' OR kvk = '343774520000' LIMIT 1", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
56
|
+
|
57
|
+
company = OpenKVK.find(:conditions => ["bedrijfsnaam LIKE '%FooBar%'", "kvk = '343774520000'"], :match_condition => :any, :count => :first)
|
58
|
+
company.bedrijfsnaam.should == "Zilverline B.V."
|
59
|
+
company.kvk.should == "343774520000"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
describe ".find_by_bedrijfsnaam" do
|
65
|
+
it "should find a company" do
|
66
|
+
expect_query("SELECT * FROM kvk WHERE bedrijfsnaam LIKE '%Zilverline B.V.%' LIMIT 1", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
67
|
+
|
68
|
+
OpenKVK.find_by_bedrijfsnaam("Zilverline B.V.", :count => :first).bedrijfsnaam.should == "Zilverline B.V."
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe ".find_by_kvk" do
|
73
|
+
it "should find a company" do
|
74
|
+
expect_query("SELECT * FROM kvk WHERE kvk LIKE '%343774520000%' LIMIT 1", '[{"RESULT":{"TYPES":["bigint","varchar","int","int","varchar","varchar","varchar","varchar","varchar"],"HEADER":["kvk","bedrijfsnaam","kvks","sub","adres","postcode","plaats","type","website"],"ROWS":[["343774520000","Zilverline B.V.","34377452","0","Molukkenstraat 200 E4","1098TW","Amsterdam","Hoofdvestiging",null]]}}]')
|
75
|
+
|
76
|
+
OpenKVK.find_by_kvk("343774520000", :count => :first).bedrijfsnaam.should == "Zilverline B.V."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe ".host=" do
|
81
|
+
it "should set the host" do
|
82
|
+
OpenKVK.host = "http://api.openkvk.nl/"
|
83
|
+
OpenKVK.host.should == "http://api.openkvk.nl/"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe ".options" do
|
88
|
+
it "should return a hash with the current settings" do
|
89
|
+
OpenKVK.host = "test host"
|
90
|
+
OpenKVK.options == {:host => "test host"}
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe ".configure" do
|
95
|
+
OpenKVK::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
96
|
+
it "should set the #{key}" do
|
97
|
+
OpenKVK.configure do |config|
|
98
|
+
config.send("#{key}=", key)
|
99
|
+
OpenKVK.send(key).should == key
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_group 'OpenKVK', 'lib/openkvk'
|
5
|
+
add_group 'Specs', 'spec'
|
6
|
+
add_filter __FILE__
|
7
|
+
end
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.mock_with :mocha
|
11
|
+
end
|
12
|
+
|
13
|
+
def expect_query(sql, response)
|
14
|
+
OpenKVK::API.expects(:get).with(sql).returns(response)
|
15
|
+
end
|
16
|
+
|
17
|
+
load File.expand_path('../../lib/openkvk.rb', __FILE__)
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openkvk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel van Hoesel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-06 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "1.0"
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0.8"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "2.3"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mocha
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.9.10
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: simplecov
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0.3"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: maruku
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0.6"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: yard
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0.6"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: hashie
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.0.0
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: json
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ~>
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.5.1
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id009
|
115
|
+
description: This is a ruby wrapper for the Dutch OpenKVK api
|
116
|
+
email:
|
117
|
+
- daniel@zilverline.com
|
118
|
+
executables: []
|
119
|
+
|
120
|
+
extensions: []
|
121
|
+
|
122
|
+
extra_rdoc_files: []
|
123
|
+
|
124
|
+
files:
|
125
|
+
- .gitignore
|
126
|
+
- Gemfile
|
127
|
+
- LICENSE.mkd
|
128
|
+
- README.mkd
|
129
|
+
- Rakefile
|
130
|
+
- lib/openkvk.rb
|
131
|
+
- lib/openkvk/api.rb
|
132
|
+
- lib/openkvk/configuration.rb
|
133
|
+
- lib/openkvk/version.rb
|
134
|
+
- openkvk.gemspec
|
135
|
+
- spec/openkvk/api_spec.rb
|
136
|
+
- spec/openkvk_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
has_rdoc: true
|
139
|
+
homepage: http://zilverline.com/
|
140
|
+
licenses: []
|
141
|
+
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: "0"
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: "0"
|
159
|
+
requirements: []
|
160
|
+
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 1.6.2
|
163
|
+
signing_key:
|
164
|
+
specification_version: 3
|
165
|
+
summary: Ruby wrapper for the OpenKVK api
|
166
|
+
test_files:
|
167
|
+
- spec/openkvk/api_spec.rb
|
168
|
+
- spec/openkvk_spec.rb
|
169
|
+
- spec/spec_helper.rb
|