vindata 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vindata/services/edmunds.rb +13 -4
- data/lib/vindata/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d696e00a32721eabc1780d9747aba12a89e9f981
|
4
|
+
data.tar.gz: f41d02df41a0abd722680e04c37c1a90c4617e25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a517a73f9f4cc23d03602b52ec77bea3cd70ee078caf2bfa745fa0017a36bdb58cac2a5c1ce4829e65e8a3a02f57d6ae0e79c5ff20c05f61d2bf92eaa049417
|
7
|
+
data.tar.gz: df6b509255a53f51ab460d18f26f2310cf1822a72553e0012efc27a15c3f6949411357a75719440b9567a7a57f099147ac715ed79feb4c1bb54848ed7deabb3e
|
@@ -92,8 +92,17 @@ module VinData::Services
|
|
92
92
|
# :mileage
|
93
93
|
# :zip
|
94
94
|
def get_acv data
|
95
|
-
|
96
|
-
|
95
|
+
|
96
|
+
info_is_present = data[:make] && data[:model] && data[:year]
|
97
|
+
vin_is_present = data[:vin].present?
|
98
|
+
condition_is_present = data[:condition].present?
|
99
|
+
location_is_present = data[:mileage] && data[:zip]
|
100
|
+
|
101
|
+
return nil unless (info_is_present || vin_is_present) &&
|
102
|
+
location_is_present &&
|
103
|
+
condition_is_present
|
104
|
+
|
105
|
+
if vin_is_present
|
97
106
|
car_details = details_by_vin data.delete(:vin)
|
98
107
|
return nil unless car_details
|
99
108
|
data.merge! car_details
|
@@ -107,12 +116,12 @@ module VinData::Services
|
|
107
116
|
acvlookup = 'https://api.edmunds.com/v1/api/tmv/tmvservice/calculateusedtmv'
|
108
117
|
response = JSON.parse(RestClient.get acvlookup, {:params => {
|
109
118
|
styleid: response['styles'][0]['id'],
|
110
|
-
condition:
|
119
|
+
condition: data[:condition].to_s.capitalize,
|
111
120
|
mileage: data[:mileage],
|
112
121
|
zip: data[:zip],
|
113
122
|
fmt: 'json',
|
114
123
|
api_key: configuration[:edmunds][:api_key]
|
115
|
-
|
124
|
+
}})
|
116
125
|
|
117
126
|
# TODO: Check data validity here
|
118
127
|
if response == nil || response['tmv'] == nil
|
data/lib/vindata/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roupen Mouradian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.
|
69
|
+
rubygems_version: 2.4.8
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Query popular VIN databases to get vehicle information.
|