uk_vehicle_data 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +34 -0
- data/lib/tasks/ukvehicledata_tasks.rake +4 -0
- data/lib/uk_vehicle_data.rb +53 -0
- data/lib/uk_vehicle_data/api_operations/retrieve.rb +11 -0
- data/lib/uk_vehicle_data/api_resource.rb +8 -0
- data/lib/uk_vehicle_data/vehicle_data.rb +5 -0
- data/lib/uk_vehicle_data/version.rb +3 -0
- data/test/dummy/Gemfile +50 -0
- data/test/dummy/Gemfile.lock +186 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +9 -0
- data/test/dummy/bin/rake +9 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/bin/spring +17 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/uk_vehicle_data.rb +1 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/test/test_helper.rb +10 -0
- data/test/test_helper.rb +20 -0
- data/test/ukvehicledata_test.rb +7 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 074e60adb003fa28ff2b05990424dad5e38c7679
|
4
|
+
data.tar.gz: 0b617a443cab56a65b37b7944daa3ff8d40853c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfd4b2cf9530a20d4fe873592868b4437042c781356a81430214c1cb1418409fcb4e43403a811249f9f56da49ee7132b930c903c0e8c1b0648fba7b430db68ae
|
7
|
+
data.tar.gz: fbf45482aceae9e2dbd44d5b62b0f6ea67c80eefa58e24b6bda0e4ec871b65e6cbd7568bd9d650484fa25e9b545cd60d3d53979ce01f5b8fc3bed510e708285a
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Ukvehicledata'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
require 'uk_vehicle_data/api_operations/retrieve'
|
4
|
+
|
5
|
+
require 'uk_vehicle_data/api_resource'
|
6
|
+
require 'uk_vehicle_data/vehicle_data'
|
7
|
+
|
8
|
+
module UkVehicleData
|
9
|
+
API_BASE = "https://uk1.ukvehicledata.co.uk/api/datapackage/"
|
10
|
+
|
11
|
+
class UkVehicleDataError < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
class AuthenticationError < UkVehicleDataError; end
|
15
|
+
class ConfigurationError < UkVehicleDataError; end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
def api_key
|
20
|
+
defined? @api_key and @api_key or raise(
|
21
|
+
ConfigurationError, "UkVehicleData api key not configured"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
attr_writer :api_key
|
25
|
+
|
26
|
+
def request method, resource, params={}
|
27
|
+
vd_api_key = params[:auth_api_key] || UkVehicleData.api_key
|
28
|
+
|
29
|
+
defined? method or raise(
|
30
|
+
ArgumentError, "Request method has not been specified"
|
31
|
+
)
|
32
|
+
defined? resource or raise(
|
33
|
+
ArgumentError, "Request resource has not been specified"
|
34
|
+
)
|
35
|
+
if method == :get
|
36
|
+
headers = { accept: :json, content_type: :json }.merge({params: params})
|
37
|
+
payload = nil
|
38
|
+
else
|
39
|
+
headers = { accept: :json, content_type: :json }
|
40
|
+
payload = params
|
41
|
+
end
|
42
|
+
RestClient::Request.new({
|
43
|
+
method: method,
|
44
|
+
url: API_BASE + resource,
|
45
|
+
payload: payload ? payload.to_json : nil,
|
46
|
+
headers: headers
|
47
|
+
}).execute do |response, request, result|
|
48
|
+
str_response = response.to_str
|
49
|
+
str_response.blank? ? '' : JSON.parse(str_response)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/test/dummy/Gemfile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
|
+
gem 'rails', '4.2.7'
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'sqlite3'
|
8
|
+
# Use SCSS for stylesheets
|
9
|
+
gem 'sass-rails', '~> 5.0'
|
10
|
+
# Use Uglifier as compressor for JavaScript assets
|
11
|
+
gem 'uglifier', '>= 1.3.0'
|
12
|
+
# Use CoffeeScript for .coffee assets and views
|
13
|
+
gem 'coffee-rails', '~> 4.1.0'
|
14
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
16
|
+
|
17
|
+
# Use jquery as the JavaScript library
|
18
|
+
gem 'jquery-rails'
|
19
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
20
|
+
gem 'turbolinks'
|
21
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
22
|
+
gem 'jbuilder', '~> 2.0'
|
23
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
24
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# Use ActiveModel has_secure_password
|
30
|
+
# gem 'bcrypt', '~> 3.1.7'
|
31
|
+
|
32
|
+
# Use Unicorn as the app server
|
33
|
+
# gem 'unicorn'
|
34
|
+
|
35
|
+
# Use Capistrano for deployment
|
36
|
+
# gem 'capistrano-rails', group: :development
|
37
|
+
|
38
|
+
group :development, :test do
|
39
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
40
|
+
gem 'byebug'
|
41
|
+
end
|
42
|
+
|
43
|
+
group :development do
|
44
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
45
|
+
gem 'web-console', '~> 2.0'
|
46
|
+
|
47
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
48
|
+
gem 'spring'
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,186 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (4.2.7)
|
5
|
+
actionpack (= 4.2.7)
|
6
|
+
actionview (= 4.2.7)
|
7
|
+
activejob (= 4.2.7)
|
8
|
+
mail (~> 2.5, >= 2.5.4)
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
+
actionpack (4.2.7)
|
11
|
+
actionview (= 4.2.7)
|
12
|
+
activesupport (= 4.2.7)
|
13
|
+
rack (~> 1.6)
|
14
|
+
rack-test (~> 0.6.2)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
+
actionview (4.2.7)
|
18
|
+
activesupport (= 4.2.7)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
activejob (4.2.7)
|
24
|
+
activesupport (= 4.2.7)
|
25
|
+
globalid (>= 0.3.0)
|
26
|
+
activemodel (4.2.7)
|
27
|
+
activesupport (= 4.2.7)
|
28
|
+
builder (~> 3.1)
|
29
|
+
activerecord (4.2.7)
|
30
|
+
activemodel (= 4.2.7)
|
31
|
+
activesupport (= 4.2.7)
|
32
|
+
arel (~> 6.0)
|
33
|
+
activesupport (4.2.7)
|
34
|
+
i18n (~> 0.7)
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
36
|
+
minitest (~> 5.1)
|
37
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
38
|
+
tzinfo (~> 1.1)
|
39
|
+
arel (6.0.4)
|
40
|
+
binding_of_caller (0.8.0)
|
41
|
+
debug_inspector (>= 0.0.1)
|
42
|
+
builder (3.2.3)
|
43
|
+
byebug (10.0.2)
|
44
|
+
coffee-rails (4.1.1)
|
45
|
+
coffee-script (>= 2.2.0)
|
46
|
+
railties (>= 4.0.0, < 5.1.x)
|
47
|
+
coffee-script (2.4.1)
|
48
|
+
coffee-script-source
|
49
|
+
execjs
|
50
|
+
coffee-script-source (1.12.2)
|
51
|
+
concurrent-ruby (1.0.5)
|
52
|
+
crass (1.0.4)
|
53
|
+
debug_inspector (0.0.3)
|
54
|
+
domain_name (0.5.20180417)
|
55
|
+
unf (>= 0.0.5, < 1.0.0)
|
56
|
+
erubis (2.7.0)
|
57
|
+
execjs (2.7.0)
|
58
|
+
ffi (1.9.23)
|
59
|
+
globalid (0.4.1)
|
60
|
+
activesupport (>= 4.2.0)
|
61
|
+
http-cookie (1.0.3)
|
62
|
+
domain_name (~> 0.5)
|
63
|
+
i18n (0.9.5)
|
64
|
+
concurrent-ruby (~> 1.0)
|
65
|
+
jbuilder (2.7.0)
|
66
|
+
activesupport (>= 4.2.0)
|
67
|
+
multi_json (>= 1.2)
|
68
|
+
jquery-rails (4.3.3)
|
69
|
+
rails-dom-testing (>= 1, < 3)
|
70
|
+
railties (>= 4.2.0)
|
71
|
+
thor (>= 0.14, < 2.0)
|
72
|
+
json (1.8.6)
|
73
|
+
loofah (2.2.2)
|
74
|
+
crass (~> 1.0.2)
|
75
|
+
nokogiri (>= 1.5.9)
|
76
|
+
mail (2.7.0)
|
77
|
+
mini_mime (>= 0.1.1)
|
78
|
+
mime-types (3.1)
|
79
|
+
mime-types-data (~> 3.2015)
|
80
|
+
mime-types-data (3.2016.0521)
|
81
|
+
mini_mime (1.0.0)
|
82
|
+
mini_portile2 (2.3.0)
|
83
|
+
minitest (5.11.3)
|
84
|
+
multi_json (1.13.1)
|
85
|
+
netrc (0.11.0)
|
86
|
+
nokogiri (1.8.2)
|
87
|
+
mini_portile2 (~> 2.3.0)
|
88
|
+
rack (1.6.10)
|
89
|
+
rack-test (0.6.3)
|
90
|
+
rack (>= 1.0)
|
91
|
+
rails (4.2.7)
|
92
|
+
actionmailer (= 4.2.7)
|
93
|
+
actionpack (= 4.2.7)
|
94
|
+
actionview (= 4.2.7)
|
95
|
+
activejob (= 4.2.7)
|
96
|
+
activemodel (= 4.2.7)
|
97
|
+
activerecord (= 4.2.7)
|
98
|
+
activesupport (= 4.2.7)
|
99
|
+
bundler (>= 1.3.0, < 2.0)
|
100
|
+
railties (= 4.2.7)
|
101
|
+
sprockets-rails
|
102
|
+
rails-deprecated_sanitizer (1.0.3)
|
103
|
+
activesupport (>= 4.2.0.alpha)
|
104
|
+
rails-dom-testing (1.0.9)
|
105
|
+
activesupport (>= 4.2.0, < 5.0)
|
106
|
+
nokogiri (~> 1.6)
|
107
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
108
|
+
rails-html-sanitizer (1.0.4)
|
109
|
+
loofah (~> 2.2, >= 2.2.2)
|
110
|
+
railties (4.2.7)
|
111
|
+
actionpack (= 4.2.7)
|
112
|
+
activesupport (= 4.2.7)
|
113
|
+
rake (>= 0.8.7)
|
114
|
+
thor (>= 0.18.1, < 2.0)
|
115
|
+
rake (12.3.1)
|
116
|
+
rb-fsevent (0.10.3)
|
117
|
+
rb-inotify (0.9.10)
|
118
|
+
ffi (>= 0.5.0, < 2)
|
119
|
+
rdoc (4.3.0)
|
120
|
+
rest-client (2.0.2)
|
121
|
+
http-cookie (>= 1.0.2, < 2.0)
|
122
|
+
mime-types (>= 1.16, < 4.0)
|
123
|
+
netrc (~> 0.8)
|
124
|
+
sass (3.5.6)
|
125
|
+
sass-listen (~> 4.0.0)
|
126
|
+
sass-listen (4.0.0)
|
127
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
128
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
129
|
+
sass-rails (5.0.7)
|
130
|
+
railties (>= 4.0.0, < 6)
|
131
|
+
sass (~> 3.1)
|
132
|
+
sprockets (>= 2.8, < 4.0)
|
133
|
+
sprockets-rails (>= 2.0, < 4.0)
|
134
|
+
tilt (>= 1.1, < 3)
|
135
|
+
sdoc (0.4.2)
|
136
|
+
json (~> 1.7, >= 1.7.7)
|
137
|
+
rdoc (~> 4.0)
|
138
|
+
spring (2.0.2)
|
139
|
+
activesupport (>= 4.2)
|
140
|
+
sprockets (3.7.1)
|
141
|
+
concurrent-ruby (~> 1.0)
|
142
|
+
rack (> 1, < 3)
|
143
|
+
sprockets-rails (3.2.1)
|
144
|
+
actionpack (>= 4.0)
|
145
|
+
activesupport (>= 4.0)
|
146
|
+
sprockets (>= 3.0.0)
|
147
|
+
sqlite3 (1.3.13)
|
148
|
+
thor (0.20.0)
|
149
|
+
thread_safe (0.3.6)
|
150
|
+
tilt (2.0.8)
|
151
|
+
turbolinks (5.1.1)
|
152
|
+
turbolinks-source (~> 5.1)
|
153
|
+
turbolinks-source (5.1.0)
|
154
|
+
tzinfo (1.2.5)
|
155
|
+
thread_safe (~> 0.1)
|
156
|
+
uglifier (4.1.10)
|
157
|
+
execjs (>= 0.3.0, < 3)
|
158
|
+
unf (0.1.4)
|
159
|
+
unf_ext
|
160
|
+
unf_ext (0.0.7.5)
|
161
|
+
web-console (2.3.0)
|
162
|
+
activemodel (>= 4.0)
|
163
|
+
binding_of_caller (>= 0.7.2)
|
164
|
+
railties (>= 4.0)
|
165
|
+
sprockets-rails (>= 2.0, < 4.0)
|
166
|
+
|
167
|
+
PLATFORMS
|
168
|
+
ruby
|
169
|
+
|
170
|
+
DEPENDENCIES
|
171
|
+
byebug
|
172
|
+
coffee-rails (~> 4.1.0)
|
173
|
+
jbuilder (~> 2.0)
|
174
|
+
jquery-rails
|
175
|
+
rails (= 4.2.7)
|
176
|
+
rest-client
|
177
|
+
sass-rails (~> 5.0)
|
178
|
+
sdoc (~> 0.4.0)
|
179
|
+
spring
|
180
|
+
sqlite3
|
181
|
+
turbolinks
|
182
|
+
uglifier (>= 1.3.0)
|
183
|
+
web-console (~> 2.0)
|
184
|
+
|
185
|
+
BUNDLED WITH
|
186
|
+
1.14.6
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|