smartcar 3.0.1 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40fb835517be1ed88352e2988be1800570c3bc6a2cd46db81d20cd1430aa5391
4
- data.tar.gz: 23137d3489c55affd34287acc0a7301c6af04cf74ab7ec2bca0bc9476a11ee0b
3
+ metadata.gz: b8dc25bb663d8c581e0c3f93b2ba5cb4f66c0a256dc740363f4feb3ccafe90c1
4
+ data.tar.gz: c71d59a150f691b68d1ed15143195808c0477bdf51f886583878b6eba8e35a89
5
5
  SHA512:
6
- metadata.gz: 46cdf2c55fb8213943e0e5841b91aafa4e9be4d9b24d7e6121507f341fe51871892074667774f2214329f61d299899e0b18505f9fc0d6d007f229861ae5a69de
7
- data.tar.gz: bb650cc504f122c4adf1869f067316cb7470746fa19c33c7a81ad83c4371c9b417699d93e46ac2e35cd39a6bbcafb10f4f06cadaf06d667152c9118fff226153
6
+ metadata.gz: 70c6cc755ca8b163eb46a4ed98da557315fd0213b3464556fb68156f9436f2a548cba21dc0a71ced2bda1e934d27ddcd663beab09f8361e8b04536d7a36d770f
7
+ data.tar.gz: 2dfb31c7115cc455fee5efac58705be45f2eb4c0790ee4678a23ff4b43a02acbbf4d6952ecf85ec4136a3cd7af1855030e5c0fc3edeaae1ee2c0d18afe309303
data/.rubocop.yml CHANGED
@@ -11,6 +11,12 @@ Metrics/AbcSize:
11
11
  Naming/AccessorMethodName:
12
12
  Enabled: false
13
13
 
14
+ # Disabling this until we figure out a better way than using openstruct
15
+ # Currently we use open struct because this gives us an object representing the JSON
16
+ # with accessor style methods.
17
+ Style/OpenStructUse:
18
+ Enabled: false
19
+
14
20
  Metrics/BlockLength:
15
21
  Exclude:
16
22
  - '**/*.gemspec'
@@ -21,12 +27,3 @@ Metrics/MethodLength:
21
27
  Max: 20
22
28
  Exclude:
23
29
  - 'spec/smartcar/helpers/auth_helper.rb'
24
-
25
- # Parameters in data from json API comes in as camelCase, ignoring those files to avoid snake_case enforcement
26
- Naming/MethodName:
27
- Exclude:
28
- - 'lib/smartcar/battery.rb'
29
- - 'lib/smartcar/charge.rb'
30
- - 'lib/smartcar/engine_oil.rb'
31
- - 'lib/smartcar/fuel.rb'
32
- - 'lib/smartcar/tire_pressure.rb'
data/.travis.yml CHANGED
@@ -8,6 +8,7 @@ addons:
8
8
  rvm:
9
9
  - 2.6
10
10
  - 2.7
11
+ - 3.0
11
12
  before_install:
12
13
  - gem install bundler -v 2.1.2
13
14
  - wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smartcar (3.0.1)
4
+ smartcar (3.0.5)
5
5
  oauth2 (~> 1.4)
6
6
  recursive-open-struct (~> 1.1.3)
7
7
 
@@ -11,30 +11,40 @@ GEM
11
11
  addressable (2.8.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.2)
14
- backport (1.1.2)
14
+ backport (1.2.0)
15
15
  byebug (11.1.3)
16
- childprocess (3.0.0)
16
+ childprocess (4.1.0)
17
17
  codecov (0.5.2)
18
18
  simplecov (>= 0.15, < 0.22)
19
19
  crack (0.4.5)
20
20
  rexml
21
- diff-lcs (1.4.4)
21
+ diff-lcs (1.5.0)
22
22
  docile (1.4.0)
23
- faraday (1.4.2)
23
+ faraday (1.9.3)
24
24
  faraday-em_http (~> 1.0)
25
25
  faraday-em_synchrony (~> 1.0)
26
26
  faraday-excon (~> 1.1)
27
+ faraday-httpclient (~> 1.0)
28
+ faraday-multipart (~> 1.0)
27
29
  faraday-net_http (~> 1.0)
28
- faraday-net_http_persistent (~> 1.1)
29
- multipart-post (>= 1.2, < 3)
30
+ faraday-net_http_persistent (~> 1.0)
31
+ faraday-patron (~> 1.0)
32
+ faraday-rack (~> 1.0)
33
+ faraday-retry (~> 1.0)
30
34
  ruby2_keywords (>= 0.0.4)
31
35
  faraday-em_http (1.0.0)
32
36
  faraday-em_synchrony (1.0.0)
33
37
  faraday-excon (1.1.0)
38
+ faraday-httpclient (1.0.1)
39
+ faraday-multipart (1.0.3)
40
+ multipart-post (>= 1.2, < 3)
34
41
  faraday-net_http (1.0.1)
35
- faraday-net_http_persistent (1.1.0)
42
+ faraday-net_http_persistent (1.2.0)
43
+ faraday-patron (1.0.0)
44
+ faraday-rack (1.0.0)
45
+ faraday-retry (1.0.3)
36
46
  hashdiff (1.0.1)
37
- jwt (2.2.3)
47
+ jwt (2.3.0)
38
48
  multi_json (1.15.0)
39
49
  multi_xml (0.6.0)
40
50
  multipart-post (2.1.1)
@@ -44,19 +54,19 @@ GEM
44
54
  multi_json (~> 1.3)
45
55
  multi_xml (~> 0.5)
46
56
  rack (>= 1.2, < 3)
47
- parallel (1.20.1)
48
- parser (3.0.1.1)
57
+ parallel (1.21.0)
58
+ parser (3.1.0.0)
49
59
  ast (~> 2.4.1)
50
60
  public_suffix (4.0.6)
51
61
  rack (2.2.3)
52
- rainbow (3.0.0)
62
+ rainbow (3.1.1)
53
63
  rake (12.3.3)
54
- readapt (1.3.0)
55
- backport (~> 1.1)
64
+ readapt (1.4.3)
65
+ backport (~> 1.2)
56
66
  thor (~> 1.0)
57
67
  recursive-open-struct (1.1.3)
58
68
  redcarpet (3.5.1)
59
- regexp_parser (2.1.1)
69
+ regexp_parser (2.2.0)
60
70
  rexml (3.2.5)
61
71
  rspec (3.10.0)
62
72
  rspec-core (~> 3.10.0)
@@ -70,23 +80,24 @@ GEM
70
80
  rspec-mocks (3.10.2)
71
81
  diff-lcs (>= 1.2.0, < 2.0)
72
82
  rspec-support (~> 3.10.0)
73
- rspec-support (3.10.2)
74
- rubocop (1.16.1)
83
+ rspec-support (3.10.3)
84
+ rubocop (1.24.1)
75
85
  parallel (~> 1.10)
76
86
  parser (>= 3.0.0.0)
77
87
  rainbow (>= 2.2.2, < 4.0)
78
88
  regexp_parser (>= 1.8, < 3.0)
79
89
  rexml
80
- rubocop-ast (>= 1.7.0, < 2.0)
90
+ rubocop-ast (>= 1.15.1, < 2.0)
81
91
  ruby-progressbar (~> 1.7)
82
92
  unicode-display_width (>= 1.4.0, < 3.0)
83
- rubocop-ast (1.7.0)
93
+ rubocop-ast (1.15.1)
84
94
  parser (>= 3.0.1.1)
85
95
  ruby-progressbar (1.11.0)
86
- ruby2_keywords (0.0.4)
87
- rubyzip (2.3.0)
88
- selenium-webdriver (3.142.7)
89
- childprocess (>= 0.5, < 4.0)
96
+ ruby2_keywords (0.0.5)
97
+ rubyzip (2.3.2)
98
+ selenium-webdriver (4.1.0)
99
+ childprocess (>= 0.5, < 5.0)
100
+ rexml (~> 3.2, >= 3.2.5)
90
101
  rubyzip (>= 1.2.2)
91
102
  simplecov (0.21.2)
92
103
  docile (~> 1.1)
@@ -94,15 +105,16 @@ GEM
94
105
  simplecov_json_formatter (~> 0.1)
95
106
  simplecov-html (0.12.3)
96
107
  simplecov_json_formatter (0.1.3)
97
- thor (1.1.0)
98
- unicode-display_width (2.0.0)
99
- webmock (3.13.0)
100
- addressable (>= 2.3.6)
108
+ thor (1.2.1)
109
+ unicode-display_width (2.1.0)
110
+ webmock (3.14.0)
111
+ addressable (>= 2.8.0)
101
112
  crack (>= 0.3.2)
102
113
  hashdiff (>= 0.4.0, < 2.0.0)
103
114
 
104
115
  PLATFORMS
105
116
  ruby
117
+ x86_64-linux
106
118
 
107
119
  DEPENDENCIES
108
120
  bundler (~> 2.0)
@@ -113,9 +125,9 @@ DEPENDENCIES
113
125
  redcarpet (~> 3.5.0)
114
126
  rspec (~> 3.0)
115
127
  rubocop (~> 1.12)
116
- selenium-webdriver (~> 3.142)
128
+ selenium-webdriver (~> 4.1.0)
117
129
  smartcar!
118
130
  webmock (~> 3.13)
119
131
 
120
132
  BUNDLED WITH
121
- 2.1.4
133
+ 2.3.1
@@ -34,7 +34,7 @@ module Smartcar
34
34
  #
35
35
  # @return [RecursiveOpenStruct]
36
36
  def json_to_ostruct(hash)
37
- RecursiveOpenStruct.new(hash)
37
+ RecursiveOpenStruct.new(hash, recurse_over_arrays: true)
38
38
  end
39
39
 
40
40
  def build_meta(headers)
@@ -100,9 +100,9 @@ module Smartcar
100
100
  response_object = OpenStruct.new
101
101
  response_body['responses'].each do |item|
102
102
  attribute_name = convert_path_to_attribute(item['path'])
103
- aliases = Vehicle::METHODS[attribute_name.to_sym][:aliases]
103
+ aliases = (Vehicle::METHODS[attribute_name.to_sym] || {})[:aliases]
104
104
  # merging the top level request headers and separate headers for each item of batch
105
- headers = response_headers.merge(item['headers'])
105
+ headers = response_headers.merge(item['headers'] || {})
106
106
  response = if [200, 204].include?(item['code'])
107
107
  build_aliases(build_response(item['body'], headers), aliases)
108
108
  else
@@ -122,6 +122,9 @@ module Smartcar
122
122
  def convert_path_to_attribute(path)
123
123
  return :attributes if path == '/'
124
124
 
125
+ # Adding this because else it would become tires_pressure
126
+ return :tire_pressure if path == '/tires/pressure'
127
+
125
128
  path.split('/').reject(&:empty?).join('_').to_sym
126
129
  end
127
130
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Smartcar
4
4
  # Gem current version number
5
- VERSION = '3.0.1'
5
+ VERSION = '3.0.5'
6
6
  end
data/lib/smartcar.rb CHANGED
@@ -85,10 +85,8 @@ module Smartcar
85
85
  base_object.token = generate_basic_auth(options, base_object)
86
86
 
87
87
  base_object.build_response(*base_object.fetch(
88
- {
89
- path: PATHS[:compatibility],
90
- query_params: build_compatibility_params(vin, scope, country, options)
91
- }
88
+ path: PATHS[:compatibility],
89
+ query_params: build_compatibility_params(vin, scope, country, options)
92
90
  ))
93
91
  end
94
92
 
@@ -106,7 +104,7 @@ module Smartcar
106
104
  version: version
107
105
  }
108
106
  )
109
- base_object.build_response(*base_object.fetch({ path: PATHS[:user] }))
107
+ base_object.build_response(*base_object.fetch(path: PATHS[:user]))
110
108
  end
111
109
 
112
110
  # Module method Returns a paged list of all vehicles connected to the application for the current authorized user.
@@ -125,10 +123,8 @@ module Smartcar
125
123
  }
126
124
  )
127
125
  base_object.build_response(*base_object.fetch(
128
- {
129
- path: PATHS[:vehicles],
130
- query_params: paging
131
- }
126
+ path: PATHS[:vehicles],
127
+ query_params: paging
132
128
  ))
133
129
  end
134
130
 
data/ruby-sdk.gemspec CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.license = 'MIT'
17
17
  spec.metadata = {
18
18
  'source_code_uri' => 'https://github.com/smartcar/ruby-sdk',
19
- 'documentation_uri' => 'https://www.rubydoc.info/gems/smartcar'
19
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/smartcar',
20
+ 'rubygems_mfa_required' => 'true'
20
21
  }
21
22
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -33,7 +34,7 @@ Gem::Specification.new do |spec|
33
34
  spec.add_development_dependency 'redcarpet', '~> 3.5.0'
34
35
  spec.add_development_dependency 'rspec', '~> 3.0'
35
36
  spec.add_development_dependency 'rubocop', '~> 1.12'
36
- spec.add_development_dependency 'selenium-webdriver', '~> 3.142'
37
+ spec.add_development_dependency 'selenium-webdriver', '~> 4.1.0'
37
38
  spec.add_development_dependency 'webmock', '~> 3.13'
38
39
  spec.add_dependency 'oauth2', '~> 1.4'
39
40
  spec.add_dependency 'recursive-open-struct', '~> 1.1.3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcar
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Subramanian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-14 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '3.142'
137
+ version: 4.1.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '3.142'
144
+ version: 4.1.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: webmock
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -219,6 +219,7 @@ licenses:
219
219
  metadata:
220
220
  source_code_uri: https://github.com/smartcar/ruby-sdk
221
221
  documentation_uri: https://www.rubydoc.info/gems/smartcar
222
+ rubygems_mfa_required: 'true'
222
223
  post_install_message:
223
224
  rdoc_options: []
224
225
  require_paths: