black_book 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/black_book.gemspec +1 -0
- data/lib/black_book/errors.rb +30 -5
- data/lib/black_book/used_cars.rb +7 -7
- data/lib/black_book/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe4e7ea040ebca8cb6b4546c4b0d746379584f44
|
4
|
+
data.tar.gz: e22f6ea87122f2fd38ab184a370d69465287fb39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d30a1d05257b72a83f1af3ee59ac0ce6b19f1d6b51038a85d8da0a2d05c73e5086aa9d03e70b633e095fd681fe71ba8c1e7b2961b98e0d015184c38bf7b9215a
|
7
|
+
data.tar.gz: 0eaf80b1656140aacabce8dedc36abb6e8672052f3841028de303b6fcf9ff985dc209b5a93cde557b8291c617b824cad3b2b3f84a51687c66b2b0ad738514191
|
data/black_book.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "debugger"
|
26
27
|
spec.add_development_dependency "minitest"
|
27
28
|
spec.add_development_dependency "vcr"
|
28
29
|
spec.add_development_dependency "webmock", '~> 1.10.0' # Locked at 1.10.x to prevent VCR warnings
|
data/lib/black_book/errors.rb
CHANGED
@@ -1,8 +1,33 @@
|
|
1
1
|
module BlackBook
|
2
2
|
class BlackBookError < StandardError; end
|
3
|
-
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
|
4
|
+
class VinNotFound < BlackBookError
|
5
|
+
def to_s
|
6
|
+
"VIN not found"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class MakesNotFound < BlackBookError
|
11
|
+
def to_s
|
12
|
+
"makes not found"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ModelsNotFound < BlackBookError
|
17
|
+
def to_s
|
18
|
+
"models not found"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class SeriesNotFound < BlackBookError
|
23
|
+
def to_s
|
24
|
+
"series not found"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class StylesNotFound < BlackBookError
|
29
|
+
def to_s
|
30
|
+
"styles not found"
|
31
|
+
end
|
32
|
+
end
|
8
33
|
end
|
data/lib/black_book/used_cars.rb
CHANGED
@@ -24,7 +24,7 @@ module BlackBook
|
|
24
24
|
envelope = response.hash[:envelope]
|
25
25
|
|
26
26
|
raise VinNotFound if envelope[:header][:user_credentials][:returncode] == "20"
|
27
|
-
raise BlackBookError
|
27
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
28
28
|
|
29
29
|
envelope[:body][:current_vin_values_response][:current_vin_values_result]
|
30
30
|
rescue Savon::SOAPFault => e
|
@@ -54,7 +54,7 @@ module BlackBook
|
|
54
54
|
envelope = response.hash[:envelope]
|
55
55
|
|
56
56
|
raise VehicleNotFound if envelope[:header][:user_credentials][:returncode] == "20"
|
57
|
-
raise BlackBookError
|
57
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
58
58
|
|
59
59
|
envelope[:body][:current_values_response][:current_values_result]
|
60
60
|
rescue Savon::SOAPFault => e
|
@@ -68,7 +68,7 @@ module BlackBook
|
|
68
68
|
|
69
69
|
envelope = response.hash[:envelope]
|
70
70
|
|
71
|
-
raise BlackBookError
|
71
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
72
72
|
|
73
73
|
envelope[:body][:years_response][:years_result][:years][:year]
|
74
74
|
rescue Savon::SOAPFault => e
|
@@ -83,7 +83,7 @@ module BlackBook
|
|
83
83
|
|
84
84
|
envelope = response.hash[:envelope]
|
85
85
|
|
86
|
-
raise BlackBookError
|
86
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
87
87
|
raise MakesNotFound if envelope[:body][:makes_response][:makes_result][:makes].nil?
|
88
88
|
|
89
89
|
envelope[:body][:makes_response][:makes_result][:makes][:make]
|
@@ -100,7 +100,7 @@ module BlackBook
|
|
100
100
|
|
101
101
|
envelope = response.hash[:envelope]
|
102
102
|
|
103
|
-
raise BlackBookError
|
103
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
104
104
|
raise ModelsNotFound if envelope[:body][:models_response][:models_result][:models].nil?
|
105
105
|
|
106
106
|
envelope[:body][:models_response][:models_result][:models][:model]
|
@@ -118,7 +118,7 @@ module BlackBook
|
|
118
118
|
|
119
119
|
envelope = response.hash[:envelope]
|
120
120
|
|
121
|
-
raise BlackBookError
|
121
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
122
122
|
raise SeriesNotFound if envelope[:body][:series_response][:series_result][:series].nil?
|
123
123
|
|
124
124
|
envelope[:body][:series_response][:series_result][:series][:vehseries]
|
@@ -137,7 +137,7 @@ module BlackBook
|
|
137
137
|
|
138
138
|
envelope = response.hash[:envelope]
|
139
139
|
|
140
|
-
raise BlackBookError
|
140
|
+
raise BlackBookError.new(envelope[:header][:user_credentials][:returnmessage]) if envelope[:header][:user_credentials][:returncode] != "0"
|
141
141
|
raise StylesNotFound if envelope[:body][:body_styles_response][:body_styles_result][:styles].nil?
|
142
142
|
|
143
143
|
envelope[:body][:body_styles_response][:body_styles_result][:styles][:style]
|
data/lib/black_book/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: black_book
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Coconate
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: symboltable
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: debugger
|
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'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: minitest
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|