dvla 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +61 -0
- data/Rakefile +1 -0
- data/dvla.gemspec +23 -0
- data/lib/dvla.rb +6 -0
- data/lib/vehicle_details.rb +12 -0
- data/lib/vehicle_details/data_extractor.rb +66 -0
- data/lib/vehicle_details/scraper.rb +37 -0
- data/lib/version.rb +3 -0
- data/scrape.rb +2 -0
- data/spec/vehicle_details/data_extractor_spec.rb +39 -0
- data/spec/vehicle_details/vehicle_details_scraper_spec.rb +15 -0
- data/spec/vehicle_details_spec.rb +14 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b7f4eb0e8f75863262ba2fc4d80e4d72aa013c5
|
4
|
+
data.tar.gz: 8ff8be2fb4042d5f481ebacd9372947092014af4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a37e9645ae9380ea7a38ddd60c3edceb2cd819f6db26aaaebf7920ccb7821c2ad12330167b9391a716e21fa55342552a4b035b933d738e3287ae82405334a20a
|
7
|
+
data.tar.gz: fdbe75925b61065c17932e75213125d375cabe8d1c8bfefa1833050f030be82a3228ce0996562c3bde46d8f6859ed70915eae3d00a27dc9967df6c2c975970d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jeremy Walker
|
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,61 @@
|
|
1
|
+
# DVLA Data Extractor
|
2
|
+
|
3
|
+
This gem allows you to extract data from the DVLA. It currently supports:
|
4
|
+
- Vehicle Details
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'dvla'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install dvla
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
### Vehicle Details
|
23
|
+
```ruby
|
24
|
+
Dvla::VehicleDetails.retrieve("SP04 UYK", "Mazda")
|
25
|
+
```
|
26
|
+
|
27
|
+
This should return
|
28
|
+
```json
|
29
|
+
{
|
30
|
+
car_data: {
|
31
|
+
"Date of Liability"=>"01 11 2013",
|
32
|
+
"Date of First Registration"=>"16 03 2004",
|
33
|
+
"Year of Manufacture"=>"2004",
|
34
|
+
"Cylinder Capacity (cc)"=>"2616cc",
|
35
|
+
"Emissions"=>"284g/Km",
|
36
|
+
"Fuel Type"=>"PETROL",
|
37
|
+
"Export Marker"=>"N",
|
38
|
+
"Vehicle Status"=>"Licence Not Due",
|
39
|
+
"Vehicle Colour"=>"YELLOW",
|
40
|
+
"Vehicle Type Approval"=>"M1"
|
41
|
+
},
|
42
|
+
tax_data: {
|
43
|
+
"6 Months Rate"=>"£154.00",
|
44
|
+
"12 Months Rate"=>"£280.00"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Contributions are very welcome. To contribute:
|
52
|
+
|
53
|
+
1. Fork it
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
58
|
+
|
59
|
+
## Copyright
|
60
|
+
|
61
|
+
Copyright (c) 2013 Jeremy Walker.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/dvla.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dvla"
|
8
|
+
spec.version = Dvla::VERSION
|
9
|
+
spec.authors = ["Jeremy Walker"]
|
10
|
+
spec.email = ["jez.walker@gmail.com"]
|
11
|
+
spec.description = %q{A scraper to extract data from the DVLA}
|
12
|
+
spec.summary = %q{A scraper to extract data from the DVLA}
|
13
|
+
spec.homepage = "https://github.com/iHiD/dvla"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(spec)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
data/lib/dvla.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module Dvla
|
5
|
+
module VehicleDetails
|
6
|
+
class DataExtractor
|
7
|
+
def initialize(html)
|
8
|
+
@html = html
|
9
|
+
end
|
10
|
+
|
11
|
+
def car_data
|
12
|
+
data = {}
|
13
|
+
car_table.css(".vehicledetailstableright .bodytext").each_with_index do |elem, i|
|
14
|
+
data[car_data_titles[i]] = elem.text
|
15
|
+
end
|
16
|
+
data
|
17
|
+
end
|
18
|
+
|
19
|
+
def tax_data
|
20
|
+
data = {}
|
21
|
+
tax_table.css(".vehicledetailstableright .bodytext").each_with_index do |elem, i|
|
22
|
+
data[tax_data_titles[i]] = elem.text
|
23
|
+
end
|
24
|
+
data
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def doc
|
30
|
+
@doc ||= Nokogiri::HTML(@html)
|
31
|
+
end
|
32
|
+
|
33
|
+
def tables
|
34
|
+
@tables ||= doc.css("table")
|
35
|
+
end
|
36
|
+
|
37
|
+
def car_table
|
38
|
+
@car_table ||= tables[0]
|
39
|
+
end
|
40
|
+
|
41
|
+
def tax_table
|
42
|
+
@tax_table ||= tables[1]
|
43
|
+
end
|
44
|
+
|
45
|
+
def car_data_titles
|
46
|
+
["Date of Liability",
|
47
|
+
"Date of First Registration",
|
48
|
+
"Year of Manufacture",
|
49
|
+
"Cylinder Capacity (cc)",
|
50
|
+
"Emissions",
|
51
|
+
"Fuel Type",
|
52
|
+
"Export Marker",
|
53
|
+
"Vehicle Status",
|
54
|
+
"Vehicle Colour",
|
55
|
+
"Vehicle Type Approval",
|
56
|
+
"Vehicle Excise Duty rate for vehicle 6 Months Rate",
|
57
|
+
"12 Months Rate"
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def tax_data_titles
|
62
|
+
["6 Months Rate", "12 Months Rate"]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'capybara-webkit'
|
2
|
+
require_relative 'data_extractor'
|
3
|
+
|
4
|
+
module Dvla
|
5
|
+
module VehicleDetails
|
6
|
+
class Scraper
|
7
|
+
def initialize(reg, make)
|
8
|
+
@reg = reg
|
9
|
+
@make = make
|
10
|
+
end
|
11
|
+
|
12
|
+
def scrape
|
13
|
+
c = Capybara::Session.new(:webkit)
|
14
|
+
p "Getting page"
|
15
|
+
c.visit 'https://www.taxdisc.direct.gov.uk/EvlPortalApp/app/home/intro'
|
16
|
+
|
17
|
+
p 'Clicking Vehicle enquiry'
|
18
|
+
c.click_on('Vehicle enquiry')
|
19
|
+
|
20
|
+
p "Clicking Next"
|
21
|
+
c.click_on('Next')
|
22
|
+
|
23
|
+
p "Completing form"
|
24
|
+
c.fill_in 'vrm', with: @reg
|
25
|
+
c.select @make.upcase, from: 'make'
|
26
|
+
c.click_on('Submit')
|
27
|
+
|
28
|
+
extractor = DataExtractor.new(c.body)
|
29
|
+
|
30
|
+
{
|
31
|
+
car_data: extractor.car_data,
|
32
|
+
tax_data: extractor.tax_data
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/version.rb
ADDED
data/scrape.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rspec'
|
3
|
+
require_relative '../../lib/vehicle_details/data_extractor'
|
4
|
+
|
5
|
+
module Dvla::VehicleDetails
|
6
|
+
describe DataExtractor do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
html = <<-EOSHTML
|
10
|
+
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"><head>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"/EvlPortalApp/framework/styles/style_nonav.css\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"/EvlPortalApp/framework/styles/main.css\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"/EvlPortalApp/framework/skins/directgov/styles/skin.css\">\n <script src=\"/EvlPortalApp/framework/script/evl.js\" type=\"text/javascript\" language=\"JavaScript\"></script>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n \n <meta name=\"robots\" content=\"noindex,nofollow\">\n\t\t<title>DVLA's Vehicle online service. | Vehicle enquiry\n\t\t</title>\n </head>\n <body>\n <div id=\"template\">\n <div id=\"min-width-container\">\n <div id=\"container-page\">\n \n <div id=\"container-head\">\n <div id=\"banner\">\n <div id=\"bannerLeft\"></div>\n <div id=\"bannerMiddle\">\n <img id=\"bannerImageLogo\" src=\"/EvlPortalApp/framework/skins/directgov/images/logo.gif\" alt=\"Directgov\"><div id=\"printBannerImageLogo\">\n <img src=\"/EvlPortalApp/framework/skins/directgov/images/printlogo.gif\" alt=\"Directgov\"></div><span class=\"bannerText\">Public services all in one place</span>\n </div> \n <div id=\"bannerRight\"></div> \n \n <div id=\"skip\">\n <ul>\n <li><a class=\"access\" href=\"#pageTitle\" tabindex=\"1\"><span class=\"menuBarItem\">Skip to content</span></a></li>\n </ul>\n </div>\n </div>\n </div>\n \n \n <div id=\"menuBar\">\n <div id=\"menuBarLeft\">\n </div>\n <div id=\"menuBarRight\">\n <span class=\"menubarimage\"><img src=\"/EvlPortalApp/framework/images/common/dvla_logo.gif\" alt=\"\">\n </span><span class=\"menubartext\">Services provided by DVLA:</span>\n </div>\n </div>\n \n <div id=\"container-content\">\n \n <div id=\"main\">\n\t\t\t<div id=\"pageTitle\">\n\t\t\t<h1>Vehicle enquiry</h1>\n\t\t\t</div>\n\t\t\t<div class=\"textparagraph\"><span class=\"subtitle\">The enquiry is complete.</span><span class=\"subtitleinline\">The vehicle details for </span><span class=\"subtitleinline\">SP04 UYK</span> <span class=\"subtitleinline\">are:</span></div>\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Date of Liability</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">01 11 2013</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Date of First Registration</span></td>\n\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">16 03 2004</span></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Year of Manufacture</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">2004</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Cylinder Capacity (cc)</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">2616cc</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">CO2 Emissions</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">284g/Km</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Fuel Type</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span id=\"fueltype\" class=\"bodytext\">PETROL</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Export Marker</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span id=\"exportmarker\" class=\"bodytext\">N</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Vehicle Status</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span id=\"vehiclelicencestatus\" class=\"bodytext\">Licence Not Due</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Vehicle Colour</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span id=\"colour\" class=\"bodytext\">YELLOW</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">Vehicle Type Approval</span></td>\n\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">M1</span></td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t\t<table>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td colspan=\"2\"><span class=\"bodytextbold\">Vehicle Excise Duty rate for vehicle</span></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">6 Months Rate</span></td>\n\t\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">£154.00</span></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableleft\"><span class=\"bodytextbold\">12 Months Rate</span></td>\n\t\t\t\t\t\t\t\t\t<td class=\"vehicledetailstableright\"><span class=\"bodytext\">£280.00</span></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t<div class=\"textparagraph\"><span class=\"blockbodytext\">Please be aware that if the vehicle has recently been relicensed or a SORN declared, these details may not yet be updated on the vehicle record.</span></div>\n\t\t\t<div class=\"textparagraph\"><span class=\"blockbodytext\">If you think that the details on the vehicle record are incorrect please write to:</span><span class=\"blockbodytext\">VCS</span><span class=\"blockbodytext\">DVLA</span><span class=\"blockbodytext\">Swansea</span><span class=\"blockbodytext\">SA99 1BA</span><span class=\"blockbodytext\">Please include the incorrect V5C Registration Certificate for amendment.</span></div>\n\t\t\t<div class=\"blockbodytext\">To make another enquiry go to\n\t\t\t<a href=\"/EvlPortalApp/app/enquiry?execution=e1s3&_eventId=enquiry\" title=\"Vehicle Enquiry\">Vehicle Enquiry</a>\n\t\t\t</div>\n\t\t\t<div id=\"finishButton\">\n\t\t\t <div class=\"masterassoc\">\n\t\t\t <a href=\"/EvlPortalApp/app/enquiry?execution=e1s3&_eventId=finish\" title=\"Finish\"> <img master=\"true\" src=\"/EvlPortalApp/framework/images/en/buttons/finish.gif\" alt=\"Finish\" hsrc=\"/EvlPortalApp/framework/images/en/buttons/finish_rollover.gif\"></a>\n\t\t\t </div>\n\t\t\t</div>\n </div>\n </div>\n <div class=\"footerSpacer\">\n </div>\n </div>\n </div>\n </div>\n \n \n <div id=\"footerWrapper\">\n <div id=\"footer\">\n <div id=\"footerContainer\">\n <div id=\"footerBarRight\"><span class=\"menuBarItem\">Site Last Updated: 22/01/2013</span>\n </div>\n </div>\n </div>\n </div>\n \n</body></html>
|
11
|
+
EOSHTML
|
12
|
+
@extractor = DataExtractor.new(html)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a doc" do
|
16
|
+
@extractor.send(:doc).should be_a Nokogiri::HTML::Document
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should extract tables" do
|
20
|
+
@extractor.send(:tables).length.should == 2
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should extract car_table" do
|
24
|
+
@extractor.send(:car_table).should be_a Nokogiri::XML::Element
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should extract from car data" do
|
28
|
+
@extractor.car_data.should == {"Date of Liability"=>"01 11 2013", "Date of First Registration"=>"16 03 2004", "Year of Manufacture"=>"2004", "Cylinder Capacity (cc)"=>"2616cc", "Emissions"=>"284g/Km", "Fuel Type"=>"PETROL", "Export Marker"=>"N", "Vehicle Status"=>"Licence Not Due", "Vehicle Colour"=>"YELLOW", "Vehicle Type Approval"=>"M1"}
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should extract tax_table" do
|
32
|
+
@extractor.send(:tax_table).should be_a Nokogiri::XML::Element
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should extract tax data" do
|
36
|
+
@extractor.tax_data.should == {"6 Months Rate"=>"£154.00", "12 Months Rate"=>"£280.00"}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rspec'
|
3
|
+
require_relative '../../lib/vehicle_details/scraper'
|
4
|
+
|
5
|
+
module Dvla::VehicleDetails
|
6
|
+
describe Scraper do
|
7
|
+
it "should return correct data" do
|
8
|
+
data = Scraper.new("SP04 UYK", "MAZDA").scrape
|
9
|
+
data.should == {
|
10
|
+
car_data: {"Date of Liability"=>"01 11 2013", "Date of First Registration"=>"16 03 2004", "Year of Manufacture"=>"2004", "Cylinder Capacity (cc)"=>"2616cc", "Emissions"=>"284g/Km", "Fuel Type"=>"PETROL", "Export Marker"=>"N", "Vehicle Status"=>"Licence Not Due", "Vehicle Colour"=>"YELLOW", "Vehicle Type Approval"=>"M1"},
|
11
|
+
tax_data: {"6 Months Rate"=>"£154.00", "12 Months Rate"=>"£280.00"}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rspec'
|
3
|
+
require_relative '../lib/vehicle_details'
|
4
|
+
|
5
|
+
module Dvla
|
6
|
+
describe VehicleDetails do
|
7
|
+
it "should retrieve data" do
|
8
|
+
VehicleDetails.retrieve("SP04 UYK", "MAZDA").should == {
|
9
|
+
car_data: {"Date of Liability"=>"01 11 2013", "Date of First Registration"=>"16 03 2004", "Year of Manufacture"=>"2004", "Cylinder Capacity (cc)"=>"2616cc", "Emissions"=>"284g/Km", "Fuel Type"=>"PETROL", "Export Marker"=>"N", "Vehicle Status"=>"Licence Not Due", "Vehicle Colour"=>"YELLOW", "Vehicle Type Approval"=>"M1"},
|
10
|
+
tax_data: {"6 Months Rate"=>"£154.00", "12 Months Rate"=>"£280.00"}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dvla
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremy Walker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-19 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A scraper to extract data from the DVLA
|
42
|
+
email:
|
43
|
+
- jez.walker@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- dvla.gemspec
|
55
|
+
- lib/dvla.rb
|
56
|
+
- lib/vehicle_details.rb
|
57
|
+
- lib/vehicle_details/data_extractor.rb
|
58
|
+
- lib/vehicle_details/scraper.rb
|
59
|
+
- lib/version.rb
|
60
|
+
- scrape.rb
|
61
|
+
- spec/vehicle_details/data_extractor_spec.rb
|
62
|
+
- spec/vehicle_details/vehicle_details_scraper_spec.rb
|
63
|
+
- spec/vehicle_details_spec.rb
|
64
|
+
homepage: https://github.com/iHiD/dvla
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.0.0
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: A scraper to extract data from the DVLA
|
88
|
+
test_files:
|
89
|
+
- spec/vehicle_details/data_extractor_spec.rb
|
90
|
+
- spec/vehicle_details/vehicle_details_scraper_spec.rb
|
91
|
+
- spec/vehicle_details_spec.rb
|