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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8c4f9f81bb5a5effb3cf0becace3809063a6c64
4
- data.tar.gz: c776fd750c8f4d1bd952cda38a8593647d9ecdce
3
+ metadata.gz: d696e00a32721eabc1780d9747aba12a89e9f981
4
+ data.tar.gz: f41d02df41a0abd722680e04c37c1a90c4617e25
5
5
  SHA512:
6
- metadata.gz: 3c5093a3839323355d8f8e53d95eb397bca6448b4951b59658eb689d03025d6a4d4eafed1b787dbdd8ab3c9f30e3829cd1276ff6841a60024ed7d373a0a081e6
7
- data.tar.gz: 1c376ba076d64c82eeb5259750f403ac47864f754b8eaf6780637e4cd4c906fc0993bb51057528a5648b33ede0a3f34fcbd4f36454fd1d487b4538e937147d23
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
- return nil unless ((data[:make] && data[:model] && data[:year]) || data[:vin]) && data[:mileage] && data[:zip]
96
- if data[:vin]
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: 'Clean',
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
@@ -1,3 +1,3 @@
1
1
  module VinData
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
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.10
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: 2015-07-27 00:00:00.000000000 Z
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.2.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.