nhtsa 0.2.0 → 0.2.1

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: 536615ab56a8f47955aa3bd6336e558c3b1dd9a1
4
- data.tar.gz: 41da4ed80c9d77f85b7e27f20d63d2d5f37e7b71
3
+ metadata.gz: d095f131e393f03af526c45c80de7ced30e24feb
4
+ data.tar.gz: e9d853daec69f541758c63335738399beba53e70
5
5
  SHA512:
6
- metadata.gz: 7dc2a07f2e662a23de75cb6c1f0da5c709e0a912d69e1cd4756d0fa03ad185cd4eb2b480651b0eac17186f848e57e07014a7d0033975fc9eaea246950a549406
7
- data.tar.gz: dc882e39342d6341ef5e731216daa5311c2ed0809d3e2a672ac481b1aa721c86c47df4d05e66abb05aeacdf192d493dcd2d3117cc2dc7e7c212ebd0a5f7d3d3f
6
+ metadata.gz: d8f2559a97a2f8c4ede289c95519ab6423a3b57a37669c5a8663a782031b59a9d118e04c946fc74403ce8ff5557cac6cc7dc161824d3f91854bb2f24d45089f5
7
+ data.tar.gz: 1bcaa75ae5d3c93127af7535a2247d49d1e495dd69e6d28e04302f4d0a9136e55f4c0f848a7860dbcf759b32e964ca0ca411ec089e9530f2109d0f61a52e23e0
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog #
2
+
3
+ ## v0.2.1 June 11 2017 ##
4
+
5
+ ### Features ###
6
+
7
+ * Moved all calls to the nhtsa api to use https instead of http
8
+
9
+ ### Bug Fixes ###
10
+
11
+ * Safety Seat Inspection Station Locator was using a hardcoded URL, moving it to use the constants used everywhere else in the project.
12
+
13
+ ### Misc ###
14
+
15
+ * Slightly better to read string handling when building URIs, going with `#{BASE_URI}/#{END_POINT}` over `BASE_URI + END_POINT`
data/lib/nhtsa.rb CHANGED
@@ -9,6 +9,6 @@ module Nhtsa
9
9
  require 'json'
10
10
  require 'open-uri'
11
11
 
12
- BASE_URI = "http://webapi.nhtsa.gov/api"
12
+ BASE_URI = "https://webapi.nhtsa.gov/api"
13
13
  DEFAULT_PARAMS = "?format=json"
14
14
  end
@@ -8,7 +8,7 @@ module Nhtsa
8
8
  end
9
9
 
10
10
  def url
11
- "http://webapi.nhtsa.gov/api/CSSIStation?lat=#{@latitude}&long=#{@longitude}&miles=#{@radius}&format=json"
11
+ "#{BASE_URI}#{END_POINT}?lat=#{@latitude}&long=#{@longitude}&miles=#{@radius}&format=json"
12
12
  end
13
13
 
14
14
  def inspection_stations
@@ -8,13 +8,13 @@ module Nhtsa
8
8
 
9
9
  def url
10
10
  if @filters[:spanish] && @filters[:cpsweek]
11
- BASE_URI + END_POINT + "/state/#{@state_abbreviation}" + CPS_WEEK + SPANISH + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/state/#{@state_abbreviation}#{CPS_WEEK}#{SPANISH}#{DEFAULT_PARAMS}"
12
12
  elsif @filters[:spanish]
13
- BASE_URI + END_POINT + "/state/#{@state_abbreviation}" + SPANISH + DEFAULT_PARAMS
13
+ "#{BASE_URI}#{END_POINT}/state/#{@state_abbreviation}#{SPANISH}#{DEFAULT_PARAMS}"
14
14
  elsif @filters[:cpsweek]
15
- BASE_URI + END_POINT + "/state/#{@state_abbreviation}" + CPS_WEEK + DEFAULT_PARAMS
15
+ "#{BASE_URI}#{END_POINT}/state/#{@state_abbreviation}#{CPS_WEEK}#{DEFAULT_PARAMS}"
16
16
  else
17
- BASE_URI + END_POINT + "/state/#{@state_abbreviation}" + DEFAULT_PARAMS
17
+ "#{BASE_URI}#{END_POINT}/state/#{@state_abbreviation}#{DEFAULT_PARAMS}"
18
18
  end
19
19
  end
20
20
 
@@ -8,13 +8,13 @@ module Nhtsa
8
8
 
9
9
  def url
10
10
  if @filters[:spanish] && @filters[:cpsweek]
11
- BASE_URI + END_POINT + "/zip/#{@zip_code}" + CPS_WEEK + SPANISH + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/zip/#{@zip_code}#{CPS_WEEK}#{SPANISH}#{DEFAULT_PARAMS}"
12
12
  elsif @filters[:spanish]
13
- BASE_URI + END_POINT + "/zip/#{@zip_code}" + SPANISH + DEFAULT_PARAMS
13
+ "#{BASE_URI}#{END_POINT}/zip/#{@zip_code}#{SPANISH}#{DEFAULT_PARAMS}"
14
14
  elsif @filters[:cpsweek]
15
- BASE_URI + END_POINT + "/zip/#{@zip_code}" + CPS_WEEK + DEFAULT_PARAMS
15
+ "#{BASE_URI}#{END_POINT}/zip/#{@zip_code}#{CPS_WEEK}#{DEFAULT_PARAMS}"
16
16
  else
17
- BASE_URI + END_POINT + "/zip/#{@zip_code}" + DEFAULT_PARAMS
17
+ "#{BASE_URI}#{END_POINT}/zip/#{@zip_code}#{DEFAULT_PARAMS}"
18
18
  end
19
19
  end
20
20
 
@@ -2,7 +2,7 @@ module Nhtsa
2
2
  module CivilPenalties
3
3
  class CivilPenalties
4
4
  def url
5
- BASE_URI + END_POINT + DEFAULT_PARAMS
5
+ "#{BASE_URI}#{END_POINT}#{DEFAULT_PARAMS}"
6
6
  end
7
7
 
8
8
  def civil_penalties
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + "/#{@year}" + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}/#{@year}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def civil_penalties_by_year
@@ -8,7 +8,7 @@ module Nhtsa
8
8
  end
9
9
 
10
10
  def url
11
- BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}/#{@model}" + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{@manufacturer}/#{@model}#{DEFAULT_PARAMS}"
12
12
  end
13
13
 
14
14
  def complaints
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + "/odinumber/#{@odi_number}" + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}/odinumber/#{@odi_number}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def complaints_by_odi_number
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + "/#{@year}" + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}/#{@year}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def manufacturers
@@ -7,7 +7,7 @@ module Nhtsa
7
7
  end
8
8
 
9
9
  def url
10
- BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS
10
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{@manufacturer}#{DEFAULT_PARAMS}"
11
11
  end
12
12
 
13
13
  def models
@@ -2,7 +2,7 @@ module Nhtsa
2
2
  module Complaints
3
3
  class Years
4
4
  def url
5
- BASE_URI + END_POINT + DEFAULT_PARAMS
5
+ "#{BASE_URI}#{END_POINT}#{DEFAULT_PARAMS}"
6
6
  end
7
7
 
8
8
  def years
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + "/CampaignNumber/#{@campaign_number}" + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}/CampaignNumber/#{@campaign_number}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def campaign_recalls
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + "/#{@year}" + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}/#{@year}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def manufacturers
@@ -7,7 +7,7 @@ module Nhtsa
7
7
  end
8
8
 
9
9
  def url
10
- BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS
10
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{@manufacturer}#{DEFAULT_PARAMS}"
11
11
  end
12
12
 
13
13
  def models
@@ -8,7 +8,7 @@ module Nhtsa
8
8
  end
9
9
 
10
10
  def url
11
- BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}/#{@model}" + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{@manufacturer}/#{@model}#{DEFAULT_PARAMS}"
12
12
  end
13
13
 
14
14
  def recalls
@@ -3,7 +3,7 @@ module Nhtsa
3
3
  module Recalls
4
4
  class Years
5
5
  def url
6
- BASE_URI + END_POINT + DEFAULT_PARAMS
6
+ "#{BASE_URI}#{END_POINT}#{DEFAULT_PARAMS}"
7
7
  end
8
8
 
9
9
  def years
@@ -7,7 +7,7 @@ module Nhtsa
7
7
  end
8
8
 
9
9
  def url
10
- BASE_URI + END_POINT + "/#{@year}" + DEFAULT_PARAMS
10
+ "#{BASE_URI}#{END_POINT}/#{@year}#{DEFAULT_PARAMS}"
11
11
  end
12
12
 
13
13
  def manufacturers
@@ -8,7 +8,7 @@ module Nhtsa
8
8
  end
9
9
 
10
10
  def url
11
- BASE_URI + END_POINT + "/#{@year}/#{URI.encode(@manufacturer.name)}" + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{URI.encode(@manufacturer.name)}#{DEFAULT_PARAMS}"
12
12
  end
13
13
 
14
14
  def models
@@ -8,7 +8,7 @@ module Nhtsa
8
8
  end
9
9
 
10
10
  def url(vehicle_id)
11
- BASE_URI + END_POINT + "/VehicleId/#{vehicle_id}" + DEFAULT_PARAMS
11
+ "#{BASE_URI}#{END_POINT}/VehicleId/#{vehicle_id}#{DEFAULT_PARAMS}"
12
12
  end
13
13
 
14
14
  def ratings
@@ -9,7 +9,7 @@ module Nhtsa
9
9
  end
10
10
 
11
11
  def url
12
- BASE_URI + END_POINT + "/#{@year}/#{URI.encode(@manufacturer.name)}/#{URI.encode(@model.name)}" + DEFAULT_PARAMS
12
+ "#{BASE_URI}#{END_POINT}/#{@year}/#{URI.encode(@manufacturer.name)}/#{URI.encode(@model.name)}#{DEFAULT_PARAMS}"
13
13
  end
14
14
 
15
15
  def year
@@ -6,7 +6,7 @@ module Nhtsa
6
6
  end
7
7
 
8
8
  def url
9
- BASE_URI + END_POINT + DEFAULT_PARAMS
9
+ "#{BASE_URI}#{END_POINT}#{DEFAULT_PARAMS}"
10
10
  end
11
11
 
12
12
  def years
data/lib/nhtsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nhtsa
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nhtsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mwaki Harri Magotswi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-18 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ extra_rdoc_files: []
78
78
  files:
79
79
  - ".gitignore"
80
80
  - ".travis.yml"
81
+ - CHANGELOG.md
81
82
  - CODE_OF_CONDUCT.md
82
83
  - Gemfile
83
84
  - LICENSE.txt