omniauth-parallelmarkets 0.1.1 → 0.4.1

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: 2c6b382d351a845a0e8b4edb867ca7b49fee4ea70bff43092ff4996766900478
4
- data.tar.gz: 27eb701bbeffaf81d32ed6090f73dd79b181fd393b984b80a9a51e5f477b9331
3
+ metadata.gz: 3d1a9cc04610afce884e57adc8800b29b434dfcdb07e6cb18271906e0681d34f
4
+ data.tar.gz: 7aef3c3db5c6fb704abc875b28403cd8ca645fe7778656dd91805cde9b54cb21
5
5
  SHA512:
6
- metadata.gz: ab7b0e609c87ac035242a887879d8a150039ab6e58d55fea0ceec816e3736a6d40e26679d3c239e6eb7e11b3a9040a4f2fd6f7ad110b6d4b2899e74581b6688b
7
- data.tar.gz: 2c70c949e15ad49b3e37004c4c97f34c7123e929a1fdce5b6d7e9613628e8c122d5220b52928fbcc395a3b0b1dc892c128dc3584699697b3d331c29f1739385a
6
+ metadata.gz: c1ccb2af52e3e33924183dab77dac16c345fa645564c54dd4bf67837b43a0f7d9e4bbc6d42b39bff127b44347842c341296c76369044c2a00b1a2bb705a0b00a
7
+ data.tar.gz: 46ed239d34cc0feb7e8b8ea2cde691570c5b1d77a5950ec0fdea32d46a7fbc9669ea1fea33bcb70941c0b0301df98cb0695c1d62878099530c370d93db6de445
@@ -0,0 +1,18 @@
1
+ name: Run Tests
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@master
12
+
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: '3.0.1'
16
+ bundler-cache: true
17
+
18
+ - run: bundle exec rake
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/omniauth-parallelmarkets.svg)](https://badge.fury.io/rb/omniauth-parallelmarkets)
2
- [![Build Status](https://travis-ci.org/parallel-markets/omniauth-parallelmarkets.svg?branch=master)](https://travis-ci.org/parallel-markets/omniauth-parallelmarkets)
2
+ [![Tests](https://github.com/parallel-markets/omniauth-parallelmarkets/actions/workflows/ci.yml/badge.svg)](https://github.com/parallel-markets/omniauth-parallelmarkets/actions/workflows/ci.yml)
3
3
 
4
4
  # OmniAuth ParallelMarkets
5
5
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module ParallelMarkets
5
- VERSION = '0.1.1'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
@@ -9,6 +9,7 @@ module OmniAuth
9
9
  site: 'https://api.parallelmarkets.com',
10
10
  authorize_url: '/v1/oauth/authorize',
11
11
  token_url: '/v1/oauth/token'
12
+ option :authorize_options, %i[scope force_accreditation_check force_identity_check]
12
13
 
13
14
  uid { raw_info['id'] }
14
15
 
@@ -23,8 +24,15 @@ module OmniAuth
23
24
 
24
25
  extra do
25
26
  {
26
- accreditations: raw_info['accreditations'],
27
+ accreditations: accreditations,
28
+ indicated_unaccredited: indicated_unaccredited,
27
29
  business_type: profile['business_type'],
30
+ primary_contact: profile['primary_contact'].nil? ? nil : {
31
+ name: "#{profile['primary_contact']['first_name']} #{profile['primary_contact']['last_name']}",
32
+ first_name: profile['primary_contact']['first_name'],
33
+ last_name: profile['primary_contact']['last_name'],
34
+ email: profile['primary_contact']['email']
35
+ },
28
36
  type: raw_info['type'],
29
37
  user_id: raw_info['user_id'],
30
38
  raw_info: raw_info
@@ -33,12 +41,17 @@ module OmniAuth
33
41
 
34
42
  def authorize_params
35
43
  super.tap do |params|
36
- %w[scope client_options].each do |v|
37
- params[v.to_sym] = request.params[v] if request.params[v]
44
+ options[:authorize_options].each do |k|
45
+ params[k] = request.params[k.to_s] if request.params[k.to_s]
38
46
  end
39
47
  end
40
48
  end
41
49
 
50
+ # this is dumb, but https://github.com/omniauth/omniauth-oauth2/issues/93 is still open
51
+ def callback_url
52
+ options[:redirect_uri] || (full_host + script_name + callback_path)
53
+ end
54
+
42
55
  def raw_info
43
56
  @raw_info ||= access_token.get('/v1/me').parsed
44
57
  end
@@ -46,6 +59,18 @@ module OmniAuth
46
59
  def profile
47
60
  @profile ||= raw_info.fetch('profile', {})
48
61
  end
62
+
63
+ def raw_accreditations
64
+ @raw_accreditations ||= access_token.get('/v1/accreditations').parsed
65
+ end
66
+
67
+ def indicated_unaccredited
68
+ raw_accreditations['indicated_unaccredited']
69
+ end
70
+
71
+ def accreditations
72
+ raw_accreditations['accreditations']
73
+ end
49
74
  end
50
75
  end
51
76
  end
@@ -20,5 +20,4 @@ Gem::Specification.new do |s|
20
20
  s.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
21
21
  s.add_development_dependency 'rake', '~> 12.0'
22
22
  s.add_development_dependency 'rspec', '~> 3.5'
23
- s.add_development_dependency 'rubocop'
24
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-parallelmarkets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Muller
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.5'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  description: Parallel Markets OAuth strategy for OmniAuth.
70
56
  email:
71
57
  - bamuller@gmail.com
@@ -73,10 +59,9 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
62
+ - ".github/workflows/ci.yml"
76
63
  - ".gitignore"
77
64
  - ".rspec"
78
- - ".rubocop.yml"
79
- - ".travis.yml"
80
65
  - Gemfile
81
66
  - LICENSE
82
67
  - README.md
@@ -89,7 +74,7 @@ homepage: https://github.com/parallel-markets/omniauth-parallelmarkets
89
74
  licenses:
90
75
  - MIT
91
76
  metadata: {}
92
- post_install_message:
77
+ post_install_message:
93
78
  rdoc_options: []
94
79
  require_paths:
95
80
  - lib
@@ -104,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
89
  - !ruby/object:Gem::Version
105
90
  version: '0'
106
91
  requirements: []
107
- rubygems_version: 3.0.3
108
- signing_key:
92
+ rubygems_version: 3.2.15
93
+ signing_key:
109
94
  specification_version: 4
110
95
  summary: Parallel Markets OAuth strategy for OmniAuth
111
96
  test_files: []
data/.rubocop.yml DELETED
@@ -1,11 +0,0 @@
1
- Metrics/LineLength:
2
- Enabled: false
3
-
4
- Metrics/BlockLength:
5
- Enabled: false
6
-
7
- Style/Documentation:
8
- Enabled: false
9
-
10
- Naming/FileName:
11
- Enabled: false
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- cache: bundler
2
- language: ruby
3
- rvm:
4
- - 2.3
5
- - 2.4
6
- - 2.5