rdw 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 59b029803fc4422d26b92071dfa29e611b46961f
4
+ data.tar.gz: ef6351c9feeeaab77d920c6315c18bb0646b36a2
5
+ SHA512:
6
+ metadata.gz: fd57dde4c8229f98bf6f4deebbabccacceb99960b1b8710471bfe8972323fae214000c713874d1afdaec20581a1f40f7f239e0041dc49278980a7e22d512d7d6
7
+ data.tar.gz: 0a183153b8eb72e99ebc1941ceb9a10effb1bae69bf6842677d1e1de79304ab1861103bd2276efc27902cb3dd4086bcf5bc20e2286cfb7dbb813ea2afe67a2e9
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ script: bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rdw.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard :rspec do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
6
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jankees van Woezik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Free RDW vehicle information
2
+ [![Build Status](https://travis-ci.org/jankeesvw/rdw.png)](https://travis-ci.org/jankeesvw/rdw) [![Code Climate](https://codeclimate.com/github/jankeesvw/rdw.png)](https://codeclimate.com/github/jankeesvw/rdw) [![Dependency Status](https://gemnasium.com/jankeesvw/rdw.png)](https://gemnasium.com/jankeesvw/rdw)
3
+
4
+ This project gets the public available vehicle information from the Dutch RDW.
5
+ It makes the following attributes available:
6
+
7
+ * `brand`
8
+ * `color`
9
+ * `number_of_cylinders`
10
+ * `cylinder_capacity`
11
+ * `number_of_seats`
12
+ * `fuel_efficiency_main_road`
13
+ * `fuel_efficiency_city`
14
+ * `fuel_efficiency_combined`
15
+ * `energy_label`
16
+ * `BPM`
17
+ * `co2_combined`
18
+ * `fuel_type`
19
+
20
+ # Usage
21
+ ``` ruby
22
+ require "RDW"
23
+ @vehicle = RDW::CarInfo.new("9KJT45")
24
+ @vehicle.brand #=> FERRARI
25
+ @vehicle.energy_label #=> G
26
+ @vehicle.color #=> ROOD
27
+ @vehicle.BPM #=> 82168
28
+ @vehicle.number_of_cylinders #=> 12
29
+ ```
30
+
31
+ # Notice
32
+ There is a rate limit on this api (50,000 per month), more information can be found here: [rdw.nl](http://www.rdw.nl/Zakelijk/Paginas/Open-data.aspx).
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it ( `http://github.com/<my-github-username>/rdw/fork` )
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/rdw.rb ADDED
@@ -0,0 +1,77 @@
1
+ require "rdw/version"
2
+ require "net/http"
3
+ require "nokogiri"
4
+
5
+ module RDW
6
+
7
+ class CarInfo
8
+
9
+ def initialize(license_plate)
10
+ @license_plate = license_plate
11
+ perform_request!
12
+ end
13
+
14
+ def number_of_cylinders
15
+ parse("Aantalcilinders").to_i
16
+ end
17
+
18
+ def number_of_seats
19
+ parse("Aantalzitplaatsen").to_i
20
+ end
21
+
22
+ def BPM
23
+ parse("BPM").to_i
24
+ end
25
+
26
+ def fuel_efficiency_main_road
27
+ parse("Brandstofverbruikbuitenweg").to_f
28
+ end
29
+
30
+ def fuel_efficiency_city
31
+ parse("Brandstofverbruikstad").to_f
32
+ end
33
+
34
+ def fuel_efficiency_combined
35
+ parse("Brandstofverbruikgecombineerd").to_f
36
+ end
37
+
38
+ def cylinder_capacity
39
+ parse("Cilinderinhoud").to_f
40
+ end
41
+
42
+ def co2_combined
43
+ parse("CO2uitstootgecombineerd").to_f
44
+ end
45
+
46
+ def color
47
+ parse("Eerstekleur")
48
+ end
49
+
50
+ def fuel_type
51
+ parse("Hoofdbrandstof")
52
+ end
53
+
54
+ def brand
55
+ parse("Merk")
56
+ end
57
+
58
+ def energy_label
59
+ parse("Zuinigheidslabel")
60
+ end
61
+
62
+ def inspect
63
+ "<RDW::CarInfo license_plate:'#{@license_plate}' brand:'#{brand}' fuel_type:'#{fuel_type}'>"
64
+ end
65
+
66
+ private
67
+
68
+ def parse(attribute_name)
69
+ @xml.xpath("//d:#{attribute_name.to_s}").text
70
+ end
71
+
72
+ def perform_request!
73
+ response = Net::HTTP.get_response(URI("https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('#{@license_plate}')"))
74
+ @xml = Nokogiri::XML(response.body)
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,3 @@
1
+ module Rdw
2
+ VERSION = "1.0.0"
3
+ end
data/rdw.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rdw/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rdw"
8
+ spec.version = Rdw::VERSION
9
+ spec.authors = ["Jankees van Woezik"]
10
+ spec.email = ["jankees@base42.nl"]
11
+ spec.summary = %q{Get Dutch car information from the RDW}
12
+ spec.homepage = "https://github.com/jankeesvw/rdw"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "nokogiri"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec", "~> 3.0.0.beta2"
25
+ spec.add_development_dependency "rspec-its"
26
+ spec.add_development_dependency "guard-rspec"
27
+ spec.add_development_dependency "webmock"
28
+ spec.add_development_dependency "vcr"
29
+ end
@@ -0,0 +1,100 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('9KJT45')
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api.datamarket.azure.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/atom+xml
27
+ Vary:
28
+ - Accept-Encoding
29
+ Server:
30
+ - Microsoft-IIS/8.0
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Dataserviceversion:
34
+ - 1.0;
35
+ Activityid:
36
+ - af2bc74a-781d-4179-ae3f-4666730b6f90
37
+ X-Aspnet-Version:
38
+ - 4.0.30319
39
+ X-Powered-By:
40
+ - ASP.NET
41
+ Access-Control-Allow-Origin:
42
+ - "*"
43
+ Access-Control-Allow-Credentials:
44
+ - 'false'
45
+ Access-Control-Allow-Headers:
46
+ - Authorization
47
+ Access-Control-Allow-Methods:
48
+ - GET, POST, OPTIONS
49
+ Access-Control-Max-Age:
50
+ - '604800'
51
+ Date:
52
+ - Tue, 11 Mar 2014 18:09:05 GMT
53
+ Content-Length:
54
+ - '1185'
55
+ body:
56
+ encoding: UTF-8
57
+ string: "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<entry
58
+ xml:base=\"https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/\"
59
+ xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"
60
+ xmlns=\"http://www.w3.org/2005/Atom\">\r\n <id>https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('9KJT45')</id>\r\n
61
+ \ <title type=\"text\"></title>\r\n <updated>2014-03-11T18:09:05Z</updated>\r\n
62
+ \ <author>\r\n <name />\r\n </author>\r\n <link rel=\"edit\" title=\"KENT_VRTG_O_DAT\"
63
+ href=\"KENT_VRTG_O_DAT('9KJT45')\" />\r\n <category term=\"opendata.rdw.VRTG.Open.Data.KENT_VRTG_O_DAT\"
64
+ scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\r\n
65
+ \ <content type=\"application/xml\">\r\n <m:properties>\r\n <d:Aantalcilinders
66
+ m:type=\"Edm.Int16\">12</d:Aantalcilinders>\r\n <d:Aantalstaanplaatsen
67
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Aantalzitplaatsen m:type=\"Edm.Int16\">2</d:Aantalzitplaatsen>\r\n
68
+ \ <d:BPM m:type=\"Edm.Int32\">82168</d:BPM>\r\n <d:Brandstofverbruikbuitenweg
69
+ m:type=\"Edm.Decimal\">14.70</d:Brandstofverbruikbuitenweg>\r\n <d:Brandstofverbruikgecombineerd
70
+ m:type=\"Edm.Decimal\">21.30</d:Brandstofverbruikgecombineerd>\r\n <d:Brandstofverbruikstad
71
+ m:type=\"Edm.Decimal\">32.70</d:Brandstofverbruikstad>\r\n <d:Catalogusprijs
72
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Cilinderinhoud m:type=\"Edm.Int32\">5999</d:Cilinderinhoud>\r\n
73
+ \ <d:CO2uitstootgecombineerd m:type=\"Edm.Int16\">490</d:CO2uitstootgecombineerd>\r\n
74
+ \ <d:Datumaanvangtenaamstelling m:type=\"Edm.DateTime\">2014-02-11T00:00:00</d:Datumaanvangtenaamstelling>\r\n
75
+ \ <d:DatumeersteafgifteNederland m:type=\"Edm.DateTime\">2013-05-03T00:00:00</d:DatumeersteafgifteNederland>\r\n
76
+ \ <d:Datumeerstetoelating m:type=\"Edm.DateTime\">2006-07-25T00:00:00</d:Datumeerstetoelating>\r\n
77
+ \ <d:Eerstekleur>ROOD</d:Eerstekleur>\r\n <d:G3installatie>N.v.t.</d:G3installatie>\r\n
78
+ \ <d:Handelsbenaming>599</d:Handelsbenaming>\r\n <d:Hoofdbrandstof>Benzine</d:Hoofdbrandstof>\r\n
79
+ \ <d:Inrichting>coupe</d:Inrichting>\r\n <d:Kenteken>9KJT45</d:Kenteken>\r\n
80
+ \ <d:Laadvermogen m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Massaleegvoertuig
81
+ m:type=\"Edm.Int32\">1680</d:Massaleegvoertuig>\r\n <d:Massarijklaar
82
+ m:type=\"Edm.Int32\">1780</d:Massarijklaar>\r\n <d:Maximaleconstructiesnelheid
83
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaautonoomgeremd
84
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassageremd
85
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassamiddenasgeremd
86
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaongeremd
87
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaopleggergeremd
88
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Merk>FERRARI</d:Merk>\r\n
89
+ \ <d:Milieuclassificatie>Niet geregistreerd</d:Milieuclassificatie>\r\n
90
+ \ <d:Nevenbrandstof>Niet geregistreerd</d:Nevenbrandstof>\r\n <d:Retrofitroetfilter>Nee</d:Retrofitroetfilter>\r\n
91
+ \ <d:Toegestanemaximummassavoertuig m:type=\"Edm.Int32\">2000</d:Toegestanemaximummassavoertuig>\r\n
92
+ \ <d:Tweedekleur>Niet geregistreerd</d:Tweedekleur>\r\n <d:Vermogen
93
+ m:type=\"Edm.Int16\">456</d:Vermogen>\r\n <d:Vermogenbromsnorfiets m:type=\"Edm.Decimal\"
94
+ m:null=\"true\" />\r\n <d:VervaldatumAPK m:type=\"Edm.DateTime\">2014-10-31T00:00:00</d:VervaldatumAPK>\r\n
95
+ \ <d:Voertuigsoort>Personenauto</d:Voertuigsoort>\r\n <d:Wachtopkeuren>Nee</d:Wachtopkeuren>\r\n
96
+ \ <d:WAMverzekerdgeregistreerd>Nee</d:WAMverzekerdgeregistreerd>\r\n <d:Zuinigheidslabel>G</d:Zuinigheidslabel>\r\n
97
+ \ </m:properties>\r\n </content>\r\n</entry>"
98
+ http_version:
99
+ recorded_at: Tue, 11 Mar 2014 18:08:55 GMT
100
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,100 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('87PVF5')
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api.datamarket.azure.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/atom+xml
27
+ Vary:
28
+ - Accept-Encoding
29
+ Server:
30
+ - Microsoft-IIS/8.0
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Dataserviceversion:
34
+ - 1.0;
35
+ Activityid:
36
+ - ceb23e53-d067-4b55-9928-16b62e355f1c
37
+ X-Aspnet-Version:
38
+ - 4.0.30319
39
+ X-Powered-By:
40
+ - ASP.NET
41
+ Access-Control-Allow-Origin:
42
+ - "*"
43
+ Access-Control-Allow-Credentials:
44
+ - 'false'
45
+ Access-Control-Allow-Headers:
46
+ - Authorization
47
+ Access-Control-Allow-Methods:
48
+ - GET, POST, OPTIONS
49
+ Access-Control-Max-Age:
50
+ - '604800'
51
+ Date:
52
+ - Wed, 12 Mar 2014 06:39:29 GMT
53
+ Content-Length:
54
+ - '1170'
55
+ body:
56
+ encoding: UTF-8
57
+ string: "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<entry
58
+ xml:base=\"https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/\"
59
+ xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"
60
+ xmlns=\"http://www.w3.org/2005/Atom\">\r\n <id>https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('87PVF5')</id>\r\n
61
+ \ <title type=\"text\"></title>\r\n <updated>2014-03-12T06:39:30Z</updated>\r\n
62
+ \ <author>\r\n <name />\r\n </author>\r\n <link rel=\"edit\" title=\"KENT_VRTG_O_DAT\"
63
+ href=\"KENT_VRTG_O_DAT('87PVF5')\" />\r\n <category term=\"opendata.rdw.VRTG.Open.Data.KENT_VRTG_O_DAT\"
64
+ scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\r\n
65
+ \ <content type=\"application/xml\">\r\n <m:properties>\r\n <d:Aantalcilinders
66
+ m:type=\"Edm.Int16\">4</d:Aantalcilinders>\r\n <d:Aantalstaanplaatsen
67
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Aantalzitplaatsen m:type=\"Edm.Int16\">4</d:Aantalzitplaatsen>\r\n
68
+ \ <d:BPM m:type=\"Edm.Int32\">4563</d:BPM>\r\n <d:Brandstofverbruikbuitenweg
69
+ m:type=\"Edm.Decimal\" m:null=\"true\" />\r\n <d:Brandstofverbruikgecombineerd
70
+ m:type=\"Edm.Decimal\" m:null=\"true\" />\r\n <d:Brandstofverbruikstad
71
+ m:type=\"Edm.Decimal\" m:null=\"true\" />\r\n <d:Catalogusprijs m:type=\"Edm.Int32\"
72
+ m:null=\"true\" />\r\n <d:Cilinderinhoud m:type=\"Edm.Int32\">1595</d:Cilinderinhoud>\r\n
73
+ \ <d:CO2uitstootgecombineerd m:type=\"Edm.Int16\" m:null=\"true\" />\r\n
74
+ \ <d:Datumaanvangtenaamstelling m:type=\"Edm.DateTime\">2014-02-20T00:00:00</d:Datumaanvangtenaamstelling>\r\n
75
+ \ <d:DatumeersteafgifteNederland m:type=\"Edm.DateTime\">2011-03-31T00:00:00</d:DatumeersteafgifteNederland>\r\n
76
+ \ <d:Datumeerstetoelating m:type=\"Edm.DateTime\">2000-01-20T00:00:00</d:Datumeerstetoelating>\r\n
77
+ \ <d:Eerstekleur>GRIJS</d:Eerstekleur>\r\n <d:G3installatie>N.v.t.</d:G3installatie>\r\n
78
+ \ <d:Handelsbenaming>NEWBEETLE</d:Handelsbenaming>\r\n <d:Hoofdbrandstof>Benzine</d:Hoofdbrandstof>\r\n
79
+ \ <d:Inrichting>hatchback</d:Inrichting>\r\n <d:Kenteken>87PVF5</d:Kenteken>\r\n
80
+ \ <d:Laadvermogen m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Massaleegvoertuig
81
+ m:type=\"Edm.Int32\">1220</d:Massaleegvoertuig>\r\n <d:Massarijklaar
82
+ m:type=\"Edm.Int32\">1320</d:Massarijklaar>\r\n <d:Maximaleconstructiesnelheid
83
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaautonoomgeremd
84
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassageremd
85
+ m:type=\"Edm.Int32\">1000</d:Maximumtetrekkenmassageremd>\r\n <d:Maximumtetrekkenmassamiddenasgeremd
86
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaongeremd
87
+ m:type=\"Edm.Int32\">660</d:Maximumtetrekkenmassaongeremd>\r\n <d:Maximumtetrekkenmassaopleggergeremd
88
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Merk>VOLKSWAGEN</d:Merk>\r\n
89
+ \ <d:Milieuclassificatie>Niet geregistreerd</d:Milieuclassificatie>\r\n
90
+ \ <d:Nevenbrandstof>Niet geregistreerd</d:Nevenbrandstof>\r\n <d:Retrofitroetfilter>Nee</d:Retrofitroetfilter>\r\n
91
+ \ <d:Toegestanemaximummassavoertuig m:type=\"Edm.Int32\">1630</d:Toegestanemaximummassavoertuig>\r\n
92
+ \ <d:Tweedekleur>Niet geregistreerd</d:Tweedekleur>\r\n <d:Vermogen
93
+ m:type=\"Edm.Int16\">74</d:Vermogen>\r\n <d:Vermogenbromsnorfiets m:type=\"Edm.Decimal\"
94
+ m:null=\"true\" />\r\n <d:VervaldatumAPK m:type=\"Edm.DateTime\">2014-04-05T00:00:00</d:VervaldatumAPK>\r\n
95
+ \ <d:Voertuigsoort>Personenauto</d:Voertuigsoort>\r\n <d:Wachtopkeuren>Nee</d:Wachtopkeuren>\r\n
96
+ \ <d:WAMverzekerdgeregistreerd>Nee</d:WAMverzekerdgeregistreerd>\r\n <d:Zuinigheidslabel
97
+ m:null=\"true\" />\r\n </m:properties>\r\n </content>\r\n</entry>"
98
+ http_version:
99
+ recorded_at: Wed, 12 Mar 2014 06:39:16 GMT
100
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,101 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('67YA03')
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api.datamarket.azure.com
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/atom+xml
27
+ Vary:
28
+ - Accept-Encoding
29
+ Server:
30
+ - Microsoft-IIS/8.0
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Dataserviceversion:
34
+ - 1.0;
35
+ Activityid:
36
+ - eb79bbb3-6def-4cd6-8aed-8efc3a90b8d4
37
+ X-Aspnet-Version:
38
+ - 4.0.30319
39
+ X-Powered-By:
40
+ - ASP.NET
41
+ Access-Control-Allow-Origin:
42
+ - "*"
43
+ Access-Control-Allow-Credentials:
44
+ - 'false'
45
+ Access-Control-Allow-Headers:
46
+ - Authorization
47
+ Access-Control-Allow-Methods:
48
+ - GET, POST, OPTIONS
49
+ Access-Control-Max-Age:
50
+ - '604800'
51
+ Date:
52
+ - Wed, 12 Mar 2014 06:41:14 GMT
53
+ Content-Length:
54
+ - '1151'
55
+ body:
56
+ encoding: UTF-8
57
+ string: "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<entry
58
+ xml:base=\"https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/\"
59
+ xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"
60
+ xmlns=\"http://www.w3.org/2005/Atom\">\r\n <id>https://api.datamarket.azure.com/Data.ashx/opendata.rdw/VRTG.Open.Data/v1/KENT_VRTG_O_DAT('67YA03')</id>\r\n
61
+ \ <title type=\"text\"></title>\r\n <updated>2014-03-12T06:41:14Z</updated>\r\n
62
+ \ <author>\r\n <name />\r\n </author>\r\n <link rel=\"edit\" title=\"KENT_VRTG_O_DAT\"
63
+ href=\"KENT_VRTG_O_DAT('67YA03')\" />\r\n <category term=\"opendata.rdw.VRTG.Open.Data.KENT_VRTG_O_DAT\"
64
+ scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\r\n
65
+ \ <content type=\"application/xml\">\r\n <m:properties>\r\n <d:Aantalcilinders
66
+ m:type=\"Edm.Int16\">4</d:Aantalcilinders>\r\n <d:Aantalstaanplaatsen
67
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Aantalzitplaatsen m:type=\"Edm.Int16\"
68
+ m:null=\"true\" />\r\n <d:BPM m:type=\"Edm.Int32\" m:null=\"true\" />\r\n
69
+ \ <d:Brandstofverbruikbuitenweg m:type=\"Edm.Decimal\" m:null=\"true\"
70
+ />\r\n <d:Brandstofverbruikgecombineerd m:type=\"Edm.Decimal\" m:null=\"true\"
71
+ />\r\n <d:Brandstofverbruikstad m:type=\"Edm.Decimal\" m:null=\"true\"
72
+ />\r\n <d:Catalogusprijs m:type=\"Edm.Int32\" m:null=\"true\" />\r\n
73
+ \ <d:Cilinderinhoud m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:CO2uitstootgecombineerd
74
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Datumaanvangtenaamstelling
75
+ m:type=\"Edm.DateTime\">2010-04-10T00:00:00</d:Datumaanvangtenaamstelling>\r\n
76
+ \ <d:DatumeersteafgifteNederland m:type=\"Edm.DateTime\">2002-09-11T00:00:00</d:DatumeersteafgifteNederland>\r\n
77
+ \ <d:Datumeerstetoelating m:type=\"Edm.DateTime\">1977-01-27T00:00:00</d:Datumeerstetoelating>\r\n
78
+ \ <d:Eerstekleur>BLAUW</d:Eerstekleur>\r\n <d:G3installatie>Nee</d:G3installatie>\r\n
79
+ \ <d:Handelsbenaming>221811</d:Handelsbenaming>\r\n <d:Hoofdbrandstof>LPG
80
+ (Liquified Petrol Gas)</d:Hoofdbrandstof>\r\n <d:Inrichting>MPV</d:Inrichting>\r\n
81
+ \ <d:Kenteken>67YA03</d:Kenteken>\r\n <d:Laadvermogen m:type=\"Edm.Int32\"
82
+ m:null=\"true\" />\r\n <d:Massaleegvoertuig m:type=\"Edm.Int32\">1321</d:Massaleegvoertuig>\r\n
83
+ \ <d:Massarijklaar m:type=\"Edm.Int32\">1421</d:Massarijklaar>\r\n <d:Maximaleconstructiesnelheid
84
+ m:type=\"Edm.Int16\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaautonoomgeremd
85
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassageremd
86
+ m:type=\"Edm.Int32\">1000</d:Maximumtetrekkenmassageremd>\r\n <d:Maximumtetrekkenmassamiddenasgeremd
87
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaongeremd
88
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Maximumtetrekkenmassaopleggergeremd
89
+ m:type=\"Edm.Int32\" m:null=\"true\" />\r\n <d:Merk>VOLKSWAGEN</d:Merk>\r\n
90
+ \ <d:Milieuclassificatie>Niet geregistreerd</d:Milieuclassificatie>\r\n
91
+ \ <d:Nevenbrandstof>Niet geregistreerd</d:Nevenbrandstof>\r\n <d:Retrofitroetfilter>Nee</d:Retrofitroetfilter>\r\n
92
+ \ <d:Toegestanemaximummassavoertuig m:type=\"Edm.Int32\">2250</d:Toegestanemaximummassavoertuig>\r\n
93
+ \ <d:Tweedekleur>WIT</d:Tweedekleur>\r\n <d:Vermogen m:type=\"Edm.Int16\"
94
+ m:null=\"true\" />\r\n <d:Vermogenbromsnorfiets m:type=\"Edm.Decimal\"
95
+ m:null=\"true\" />\r\n <d:VervaldatumAPK m:type=\"Edm.DateTime\">2014-09-16T00:00:00</d:VervaldatumAPK>\r\n
96
+ \ <d:Voertuigsoort>Personenauto</d:Voertuigsoort>\r\n <d:Wachtopkeuren>Nee</d:Wachtopkeuren>\r\n
97
+ \ <d:WAMverzekerdgeregistreerd>Ja</d:WAMverzekerdgeregistreerd>\r\n <d:Zuinigheidslabel
98
+ m:null=\"true\" />\r\n </m:properties>\r\n </content>\r\n</entry>"
99
+ http_version:
100
+ recorded_at: Wed, 12 Mar 2014 06:41:01 GMT
101
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,74 @@
1
+ require "spec_helper"
2
+
3
+ describe RDW::CarInfo do
4
+
5
+ context "given the license plate of a Ferrari" do
6
+ let(:license_plate) { "9KJT45" }
7
+ before { VCR.eject_cassette }
8
+ before { VCR.insert_cassette("ferrari_9KJT45") }
9
+ subject { described_class.new(license_plate) }
10
+
11
+ it { should be_a RDW::CarInfo }
12
+
13
+ its("number_of_cylinders") { should eq 12 }
14
+ its("number_of_seats") { should eq 2 }
15
+ its("BPM") { should eq 82168 }
16
+ its("fuel_efficiency_main_road") { should eq 14.70 }
17
+ its("fuel_efficiency_city") { should eq 32.70 }
18
+ its("fuel_efficiency_combined") { should eq 21.30 }
19
+ its("cylinder_capacity") { should eq 5999.0 }
20
+ its("co2_combined") { should eq 490.0 }
21
+ its("color") { should eq "ROOD" }
22
+ its("fuel_type") { should eq "Benzine" }
23
+ its("brand") { should eq "FERRARI" }
24
+ its("energy_label") { should eq "G" }
25
+ its("inspect") { should eq "<RDW::CarInfo license_plate:'9KJT45' brand:'FERRARI' fuel_type:'Benzine'>" }
26
+ end
27
+
28
+ context "given the license plate of a New Beetle" do
29
+ let(:license_plate) { "87PVF5" }
30
+ before { VCR.eject_cassette }
31
+ before { VCR.insert_cassette("new_beetle_9KJT45") }
32
+ subject { described_class.new(license_plate) }
33
+
34
+ it { should be_a RDW::CarInfo }
35
+
36
+ its("number_of_cylinders") { should eq 4 }
37
+ its("number_of_seats") { should eq 4 }
38
+ its("BPM") { should eq 4563 }
39
+ its("fuel_efficiency_main_road") { should eq 0.0 }
40
+ its("fuel_efficiency_city") { should eq 0.0 }
41
+ its("fuel_efficiency_combined") { should eq 0.0 }
42
+ its("cylinder_capacity") { should eq 1595.0 }
43
+ its("co2_combined") { should eq 0.0 }
44
+ its("color") { should eq "GRIJS" }
45
+ its("fuel_type") { should eq "Benzine" }
46
+ its("brand") { should eq "VOLKSWAGEN" }
47
+ its("energy_label") { should eq "" }
48
+ its("inspect") { should eq "<RDW::CarInfo license_plate:'87PVF5' brand:'VOLKSWAGEN' fuel_type:'Benzine'>" }
49
+ end
50
+
51
+ context "given the license plate of a T2 bus" do
52
+ let(:license_plate) { "67YA03" }
53
+ before { VCR.eject_cassette }
54
+ before { VCR.insert_cassette("t2_67YA03") }
55
+ subject { described_class.new(license_plate) }
56
+
57
+ it { should be_a RDW::CarInfo }
58
+
59
+ its("number_of_cylinders") { should eq 4 }
60
+ its("number_of_seats") { should eq 0 }
61
+ its("BPM") { should eq 0 }
62
+ its("fuel_efficiency_main_road") { should eq 0.0 }
63
+ its("fuel_efficiency_city") { should eq 0.0 }
64
+ its("fuel_efficiency_combined") { should eq 0.0 }
65
+ its("cylinder_capacity") { should eq 0 }
66
+ its("co2_combined") { should eq 0.0 }
67
+ its("color") { should eq "BLAUW" }
68
+ its("fuel_type") { should eq "LPG (Liquified Petrol Gas)" }
69
+ its("brand") { should eq "VOLKSWAGEN" }
70
+ its("energy_label") { should eq "" }
71
+ its("inspect") { should eq "<RDW::CarInfo license_plate:'67YA03' brand:'VOLKSWAGEN' fuel_type:'LPG (Liquified Petrol Gas)'>" }
72
+ end
73
+
74
+ end
@@ -0,0 +1,14 @@
1
+ require "vcr"
2
+ require "rspec/its"
3
+
4
+ Dir.glob(File.join(Dir.pwd, "/lib/*.rb")).each do |file|
5
+ require file
6
+ end
7
+
8
+ VCR.configure do |c|
9
+ c.cassette_library_dir = "spec/fixtures"
10
+ c.hook_into :webmock
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdw
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jankees van Woezik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0.beta2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.0.beta2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: vcr
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description:
126
+ email:
127
+ - jankees@base42.nl
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - Guardfile
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - lib/rdw.rb
141
+ - lib/rdw/version.rb
142
+ - rdw.gemspec
143
+ - spec/fixtures/ferrari_9KJT45.yml
144
+ - spec/fixtures/new_beetle_9KJT45.yml
145
+ - spec/fixtures/t2_67YA03.yml
146
+ - spec/rdw_car_info_spec.rb
147
+ - spec/spec_helper.rb
148
+ homepage: https://github.com/jankeesvw/rdw
149
+ licenses:
150
+ - MIT
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.2.2
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: Get Dutch car information from the RDW
172
+ test_files:
173
+ - spec/fixtures/ferrari_9KJT45.yml
174
+ - spec/fixtures/new_beetle_9KJT45.yml
175
+ - spec/fixtures/t2_67YA03.yml
176
+ - spec/rdw_car_info_spec.rb
177
+ - spec/spec_helper.rb