omniauth-fortnox-oauth2 0.0.1 → 0.0.2

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: a4022f4d3f910ee1f59a350edebc056f1dd60b93c91895b93ce703757b163f57
4
- data.tar.gz: 186a3c2d187f38b97509e8b4594640104d8c70435b5e48aff812b433ae69b49f
3
+ metadata.gz: cc88bbc3ec3e4e3c3cb8295286105d6c26e8eea0da74697763ade9262710c12c
4
+ data.tar.gz: 286a50a0942c9a610e50b004df391fe20992c45147dda0e556553581400c136c
5
5
  SHA512:
6
- metadata.gz: 329f0f93ccb9daedc67ff40083b336dd3b9ca973256391805dec85693aee894b9c44338f52e98f4e5264a265597b8332939f9b135cea77630b592eb800bd9130
7
- data.tar.gz: 8e77814e839af30c89b41823255372ea40d0a5a97dc5bafca6b955b270d50dac5fed587f687458b4869424fa1946fb0846695628d35574e5ca30dd48619cf79b
6
+ metadata.gz: 79ebcfb3f9663767d1638327bd5bc8bc0eb3267a6369254a1da7af69da3c935f65c92bed435b2df1a6e198ec5a0a4c1c70153565133489cac58f9819162b1277
7
+ data.tar.gz: 91e433a2cdf9f18fa255131f832b01a0d8073d5b0cfb494dade05d8e66b4d7a07207e8555ade8962e4ebb61e1862f143ecf2782e816f41287110f3a531c0c97c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-fortnox-oauth2 (0.0.1)
4
+ omniauth-fortnox-oauth2 (0.0.2)
5
5
  omniauth-oauth2
6
6
 
7
7
  GEM
@@ -14,45 +14,29 @@ GEM
14
14
  crack (0.4.5)
15
15
  rexml
16
16
  diff-lcs (1.4.4)
17
- faraday (1.8.0)
18
- faraday-em_http (~> 1.0)
19
- faraday-em_synchrony (~> 1.0)
20
- faraday-excon (~> 1.1)
21
- faraday-httpclient (~> 1.0.1)
22
- faraday-net_http (~> 1.0)
23
- faraday-net_http_persistent (~> 1.1)
24
- faraday-patron (~> 1.0)
25
- faraday-rack (~> 1.0)
26
- multipart-post (>= 1.2, < 3)
17
+ faraday (2.7.2)
18
+ faraday-net_http (>= 2.0, < 3.1)
27
19
  ruby2_keywords (>= 0.0.4)
28
- faraday-em_http (1.0.0)
29
- faraday-em_synchrony (1.0.0)
30
- faraday-excon (1.1.0)
31
- faraday-httpclient (1.0.1)
32
- faraday-net_http (1.0.1)
33
- faraday-net_http_persistent (1.2.0)
34
- faraday-patron (1.0.0)
35
- faraday-rack (1.0.0)
20
+ faraday-net_http (3.0.2)
36
21
  hashdiff (1.0.1)
37
- hashie (4.1.0)
38
- jwt (2.2.3)
22
+ hashie (5.0.0)
23
+ jwt (2.6.0)
39
24
  method_source (1.0.0)
40
- multi_json (1.15.0)
41
25
  multi_xml (0.6.0)
42
- multipart-post (2.1.1)
43
- oauth2 (1.4.7)
44
- faraday (>= 0.8, < 2.0)
26
+ oauth2 (2.0.9)
27
+ faraday (>= 0.17.3, < 3.0)
45
28
  jwt (>= 1.0, < 3.0)
46
- multi_json (~> 1.3)
47
29
  multi_xml (~> 0.5)
48
- rack (>= 1.2, < 3)
49
- omniauth (2.0.4)
30
+ rack (>= 1.2, < 4)
31
+ snaky_hash (~> 2.0)
32
+ version_gem (~> 1.1)
33
+ omniauth (2.1.0)
50
34
  hashie (>= 3.4.6)
51
- rack (>= 1.6.2, < 3)
35
+ rack (>= 2.2.3)
52
36
  rack-protection
53
- omniauth-oauth2 (1.7.1)
54
- oauth2 (~> 1.4)
55
- omniauth (>= 1.9, < 3)
37
+ omniauth-oauth2 (1.8.0)
38
+ oauth2 (>= 1.4, < 3)
39
+ omniauth (~> 2.0)
56
40
  pry (0.13.1)
57
41
  coderay (~> 1.1)
58
42
  method_source (~> 1.0)
@@ -60,8 +44,8 @@ GEM
60
44
  byebug (~> 11.0)
61
45
  pry (~> 0.13.0)
62
46
  public_suffix (4.0.6)
63
- rack (2.2.3)
64
- rack-protection (2.1.0)
47
+ rack (3.0.3)
48
+ rack-protection (3.0.5)
65
49
  rack
66
50
  rake (13.0.6)
67
51
  rexml (3.2.5)
@@ -79,12 +63,17 @@ GEM
79
63
  rspec-support (~> 3.10.0)
80
64
  rspec-support (3.10.2)
81
65
  ruby2_keywords (0.0.5)
66
+ snaky_hash (2.0.1)
67
+ hashie
68
+ version_gem (~> 1.1, >= 1.1.1)
69
+ version_gem (1.1.1)
82
70
  webmock (3.14.0)
83
71
  addressable (>= 2.8.0)
84
72
  crack (>= 0.3.2)
85
73
  hashdiff (>= 0.4.0, < 2.0.0)
86
74
 
87
75
  PLATFORMS
76
+ arm64-darwin-21
88
77
  x86_64-darwin-19
89
78
 
90
79
  DEPENDENCIES
data/README.md CHANGED
@@ -46,6 +46,10 @@ Can also be set up with dynamic configuration:
46
46
  end)
47
47
  ```
48
48
 
49
+ Service account in Fortnox can be configured with the optional parameter `account_type`.
50
+ ```ruby
51
+ account_type: 'service'
52
+ ```
49
53
 
50
54
  You can now access the OmniAuth Fortnox OAuth2 URL: /auth/fortnox_oauth2
51
55
  Later a controller can be set up to handle the response after authentication, for example:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module FortnoxOAuth2
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
7
7
  end
@@ -18,7 +18,7 @@ module OmniAuth
18
18
  token_method: :post
19
19
  }
20
20
 
21
- option :authorize_options, %i[scope state]
21
+ option :authorize_options, %i[scope state account_type]
22
22
  option :provider_ignores_state, false
23
23
 
24
24
  uid { raw_info['CompanyInformation']['OrganizationNumber'] }
@@ -57,7 +57,7 @@ module OmniAuth
57
57
  client_id: options['client_id'],
58
58
  response_type: 'code',
59
59
  scope: (options['scope'] || DEFAULT_SCOPE)
60
- }
60
+ }.merge( options['account_type'] ? { account_type: options['account_type'] } : {} )
61
61
 
62
62
  super
63
63
  end
@@ -116,6 +116,7 @@ describe OmniAuth::Strategies::FortnoxOauth2 do
116
116
  end
117
117
 
118
118
  before do
119
+ fortnox_oauth2.options.provider_ignores_state = true
119
120
  allow(fortnox_oauth2).to receive(:request) { error_request }
120
121
  end
121
122
 
@@ -288,5 +289,14 @@ describe OmniAuth::Strategies::FortnoxOauth2 do
288
289
  .to eq('companyinformation,invoice')
289
290
  end
290
291
  end
292
+
293
+ context 'when setting account_type in options' do
294
+ let(:options) { { 'account_type' => 'service' } }
295
+
296
+ it 'uses the new account_type' do
297
+ expect(fortnox_oauth2.authorize_params[:account_type])
298
+ .to eq('service')
299
+ end
300
+ end
291
301
  end
292
302
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-fortnox-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - svenne87
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.2.22
132
+ rubygems_version: 3.3.26
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: OmniAuth OAuth2 strategy for Fortnox