smartcar 1.0.5 → 1.0.7

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: 726e54a0eb8a7ebe98749b6765e8bf6302c4faccc42695d9d75fd3dd3cb5b544
4
- data.tar.gz: d5ff12b61c36f1f151a3eb161ef8134fe55c6d0bf98cb71d0de8c4138dac4045
3
+ metadata.gz: 20f8c410ca2e09b81f481f66f8790b9040688dec92973825d7a7ba72cec14a7d
4
+ data.tar.gz: 5c748df1b3c987a00df29e1f7f65ae8c89c76ad7473acfc8135c27ddad94fe15
5
5
  SHA512:
6
- metadata.gz: dd45d1487f7ee1247831d5af2eae9bba2dcf1de43ee4f748243b03bce7a09721de3ce3e4a3a79946bbcaa4bdcc19a92036978a052666a279b3f40447d1dffd4a
7
- data.tar.gz: 4c44d4439be32d51be9b1bbc8bb0a27b1a8dfdfb00aff6ebcdfba945e05d4f0d62406dacc370f8560ca0d80474de7900bce001a9fafa822c76d139301c5dc59d
6
+ metadata.gz: 4bdbd39d8887437f76f53ccea2cdc8f6ae618d5a13558713c44b74ca21ab01fbe960b8d8b66104ace8df1a4c3de2d8a2308e3fe6ec000c9a80b721abda0fca09
7
+ data.tar.gz: 71f27cea632e1578e878f9bb6c7caa921890236515facc7435f6b17aa2faa1c198c8e7bfd4064fd90ec37ee2533d31aae362b1f0c13ce867b43380d3add3fcbc
@@ -21,6 +21,7 @@ deploy:
21
21
  provider: rubygems
22
22
  api_key: $RUBYGEMSAPI_KEY
23
23
  gem: smartcar
24
+ gemspec: ruby-sdk.gemspec
24
25
  on:
25
26
  tags: true
26
27
  branch: master
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smartcar (1.0.5)
4
+ smartcar (1.0.7)
5
5
  oauth2 (~> 1.4)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -107,10 +107,10 @@ Smartcar::ExternalServiceError (API error - {"error":"vehicle_state_error","mess
107
107
  Example Usage for oAuth -
108
108
  ```ruby
109
109
  # To get the redirect URL :
110
- 2.5.5 :002 > options = {test_mode: true,scope: ["read_battery","read_charge","read_fuel","read_location","control_security","read_odometer","read_tires","read_vin","read_vehicle_info"]}
110
+ 2.5.5 :002 > options = {test_mode: true,scope: ["read_battery","read_charge","read_fuel","read_location","control_security","read_odometer","read_tires","read_vin","read_vehicle_info"],flags: ["country:DE"]}
111
111
  2.5.5 :003 > require 'smartcar'
112
112
  2.5.5 :004 > url = Smartcar::Oauth.authorization_url(options)
113
- => "https://connect.smartcar.com/oauth/authorize?approval_prompt=auto&client_id=2715c6b2-eba8-4fda-85b1-8d849733a344&mode=test&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fcallback&response_type=code&scope=read_battery+read_charge+read_fuel+read_location+control_security+read_odometer+read_tires+read_vin+read_vehicle_info"
113
+ => "https://connect.smartcar.com/oauth/authorize?approval_prompt=auto&client_id=2715c6b2-eba8-4fda-85b1-8d849733a344&mode=test&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fcallback&response_type=code&scope=read_battery+read_charge+read_fuel+read_location+control_security+read_odometer+read_tires+read_vin+read_vehicle_info&flags=country%3ADE"
114
114
  # Redirect user to the above URL.
115
115
  # After authentication user control reaches the callback URL with code.
116
116
  # Use the code from the parameters and request a token
@@ -123,7 +123,7 @@ Example Usage for oAuth -
123
123
 
124
124
  ## Development
125
125
 
126
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and create a git tag for the version, push git commits and tags. When merging to master if it finds the tag it will deploy to rubygems automatically
126
+ To install this gem onto your local machine, run `bundle exec rake install`.
127
127
 
128
128
  To run tests, make sure you have the env variables setup for client id and secret.
129
129
  ```shell
@@ -135,6 +135,21 @@ Tests can be run using either default rake command OR specific rspec command.
135
135
  ```ruby
136
136
  bundle exec rake spec
137
137
  ```
138
+
139
+ Releasing to rubygems right now cannot be automated because of MFA ([source](https://github.com/rubygems/rubygems/issues/3092)). For now the process is to run the gem build and push commands locally and manually enter in the Rubygems MFA code (available on 1password). Steps for that would be :
140
+
141
+ ```
142
+ # After merging to master, checkout to master and pull code locally, then run the following
143
+ gem build
144
+ Successfully built RubyGem
145
+ Name: smartcar
146
+ Version: <version>
147
+ File: smartcar-<version>.gem
148
+ # now push the gem built by the build command. This would ask for the MFA code
149
+ gem push smartcar-<version>.gem
150
+ ```
151
+ In general it is a good advice to create a tag for every release. If not for the above mentioned MFA bug, creating a tag for a commit on master and pushing the tag would trigger travis to deploy to rubygems automatically.
152
+
138
153
  ## Contributing
139
154
 
140
155
  To contribute, please:
@@ -27,6 +27,7 @@ module Smartcar
27
27
  # @option options[:scope] [Array of Strings] - array of scopes that specify what the user can access
28
28
  # EXAMPLE : ['read_odometer', 'read_vehicle_info', 'required:read_location']
29
29
  # For further details refer to https://smartcar.com/docs/guides/scope/
30
+ # @option options[:flags] [Array of Strings] - an optional array of early access features to enable.
30
31
  #
31
32
  # @return [Smartcar::Oauth] Returns a Smartcar::Oauth Object that has other methods
32
33
  def initialize(options)
@@ -40,9 +41,12 @@ module Smartcar
40
41
  mode: options[:test_mode] ? TEST : LIVE,
41
42
  response_type: CODE
42
43
  }
43
- @auth_parameters[:scope] = options[:scope].join(' ') if options[:scope]
44
+
45
+ %I(scope flags).each do |parameter|
46
+ @auth_parameters[parameter] = options[parameter].join(' ') unless options[parameter].nil?
47
+ end
44
48
  %I(state make).each do |parameter|
45
- parameters[:parameter] = options[:parameter] unless options[:parameter].nil?
49
+ @auth_parameters[parameter] = options[parameter] unless options[parameter].nil?
46
50
  end
47
51
  end
48
52
 
@@ -47,16 +47,20 @@ module Smartcar
47
47
  # API - https://smartcar.com/docs/api#connect-compatibility
48
48
  # @param vin [String] VIN of the vehicle to be checked
49
49
  # @param scope [Array of Strings] - array of scopes
50
+ # @param country [String] An optional country code according to
51
+ # [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
52
+ # Defaults to US.
50
53
  #
51
54
  # @return [Boolean] true or false
52
- def self.compatible?(vin:, scope:)
55
+ def self.compatible?(vin:, scope:, country: 'US')
53
56
  raise InvalidParameterValue.new, "vin is a required field" if vin.nil?
54
57
  raise InvalidParameterValue.new, "scope is a required field" if scope.nil?
55
58
 
56
59
  response, meta = new(token: 'none', id: 'none').fetch(path: COMPATIBLITY_PATH,
57
60
  options: {
58
61
  vin: vin,
59
- scope: scope.join(' ')
62
+ scope: scope.join(' '),
63
+ country: country
60
64
  },
61
65
  auth: BASIC
62
66
  )
@@ -1,4 +1,4 @@
1
1
  module Smartcar
2
2
  # Gem current version number
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.7"
4
4
  end
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: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Subramanian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-24 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  requirements: []
176
- rubygems_version: 3.1.2
176
+ rubygems_version: 3.0.8
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Ruby Gem to access smartcar APIs (https://smartcar.com/docs/)