omniauth-parallelmarkets 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 +4 -4
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.rubocop.yml +11 -0
- data/.travis.yml +12 -0
- data/Gemfile +5 -0
- data/LICENSE +20 -0
- data/README.md +25 -0
- data/Rakefile +8 -0
- data/lib/omniauth-parallelmarkets.rb +4 -0
- data/lib/omniauth-parallelmarkets/version.rb +7 -0
- data/lib/omniauth/strategies/parallelmarkets.rb +46 -0
- data/omniauth-parallelmarkets.gemspec +23 -0
- metadata +30 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c64edc87f5ab818b9a2f2cf4aa465ae56fdb10cc8ea20a109d2f737368a060
|
4
|
+
data.tar.gz: d0bfb3bb2dff5b11ff9b5ce73ab2ecbb7e0f8a1dc0771a1b07490b798fd28f38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ce1f93fe106def6af237efeb358897c6619caa8af112b92088abb836f0a72533660707c7923dbe45681abc26e4cc981c74dc545bcfc5bb609d6eb00c5dc4f2
|
7
|
+
data.tar.gz: 4a51e656cd6128b705013e01d15f2452d0dddcf01699b4df76a329004313f30acb89378c771f28f6c17274c7e0bbde397566bbe71b0da38e239f1c9c883d4e9d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2019 Parallel Markets, LLC
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# OmniAuth ParallelMarkets
|
2
|
+
|
3
|
+
This gem contains the [Parallel Markets](https://parallelmarkets.com) strategy for OmniAuth.
|
4
|
+
|
5
|
+
ParallelMarkets uses the OAuth2 flow, you can read about at [docs.parallelmarkets.com/api](https://docs.parallelmarkets.com/api/).
|
6
|
+
|
7
|
+
## How To Use It
|
8
|
+
|
9
|
+
So let's say you're using Rails, you need to add the strategy to your `Gemfile`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-parallelmarkets'
|
13
|
+
```
|
14
|
+
|
15
|
+
Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
19
|
+
provider :parallelmarkets, YOUR_CUSTOMER_KEY, YOUR_CUSTOMER_SECRET
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
You will obviously have to put in your key and secret, which you get when you register your app with Parallel Markets.
|
24
|
+
|
25
|
+
Now just follow the README at: https://github.com/intridea/omniauth
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'omniauth/strategies/oauth2'
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class ParallelMarkets < OmniAuth::Strategies::OAuth2
|
8
|
+
option :client_options,
|
9
|
+
site: 'https://api.parallelmarkets.com',
|
10
|
+
authorize_url: '/v1/oauth/authorize',
|
11
|
+
token_url: '/v1/oauth/token'
|
12
|
+
|
13
|
+
uid { raw_info['uid'] }
|
14
|
+
|
15
|
+
info do
|
16
|
+
{
|
17
|
+
name: "#{raw_info['first_name']} #{raw_info['last_name']}",
|
18
|
+
first_name: raw_info['first_name'],
|
19
|
+
last_name: raw_info['last_name'],
|
20
|
+
email: raw_info['email']
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
extra do
|
25
|
+
{
|
26
|
+
accreditations: raw_info['accreditations'],
|
27
|
+
raw_info: raw_info
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize_params
|
32
|
+
super.tap do |params|
|
33
|
+
%w[scope client_options].each do |v|
|
34
|
+
params[v.to_sym] = request.params[v] if request.params[v]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def raw_info
|
40
|
+
@raw_info ||= access_token.get('/v1/me').parsed
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
OmniAuth.config.add_camelization 'parallelmarkets', 'ParallelMarkets'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
require 'omniauth-parallelmarkets/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'omniauth-parallelmarkets'
|
8
|
+
s.version = OmniAuth::ParallelMarkets::VERSION
|
9
|
+
s.authors = ['Brian Muller']
|
10
|
+
s.email = ['bamuller@gmail.com']
|
11
|
+
|
12
|
+
s.summary = 'Parallel Markets OAuth strategy for OmniAuth'
|
13
|
+
s.description = 'Parallel Markets OAuth strategy for OmniAuth.'
|
14
|
+
s.homepage = 'https://github.com/parallel-markets/omniauth-parallelmarkets'
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('spec/') }
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
|
21
|
+
s.add_development_dependency 'rspec', '~> 3.5'
|
22
|
+
s.add_development_dependency 'rubocop'
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-parallelmarkets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Muller
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,13 +38,39 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Parallel Markets OAuth strategy for OmniAuth.
|
42
56
|
email:
|
43
57
|
- bamuller@gmail.com
|
44
58
|
executables: []
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
|
-
files:
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- lib/omniauth-parallelmarkets.rb
|
71
|
+
- lib/omniauth-parallelmarkets/version.rb
|
72
|
+
- lib/omniauth/strategies/parallelmarkets.rb
|
73
|
+
- omniauth-parallelmarkets.gemspec
|
48
74
|
homepage: https://github.com/parallel-markets/omniauth-parallelmarkets
|
49
75
|
licenses:
|
50
76
|
- MIT
|