instavin 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/.gitignore +18 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +20 -0
- data/README.md +65 -0
- data/Rakefile +10 -0
- data/instavin.gemspec +31 -0
- data/lib/instavin.rb +16 -0
- data/lib/instavin/errors.rb +6 -0
- data/lib/instavin/reports.rb +73 -0
- data/lib/instavin/version.rb +3 -0
- data/test/fixtures/vcr_cassettes/access_vtr_report_success.yml +45 -0
- data/test/fixtures/vcr_cassettes/user_access_token_success.yml +45 -0
- data/test/fixtures/vcr_cassettes/user_vtr_invalid_vin.yml +45 -0
- data/test/fixtures/vcr_cassettes/user_vtr_report_success.yml +45 -0
- data/test/instavin/reports_test.rb +58 -0
- data/test/instavin_test.rb +15 -0
- data/test/minitest_helper.rb +15 -0
- metadata +198 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 66c83e96c3f0eb36c68587dfab247cb89b77f924
|
4
|
+
data.tar.gz: 61eee28eea962b2a53e652a3ce3817030d77e3da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 422473025aeac6ef28da367c9037c1a87b7391dbd1dff1cf87dfbc633548f4bc3ba03107bb189bc76ee5a1f0ae536436476a1105722115c624194cb0724e1bb6
|
7
|
+
data.tar.gz: 58e5135ec99f9c8ebec7a1d1dde402542cf7ac1fd5376afcff9c41fdc62f43a78c406acb3a115c7a4a83957a0bc1d84fa3b794ce73e40df475a7cebec0fdbb88
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
instavin (0.0.1)
|
5
|
+
httparty
|
6
|
+
symboltable
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.5)
|
12
|
+
crack (0.4.1)
|
13
|
+
safe_yaml (~> 0.9.0)
|
14
|
+
excon (0.25.3)
|
15
|
+
httparty (0.11.0)
|
16
|
+
multi_json (~> 1.0)
|
17
|
+
multi_xml (>= 0.5.2)
|
18
|
+
metaclass (0.0.1)
|
19
|
+
minitest (5.0.6)
|
20
|
+
mocha (0.14.0)
|
21
|
+
metaclass (~> 0.0.1)
|
22
|
+
multi_json (1.7.9)
|
23
|
+
multi_xml (0.5.5)
|
24
|
+
rake (10.1.0)
|
25
|
+
safe_yaml (0.9.5)
|
26
|
+
symboltable (1.0.2)
|
27
|
+
vcr (2.5.0)
|
28
|
+
webmock (1.11.0)
|
29
|
+
addressable (>= 2.2.7)
|
30
|
+
crack (>= 0.3.2)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
bundler (~> 1.3)
|
37
|
+
excon
|
38
|
+
instavin!
|
39
|
+
minitest
|
40
|
+
mocha
|
41
|
+
rake
|
42
|
+
vcr
|
43
|
+
webmock (= 1.11)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Cory Stephenson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
instaVIN
|
2
|
+
========
|
3
|
+
|
4
|
+
Gem for connection to instaVIN and retrieving a report.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'instavin'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install instavin
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
To start, use a configuration block to set up your credentials:
|
23
|
+
|
24
|
+
InstaVIN.configure do |config|
|
25
|
+
config.user_id = "xxxx"
|
26
|
+
config.password = "xxxx"
|
27
|
+
config.api_key = "xxxx"
|
28
|
+
end
|
29
|
+
|
30
|
+
There are two ways to use the service. Through your own username and password, which are set in the configuration. Or, through an access_token generated by another user's user_id and password, and your API key.
|
31
|
+
|
32
|
+
To request an access token for another user:
|
33
|
+
|
34
|
+
InstaVIN.configure do |config|
|
35
|
+
config.api_key = "xxxx"
|
36
|
+
end
|
37
|
+
|
38
|
+
reports = InstaVIN::Reports.new
|
39
|
+
token = reports.access_token(username, password)
|
40
|
+
reports.set_auth_with_token(token)
|
41
|
+
reports.vtr_report("VIN")
|
42
|
+
|
43
|
+
or
|
44
|
+
|
45
|
+
InstaVIN.configure do |config|
|
46
|
+
config.api_key = "xxxx"
|
47
|
+
end
|
48
|
+
|
49
|
+
reports = InstaVIN::Reports.new(access_token)
|
50
|
+
reports.vtr_report("VIN")
|
51
|
+
|
52
|
+
There are two reports you can request through the API.
|
53
|
+
VTR is a full report, SVC is a partial, Salvage and Vehicle Check report.
|
54
|
+
|
55
|
+
reports = InstaVIN::Reports.new
|
56
|
+
reports.vtr_report("VIN")
|
57
|
+
reports.svc_report("VIN")
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/instavin.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'instavin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "instavin"
|
8
|
+
spec.version = InstaVIN::VERSION
|
9
|
+
spec.authors = ["Tony Coconate", "Cory Stephenson"]
|
10
|
+
spec.email = ["me@tonycoconate.com", "aevin@me.com"]
|
11
|
+
spec.description = %q{Provides a ruby interface for the instaVIN's API. Read more about it here: http://www.blackbookusa.com}
|
12
|
+
spec.summary = %q{A ruby interface for instaVIN Book's API}
|
13
|
+
spec.homepage = "http://github.com/Aevin1387/instaVIN"
|
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{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "symboltable"
|
22
|
+
spec.add_dependency "httparty"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "minitest"
|
27
|
+
spec.add_development_dependency "vcr"
|
28
|
+
spec.add_development_dependency "webmock", '1.11' # Locked at 1.12.x to prevent VCR warnings
|
29
|
+
spec.add_development_dependency "excon"
|
30
|
+
spec.add_development_dependency "mocha"
|
31
|
+
end
|
data/lib/instavin.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
module InstaVIN
|
4
|
+
class Reports
|
5
|
+
include HTTParty
|
6
|
+
base_uri "https://www.instavin.com/api/v2/json"
|
7
|
+
|
8
|
+
|
9
|
+
def initialize(access_token=nil)
|
10
|
+
if access_token.nil? != true
|
11
|
+
@auth = { username: access_token, password: InstaVIN.config.api_key }
|
12
|
+
else
|
13
|
+
@auth = { username: InstaVIN.config.username, password: InstaVIN.config.password }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def set_auth_with_token(access_token)
|
18
|
+
@auth = { username: access_token, password: InstaVIN.config.api_key }
|
19
|
+
end
|
20
|
+
|
21
|
+
def order_report(report_type, options)
|
22
|
+
raise ArgumentError, "A VIN is required" if options[:vin].nil? || options[:vin].empty?
|
23
|
+
|
24
|
+
response = self.class.post("/order/#{report_type}", { body: options, basic_auth: @auth })
|
25
|
+
parsed_response = response.parsed_response
|
26
|
+
check_response_for_errors parsed_response
|
27
|
+
parsed_response["items"].map do |report_item|
|
28
|
+
check_report_for_error report_item
|
29
|
+
|
30
|
+
raise NoDataError if report_item["report_summary"].nil?
|
31
|
+
report_summary = report_item["report_summary"]
|
32
|
+
{
|
33
|
+
vin: report_summary["vin"],
|
34
|
+
json_url: report_summary["url"],
|
35
|
+
html_url: report_summary["html_url"],
|
36
|
+
pdf_url: report_summary["pdf_url"]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def vtr_report(vin)
|
42
|
+
order_report("VTR", vin: vin)
|
43
|
+
end
|
44
|
+
|
45
|
+
def svc_report(vin)
|
46
|
+
order_report("SVC", vin: vin)
|
47
|
+
end
|
48
|
+
|
49
|
+
def access_token(username, password)
|
50
|
+
response = self.class.post("/account/access_token",
|
51
|
+
body: { api_key: InstaVIN.config.api_key },
|
52
|
+
basic_auth: { username: username, password: password }
|
53
|
+
).parsed_response
|
54
|
+
|
55
|
+
check_response_for_errors(response)
|
56
|
+
raise DeveloperError, "InstaVIN did not respond with an access token" if response["token"].nil? || response["token"].empty?
|
57
|
+
response["token"]
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def check_response_for_errors(response)
|
63
|
+
raise DowntimeError, "InstaVIN is down for #{response["reason"]} until approximately #{response["down_until"]}." if(response["_type"] == "downtime")
|
64
|
+
raise DeveloperError, "#{response["status_code"]}: #{response["error_message"]}" if response["_type"] == "error"
|
65
|
+
end
|
66
|
+
|
67
|
+
def check_report_for_error(report)
|
68
|
+
return unless report["state"] == "error"
|
69
|
+
raise NoDataError if report["detail_code"] == "NO_DATA_AVAILABLE"
|
70
|
+
raise DeveloperError, "InstaVIN Report Error #{report["detail_code"]}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://access_token:api_key@www.instavin.com/api/v2/json/order/VTR
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: vin=1D7HW22K45S177616
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 401
|
13
|
+
message: UNAUTHORIZED
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Tue, 13 Aug 2013 20:53:48 GMT
|
17
|
+
Server:
|
18
|
+
- Apache/2.2.3 (Red Hat)
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.2.17
|
21
|
+
Set-Cookie:
|
22
|
+
- PHPSESSID=jfhhuq1od3qkjoe06a292tk574; path=/; domain=www.instavin.com
|
23
|
+
Expires:
|
24
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
27
|
+
Pragma:
|
28
|
+
- no-cache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
X-Original-Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Length:
|
34
|
+
- '83'
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- http://myvinreport.com
|
37
|
+
Content-Type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: "{\"status_code\": 401, \"_type\": \"error\", \"error_message\": \"Invalid
|
42
|
+
authentication\"}\r\n"
|
43
|
+
http_version:
|
44
|
+
recorded_at: Tue, 13 Aug 2013 20:53:48 GMT
|
45
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://username:password@www.instavin.com/api/v2/json/account/access_token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: api_key=api_key
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 401
|
13
|
+
message: UNAUTHORIZED
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Tue, 13 Aug 2013 20:53:47 GMT
|
17
|
+
Server:
|
18
|
+
- Apache/2.2.3 (Red Hat)
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.2.17
|
21
|
+
Set-Cookie:
|
22
|
+
- PHPSESSID=hhekl6m8t5scd9v58es9gcdbq5; path=/; domain=www.instavin.com
|
23
|
+
Expires:
|
24
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
27
|
+
Pragma:
|
28
|
+
- no-cache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
X-Original-Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Length:
|
34
|
+
- '83'
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- http://myvinreport.com
|
37
|
+
Content-Type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: "{\"status_code\": 401, \"_type\": \"error\", \"error_message\": \"Invalid
|
42
|
+
authentication\"}\r\n"
|
43
|
+
http_version:
|
44
|
+
recorded_at: Tue, 13 Aug 2013 20:53:47 GMT
|
45
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://username:password@www.instavin.com/api/v2/json/order/VTR
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: vin=INVALID_VIN
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 401
|
13
|
+
message: UNAUTHORIZED
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Tue, 13 Aug 2013 20:53:47 GMT
|
17
|
+
Server:
|
18
|
+
- Apache/2.2.3 (Red Hat)
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.2.17
|
21
|
+
Set-Cookie:
|
22
|
+
- PHPSESSID=r659krdgchk5muvuba3cavplh1; path=/; domain=www.instavin.com
|
23
|
+
Expires:
|
24
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
27
|
+
Pragma:
|
28
|
+
- no-cache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
X-Original-Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Length:
|
34
|
+
- '83'
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- http://myvinreport.com
|
37
|
+
Content-Type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: "{\"status_code\": 401, \"_type\": \"error\", \"error_message\": \"Invalid
|
42
|
+
authentication\"}\r\n"
|
43
|
+
http_version:
|
44
|
+
recorded_at: Tue, 13 Aug 2013 20:53:47 GMT
|
45
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://username:password@www.instavin.com/api/v2/json/order/VTR
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: vin=1D7HW22K45S177616
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 401
|
13
|
+
message: UNAUTHORIZED
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Tue, 13 Aug 2013 20:53:46 GMT
|
17
|
+
Server:
|
18
|
+
- Apache/2.2.3 (Red Hat)
|
19
|
+
X-Powered-By:
|
20
|
+
- PHP/5.2.17
|
21
|
+
Set-Cookie:
|
22
|
+
- PHPSESSID=9ktgmtmohv5erqre4vraqgi6k7; path=/; domain=www.instavin.com
|
23
|
+
Expires:
|
24
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
27
|
+
Pragma:
|
28
|
+
- no-cache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
X-Original-Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Length:
|
34
|
+
- '83'
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- http://myvinreport.com
|
37
|
+
Content-Type:
|
38
|
+
- application/json
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: "{\"status_code\": 401, \"_type\": \"error\", \"error_message\": \"Invalid
|
42
|
+
authentication\"}\r\n"
|
43
|
+
http_version:
|
44
|
+
recorded_at: Tue, 13 Aug 2013 20:53:47 GMT
|
45
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative "../minitest_helper"
|
2
|
+
|
3
|
+
describe InstaVIN::Reports do
|
4
|
+
let(:username) { "username" }
|
5
|
+
let(:password) { "password" }
|
6
|
+
let(:api_key) { "api_key" }
|
7
|
+
let(:access_token) { "access_token" }
|
8
|
+
|
9
|
+
before do
|
10
|
+
InstaVIN.configure do |config|
|
11
|
+
config.username = username
|
12
|
+
config.password = password
|
13
|
+
config.api_key = api_key
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:reports) { InstaVIN::Reports.new }
|
18
|
+
let(:vin) { "1D7HW22K45S177616" }
|
19
|
+
|
20
|
+
describe "using configured user" do
|
21
|
+
it "can get a vtr report" do
|
22
|
+
VCR.use_cassette("user_vtr_report_success") do
|
23
|
+
response = reports.vtr_report(vin).first
|
24
|
+
response.must_include :html_url
|
25
|
+
response.must_include :json_url
|
26
|
+
response.must_include :pdf_url
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "can get an access token" do
|
31
|
+
VCR.use_cassette("user_access_token_success") do
|
32
|
+
response = reports.access_token(InstaVIN.config.username, InstaVIN.config.password)
|
33
|
+
assert_equal response, access_token
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should raise an error if the vin is invalid" do
|
38
|
+
VCR.use_cassette("user_vtr_invalid_vin") do
|
39
|
+
proc { reports.vtr_report("INVALID_VIN") }.must_raise InstaVIN::NoDataError
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "using an access token" do
|
45
|
+
before do
|
46
|
+
reports.set_auth_with_token(access_token)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "can get a vtr report" do
|
50
|
+
VCR.use_cassette("access_vtr_report_success") do
|
51
|
+
response = reports.vtr_report(vin).first
|
52
|
+
response.must_include :html_url
|
53
|
+
response.must_include :json_url
|
54
|
+
response.must_include :pdf_url
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "minitest_helper"
|
2
|
+
|
3
|
+
describe InstaVIN do
|
4
|
+
before do
|
5
|
+
InstaVIN.remove_class_variable :@@config if InstaVIN.class_variable_defined? :@@config
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should yield a configuration object to block" do
|
9
|
+
InstaVIN.configure do |config|
|
10
|
+
config.foo = "bar"
|
11
|
+
end
|
12
|
+
|
13
|
+
InstaVIN.config.foo.must_equal "bar"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require "instavin"
|
5
|
+
|
6
|
+
require "minitest/autorun"
|
7
|
+
require "minitest/spec"
|
8
|
+
require "mocha/setup"
|
9
|
+
require "vcr"
|
10
|
+
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
|
13
|
+
c.hook_into :webmock
|
14
|
+
c.default_cassette_options = { match_requests_on: [:method, :uri, :body] }
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: instavin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tony Coconate
|
8
|
+
- Cory Stephenson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: symboltable
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: httparty
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.3'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.3'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: minitest
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: vcr
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: webmock
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.11'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.11'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: excon
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: mocha
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
description: 'Provides a ruby interface for the instaVIN''s API. Read more about it
|
141
|
+
here: http://www.blackbookusa.com'
|
142
|
+
email:
|
143
|
+
- me@tonycoconate.com
|
144
|
+
- aevin@me.com
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- .gitignore
|
150
|
+
- Gemfile
|
151
|
+
- Gemfile.lock
|
152
|
+
- LICENSE
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- instavin.gemspec
|
156
|
+
- lib/instavin.rb
|
157
|
+
- lib/instavin/errors.rb
|
158
|
+
- lib/instavin/reports.rb
|
159
|
+
- lib/instavin/version.rb
|
160
|
+
- test/fixtures/vcr_cassettes/access_vtr_report_success.yml
|
161
|
+
- test/fixtures/vcr_cassettes/user_access_token_success.yml
|
162
|
+
- test/fixtures/vcr_cassettes/user_vtr_invalid_vin.yml
|
163
|
+
- test/fixtures/vcr_cassettes/user_vtr_report_success.yml
|
164
|
+
- test/instavin/reports_test.rb
|
165
|
+
- test/instavin_test.rb
|
166
|
+
- test/minitest_helper.rb
|
167
|
+
homepage: http://github.com/Aevin1387/instaVIN
|
168
|
+
licenses:
|
169
|
+
- MIT
|
170
|
+
metadata: {}
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - '>='
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.0.5
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: A ruby interface for instaVIN Book's API
|
191
|
+
test_files:
|
192
|
+
- test/fixtures/vcr_cassettes/access_vtr_report_success.yml
|
193
|
+
- test/fixtures/vcr_cassettes/user_access_token_success.yml
|
194
|
+
- test/fixtures/vcr_cassettes/user_vtr_invalid_vin.yml
|
195
|
+
- test/fixtures/vcr_cassettes/user_vtr_report_success.yml
|
196
|
+
- test/instavin/reports_test.rb
|
197
|
+
- test/instavin_test.rb
|
198
|
+
- test/minitest_helper.rb
|