Skip to content

Commit

Permalink
fix: make aliases access defensive (#42)
Browse files Browse the repository at this point in the history
* fix: make aliases access defensive

* chore: update version
  • Loading branch information
s-ashwinkumar authored Oct 27, 2021
1 parent 7f93522 commit 39a6a6b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
smartcar (3.0.3)
smartcar (3.0.4)
oauth2 (~> 1.4)
recursive-open-struct (~> 1.1.3)

Expand All @@ -20,14 +20,15 @@ GEM
rexml
diff-lcs (1.4.4)
docile (1.4.0)
faraday (1.5.1)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
Expand All @@ -37,8 +38,9 @@ GEM
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
hashdiff (1.0.1)
jwt (2.2.3)
jwt (2.3.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
Expand Down Expand Up @@ -87,7 +89,7 @@ GEM
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4)
ruby2_keywords (0.0.5)
rubyzip (2.3.0)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/smartcar/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process_batch_response(response_body, response_headers)
response_object = OpenStruct.new
response_body['responses'].each do |item|
attribute_name = convert_path_to_attribute(item['path'])
aliases = Vehicle::METHODS[attribute_name.to_sym][:aliases]
aliases = (Vehicle::METHODS[attribute_name.to_sym] || {})[:aliases]
# merging the top level request headers and separate headers for each item of batch
headers = response_headers.merge(item['headers'] || {})
response = if [200, 204].include?(item['code'])
Expand Down
2 changes: 1 addition & 1 deletion lib/smartcar/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module Smartcar
# Gem current version number
VERSION = '3.0.3'
VERSION = '3.0.4'
end

0 comments on commit 39a6a6b

Please sign in to comment.