smartcar 3.6.0 → 3.8.0

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
  SHA256:
3
- metadata.gz: 8b73275a395285b7814ea6a00e15ba722b34c04e93f04f911558243cd906fb85
4
- data.tar.gz: 46a585c74ab00a8c61fb3493a1f4cff476cbbbcae525be27124c5fdffb5be64b
3
+ metadata.gz: fd4fcc86e7eb35c94b63f0546a0cac9795b8c9413e91da0631ddc04658e8d928
4
+ data.tar.gz: 414d4999f1919ef259a9eaee0733e4e23bf60f29a53d667684c41142c88f3f91
5
5
  SHA512:
6
- metadata.gz: 448a25c995db755a1b5d198d4843bb46da8c58512c8c42d83e9efcd81c68b8e57e8586fc0eba401936da85b64392aa95f8f05f3d9b1d80843764cae42ee6cd04
7
- data.tar.gz: 4a3aa2472759eec45741c9d842cb336fccb5e1b4fc98859400aba6f526ac6a89c8ae0f1aedb9f87486e18e15e34c80a15855361aa1f909d9d83bebb21bc7ada6
6
+ metadata.gz: 94512a886faac4382679adb6c6dc23464095e749907caab77c30914993cb12b084e1ea2377df9767b7bc855a14691204afb517764afa95242c4bd27575ef1695
7
+ data.tar.gz: 4f1649632ff635bf6d6a806761b33c9fbd180f572ee31b30a5584971c3a3bcbe9407b3778a3d3acbcf9d22ff7ca3fd7aedad95975735ae3877bcb52f044613ee
data/.rubocop.yml CHANGED
@@ -3,6 +3,14 @@ AllCops:
3
3
  NewCops: enable
4
4
  SuggestExtensions: false
5
5
 
6
+ # Disabling for now. Will when updating to 3.1 and 3.2
7
+ Gemspec/DevelopmentDependencies:
8
+ Enabled: false
9
+
10
+ # Disabling for now. Will when updating to 3.1 and 3.2
11
+ Gemspec/RequiredRubyVersion:
12
+ Enabled: false
13
+
6
14
  # Disabling ABC size for now as refactoring few places seems pointless for now
7
15
  Metrics/AbcSize:
8
16
  Enabled: false
data/.travis.yml CHANGED
@@ -6,11 +6,10 @@ services:
6
6
  addons:
7
7
  firefox: latest
8
8
  rvm:
9
- - 2.6
10
9
  - 2.7
11
10
  - 3.0
12
11
  before_install:
13
- - gem install bundler -v 2.1.2
12
+ - gem install bundler -v 2.3.1
14
13
  - wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
15
14
  - mkdir geckodriver
16
15
  - tar -xzf geckodriver-v0.26.0-linux64.tar.gz -C geckodriver
@@ -25,5 +24,5 @@ deploy:
25
24
  on:
26
25
  tags: true
27
26
  branch: master
28
- rvm: 2.6
27
+ rvm: 2.7
29
28
  skip_cleanup: 'true'
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smartcar (3.6.0)
4
+ smartcar (3.8.0)
5
5
  oauth2 (~> 1.4)
6
6
  recursive-open-struct (~> 1.1.3)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.0)
12
- public_suffix (>= 2.0.2, < 5.0)
11
+ addressable (2.8.5)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
- backport (1.2.0)
14
+ base64 (0.2.0)
15
15
  byebug (11.1.3)
16
16
  childprocess (4.1.0)
17
17
  codecov (0.5.2)
@@ -20,59 +20,63 @@ GEM
20
20
  rexml
21
21
  diff-lcs (1.5.0)
22
22
  docile (1.4.0)
23
- faraday (2.4.0)
24
- faraday-net_http (~> 2.0)
23
+ faraday (2.7.12)
24
+ base64
25
+ faraday-net_http (>= 2.0, < 3.1)
25
26
  ruby2_keywords (>= 0.0.4)
26
- faraday-net_http (2.1.0)
27
+ faraday-net_http (3.0.2)
27
28
  hashdiff (1.0.1)
28
- jwt (2.4.1)
29
+ json (2.7.1)
30
+ jwt (2.7.1)
31
+ language_server-protocol (3.17.0.3)
29
32
  multi_json (1.15.0)
30
33
  multi_xml (0.6.0)
31
- oauth2 (1.4.10)
34
+ oauth2 (1.4.11)
32
35
  faraday (>= 0.17.3, < 3.0)
33
36
  jwt (>= 1.0, < 3.0)
34
37
  multi_json (~> 1.3)
35
38
  multi_xml (~> 0.5)
36
- rack (>= 1.2, < 3)
37
- parallel (1.21.0)
38
- parser (3.1.0.0)
39
+ rack (>= 1.2, < 4)
40
+ parallel (1.23.0)
41
+ parser (3.2.2.4)
39
42
  ast (~> 2.4.1)
40
- public_suffix (4.0.6)
41
- rack (2.2.3)
43
+ racc
44
+ public_suffix (5.0.4)
45
+ racc (1.7.3)
46
+ rack (3.0.8)
42
47
  rainbow (3.1.1)
43
48
  rake (12.3.3)
44
- readapt (1.4.3)
45
- backport (~> 1.2)
46
- thor (~> 1.0)
47
49
  recursive-open-struct (1.1.3)
48
50
  redcarpet (3.5.1)
49
- regexp_parser (2.2.0)
50
- rexml (3.2.5)
51
- rspec (3.10.0)
52
- rspec-core (~> 3.10.0)
53
- rspec-expectations (~> 3.10.0)
54
- rspec-mocks (~> 3.10.0)
55
- rspec-core (3.10.1)
56
- rspec-support (~> 3.10.0)
57
- rspec-expectations (3.10.1)
51
+ regexp_parser (2.8.3)
52
+ rexml (3.2.6)
53
+ rspec (3.12.0)
54
+ rspec-core (~> 3.12.0)
55
+ rspec-expectations (~> 3.12.0)
56
+ rspec-mocks (~> 3.12.0)
57
+ rspec-core (3.12.2)
58
+ rspec-support (~> 3.12.0)
59
+ rspec-expectations (3.12.3)
58
60
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.10.0)
60
- rspec-mocks (3.10.2)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-mocks (3.12.6)
61
63
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.10.0)
63
- rspec-support (3.10.3)
64
- rubocop (1.24.1)
64
+ rspec-support (~> 3.12.0)
65
+ rspec-support (3.12.1)
66
+ rubocop (1.58.0)
67
+ json (~> 2.3)
68
+ language_server-protocol (>= 3.17.0)
65
69
  parallel (~> 1.10)
66
- parser (>= 3.0.0.0)
70
+ parser (>= 3.2.2.4)
67
71
  rainbow (>= 2.2.2, < 4.0)
68
72
  regexp_parser (>= 1.8, < 3.0)
69
- rexml
70
- rubocop-ast (>= 1.15.1, < 2.0)
73
+ rexml (>= 3.2.5, < 4.0)
74
+ rubocop-ast (>= 1.30.0, < 2.0)
71
75
  ruby-progressbar (~> 1.7)
72
- unicode-display_width (>= 1.4.0, < 3.0)
73
- rubocop-ast (1.15.1)
74
- parser (>= 3.0.1.1)
75
- ruby-progressbar (1.11.0)
76
+ unicode-display_width (>= 2.4.0, < 3.0)
77
+ rubocop-ast (1.30.0)
78
+ parser (>= 3.2.1.0)
79
+ ruby-progressbar (1.13.0)
76
80
  ruby2_keywords (0.0.5)
77
81
  rubyzip (2.3.2)
78
82
  selenium-webdriver (4.1.0)
@@ -84,10 +88,9 @@ GEM
84
88
  simplecov-html (~> 0.11)
85
89
  simplecov_json_formatter (~> 0.1)
86
90
  simplecov-html (0.12.3)
87
- simplecov_json_formatter (0.1.3)
88
- thor (1.2.1)
89
- unicode-display_width (2.1.0)
90
- webmock (3.14.0)
91
+ simplecov_json_formatter (0.1.4)
92
+ unicode-display_width (2.5.0)
93
+ webmock (3.19.1)
91
94
  addressable (>= 2.8.0)
92
95
  crack (>= 0.3.2)
93
96
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -101,7 +104,6 @@ DEPENDENCIES
101
104
  byebug (~> 11.0)
102
105
  codecov (~> 0.5.2)
103
106
  rake (~> 12.3, >= 12.3.3)
104
- readapt (~> 1.3)
105
107
  redcarpet (~> 3.5.0)
106
108
  rspec (~> 3.0)
107
109
  rubocop (~> 1.12)
@@ -22,7 +22,7 @@ module Smartcar
22
22
  config_name = "E2E_#{config_name}" if ENV['MODE'] == 'test'
23
23
  raise Smartcar::ConfigNotFound, "Environment variable #{config_name} not found !" unless ENV[config_name]
24
24
 
25
- ENV[config_name]
25
+ ENV.fetch(config_name, nil)
26
26
  end
27
27
 
28
28
  # Converts a hash to RecursiveOpenStruct (a powered up OpenStruct object).
@@ -59,7 +59,9 @@ module Smartcar
59
59
 
60
60
  def build_aliases(response, aliases)
61
61
  (aliases || []).each do |original_name, alias_name|
62
+ # rubocop:disable Lint/SymbolConversion
62
63
  response.send("#{alias_name}=".to_sym, response.send(original_name.to_sym))
64
+ # rubocop:enable Lint/SymbolConversion
63
65
  end
64
66
 
65
67
  response
@@ -125,6 +127,8 @@ module Smartcar
125
127
  # Adding this because else it would become tires_pressure
126
128
  return :tire_pressure if path == '/tires/pressure'
127
129
 
130
+ return :lock_status if path == '/security'
131
+
128
132
  path.split('/').reject(&:empty?).join('_').to_sym
129
133
  end
130
134
 
@@ -54,6 +54,13 @@ module Smartcar
54
54
  vin: { path: proc { |id| "/vehicles/#{id}/vin" } },
55
55
  get_charge_limit: { path: proc { |id| "/vehicles/#{id}/charge/limit" } },
56
56
  disconnect!: { type: :delete, path: proc { |id| "/vehicles/#{id}/application" } },
57
+ lock_status: {
58
+ path: proc { |id| "/vehicles/#{id}/security" },
59
+ aliases: {
60
+ 'isLocked' => 'is_locked',
61
+ 'chargingPort' => 'charging_port'
62
+ }
63
+ },
57
64
  lock!: { type: :post, path: proc { |id| "/vehicles/#{id}/security" }, body: { action: 'LOCK' } },
58
65
  unlock!: { type: :post, path: proc { |id| "/vehicles/#{id}/security" }, body: { action: 'UNLOCK' } },
59
66
  start_charge!: { type: :post, path: proc { |id| "/vehicles/#{id}/charge" }, body: { action: 'START' } },
@@ -64,6 +71,12 @@ module Smartcar
64
71
  body: proc { |limit| { limit: limit } },
65
72
  skip: true
66
73
  },
74
+ send_destination!: {
75
+ type: :post,
76
+ path: proc { |id| "/vehicles/#{id}/navigation/destination" },
77
+ body: proc { |latitude, longitude| { latitude: latitude, longitude: longitude } },
78
+ skip: true
79
+ },
67
80
  subscribe!: {
68
81
  type: :post,
69
82
  path: proc { |id, webhook_id| "/vehicles/#{id}/webhooks/#{webhook_id}" },
@@ -172,6 +185,17 @@ module Smartcar
172
185
  # @return [OpenStruct] And object representing the JSON response mentioned in https://smartcar.com/docs/api#get-vin
173
186
  # and a meta attribute with the relevant items from response headers.
174
187
 
188
+ # @!method lock_status()
189
+ # Returns the lock status for a vehicle and the open status of its doors, windows, storage units,
190
+ # sunroof and charging port where available. The open status array(s) will be empty if a vehicle
191
+ # has partial support. The request will error if lock status can not be retrieved from the vehicle or
192
+ # the brand is not supported.
193
+ #
194
+ # API Documentation https://smartcar.com/docs/api#get-security
195
+ #
196
+ # @return [OpenStruct] And object representing the JSON response mentioned in https://smartcar.com/docs/api#get-security
197
+ # and a meta attribute with the relevant items from response headers.
198
+
175
199
  # NOTES :
176
200
  # - We only generate the methods where there is no query string or additional options considering thats
177
201
  # the majority, for all the ones that require parameters, write them separately.
@@ -248,6 +272,20 @@ module Smartcar
248
272
  build_response(response, headers)
249
273
  end
250
274
 
275
+ # Send coordinates to the vehicle's navigation system
276
+ #
277
+ # @param latitude [float] value representing the destination's latitude
278
+ # @param longitude [float] value representing the destination's longitude
279
+
280
+ # @return [OpenStruct] Meta attribute with the relevant items from response headers
281
+ def send_destination!(latitude, longitude)
282
+ method_config = METHODS[:send_destination!]
283
+
284
+ response, headers = post(method_config[:path].call(id), @query_params,
285
+ method_config[:body].call(latitude, longitude))
286
+ build_response(response, headers)
287
+ end
288
+
251
289
  # Method to get batch requests.
252
290
  # API - https://smartcar.com/docs/api#post-batch-request
253
291
  # @param paths [Array] Array of paths as strings. Ex ['/battery', '/odometer']
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Smartcar
4
4
  # Gem current version number
5
- VERSION = '3.6.0'
5
+ VERSION = '3.8.0'
6
6
  end
data/ruby-sdk.gemspec CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'byebug', '~> 11.0'
31
31
  spec.add_development_dependency 'codecov', '~> 0.5.2'
32
32
  spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
33
- spec.add_development_dependency 'readapt', '~> 1.3'
34
33
  spec.add_development_dependency 'redcarpet', '~> 3.5.0'
35
34
  spec.add_development_dependency 'rspec', '~> 3.0'
36
35
  spec.add_development_dependency 'rubocop', '~> 1.12'
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.6.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Subramanian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-23 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,20 +72,6 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 12.3.3
75
- - !ruby/object:Gem::Dependency
76
- name: readapt
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1.3'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '1.3'
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: redcarpet
91
77
  requirement: !ruby/object:Gem::Requirement