vinquery 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/vinquery.rb +4 -3
- data/lib/vinquery/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/vinquery.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'nokogiri'
|
3
|
-
require '
|
3
|
+
require 'logger'
|
4
4
|
|
5
5
|
class Vinquery
|
6
6
|
attr_reader :attributes, :errors, :result
|
@@ -12,10 +12,11 @@ class Vinquery
|
|
12
12
|
request
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(url, access_code, report_type, log =
|
15
|
+
def initialize(url, access_code, report_type, log = nil)
|
16
16
|
@url = url
|
17
17
|
@access_code = access_code
|
18
18
|
@report_type = report_type
|
19
|
+
log ||= Logger.new(nil)
|
19
20
|
@log = log
|
20
21
|
end
|
21
22
|
|
@@ -67,7 +68,7 @@ class Vinquery
|
|
67
68
|
@errors = []
|
68
69
|
@valid = doc.css('vin').first.attributes['status'].value == "SUCCESS"
|
69
70
|
doc.css('message').each{|msg| @errors << {msg.attributes['key'].value => msg.attributes['value'].value} } unless valid?
|
70
|
-
@errors.each{|msg| @log.error{"Vinquery#set_errors_hash - error: #{msg.to_s}"}} unless @errors.empty
|
71
|
+
@errors.each{|msg| @log.error{"Vinquery#set_errors_hash - error: #{msg.to_s}"}} unless @errors.empty?
|
71
72
|
end
|
72
73
|
|
73
74
|
def valid?
|
data/lib/vinquery/version.rb
CHANGED