omniauth-parallelmarkets 0.0.1 → 0.0.2

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: 365229d63da53d3e46a7527c1a14d0f11d27d75ee21d54b8c3a69d9621689155
4
- data.tar.gz: 7e3c686ded77cb305d3af1f836c84fd46f59144508c9c253cba725f9110c4a50
3
+ metadata.gz: 74c64edc87f5ab818b9a2f2cf4aa465ae56fdb10cc8ea20a109d2f737368a060
4
+ data.tar.gz: d0bfb3bb2dff5b11ff9b5ce73ab2ecbb7e0f8a1dc0771a1b07490b798fd28f38
5
5
  SHA512:
6
- metadata.gz: 9a495f6172a763a3656a9a09b5530f1c5371c6798b46af0931876710402912f1baa37098d4a44655d0add3efd2dd9c4e98355297ab1aab0ffeb3a82d616605be
7
- data.tar.gz: 8a65b31a7c9818a83a06a952427896ac8ab71c7753012751023253ae98f49fe77874161e3c5efe7a44debb6572396a0934adf1831c8c20fd1941a8242d0313de
6
+ metadata.gz: c0ce1f93fe106def6af237efeb358897c6619caa8af112b92088abb836f0a72533660707c7923dbe45681abc26e4cc981c74dc545bcfc5bb609d6eb00c5dc4f2
7
+ data.tar.gz: 4a51e656cd6128b705013e01d15f2452d0dddcf01699b4df76a329004313f30acb89378c771f28f6c17274c7e0bbde397566bbe71b0da38e239f1c9c883d4e9d
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,12 @@
1
+ bundler_args: --without development
2
+ before_install:
3
+ - gem update --system
4
+ - gem update bundler
5
+ cache: bundler
6
+ language: ruby
7
+ rvm:
8
+ - 2.2
9
+ - 2.3
10
+ - 2.4
11
+ - 2.5
12
+ sudo: false
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
4
+
5
+ gemspec
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.
@@ -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
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-parallelmarkets/version'
4
+ require 'omniauth/strategies/parallelmarkets'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module ParallelMarkets
5
+ VERSION = '0.0.2'
6
+ end
7
+ end
@@ -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.1
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.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.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