omniauth-square-oauth2 0.0.1 → 0.1.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +33 -0
  3. data/.gitignore +56 -0
  4. data/Gemfile +3 -1
  5. data/Gemfile.lock +45 -18
  6. data/LICENSE +2 -2
  7. data/README.md +2 -2
  8. data/Rakefile +4 -3
  9. data/lib/omniauth/strategies/square.rb +22 -25
  10. data/lib/omniauth-square/version.rb +3 -1
  11. data/lib/omniauth-square-oauth2.rb +4 -0
  12. data/omniauth-square-oauth2.gemspec +17 -15
  13. data/spec/omniauth/strategies/square_spec.rb +13 -11
  14. data/spec/spec_helper.rb +4 -2
  15. data/spec/support/shared_examples.rb +6 -4
  16. metadata +31 -54
  17. data/coverage/.last_run.json +0 -5
  18. data/coverage/.resultset.json +0 -77
  19. data/coverage/.resultset.json.lock +0 -0
  20. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
  21. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  22. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
  23. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
  24. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  25. data/coverage/assets/0.12.3/application.css +0 -1
  26. data/coverage/assets/0.12.3/application.js +0 -7
  27. data/coverage/assets/0.12.3/colorbox/border.png +0 -0
  28. data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
  29. data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
  30. data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
  31. data/coverage/assets/0.12.3/favicon_green.png +0 -0
  32. data/coverage/assets/0.12.3/favicon_red.png +0 -0
  33. data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
  34. data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  35. data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  36. data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  37. data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  38. data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  39. data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  40. data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  41. data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  42. data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
  43. data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
  44. data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
  45. data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
  46. data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
  47. data/coverage/assets/0.12.3/loading.gif +0 -0
  48. data/coverage/assets/0.12.3/magnify.png +0 -0
  49. data/coverage/index.html +0 -859
  50. data/lib/omniauth-square.rb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5380daa01b62606d3164a008577c380f76e4f664707f9d3396f0ac6e5945089f
4
- data.tar.gz: 104dbab8453c357b0677644ebeff8b2586b0ccab7edb8b4ebcc280ea8e0593c2
3
+ metadata.gz: 5e3ce6302878b604dad6faa187f8c010076d71e20f3af41511da76f145475590
4
+ data.tar.gz: de9b2e8a453015ab750becdb0c8bc82adc3f1c469fc6bfaf25bbe0ab180a23cf
5
5
  SHA512:
6
- metadata.gz: e49ad25b2bf93921c1fa829424462ffa344980f248ae52dfab26a3f6941bd70044185b97fdfc66bc05d3547fdde5d84cf1b6e1c1eb1a720e3b56e8494895192b
7
- data.tar.gz: 97f64c86672e166ef2747faa051cedf5aa13bec27936e7010510c17ef2c79bbc70eba19f97cb74d54f4400018bee96eff5ecea8a4dd530e464bb8ebdbbe431f3
6
+ metadata.gz: f258bdfe36130dc3b56d87c4fd952e71a1f72ca40c3573e520e7ba6ba808e54cfee9ece431f347a99a3f4c9708bf88efe35c3cf68b5f3bf42311726cefe77545
7
+ data.tar.gz: a50c2e2d11fbeae5c8d3b553e60eb30734ff38973e12cbb1af12c618889f33091700dc00a96636ba11dc9cade30e388ac09faf38c728858c796bc6f7e45a03b7
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
+ with:
29
+ ruby-version: 2.6
30
+ - name: Install dependencies
31
+ run: bundle install
32
+ - name: Run tests
33
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in ..gemspec
4
6
  gemspec
data/Gemfile.lock CHANGED
@@ -1,44 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-square-oauth2 (1.0.0)
5
- omniauth-oauth2 (>= 1.1.1, < 1.3.0)
4
+ omniauth-square-oauth2 (0.0.2)
5
+ omniauth-oauth2 (>= 1.7.3)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  addressable (2.7.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.1)
12
13
  crack (0.4.4)
13
14
  diff-lcs (1.4.4)
14
15
  docile (1.3.2)
15
- faraday (0.9.2)
16
- multipart-post (>= 1.2, < 3)
16
+ faraday (2.5.2)
17
+ faraday-net_http (>= 2.0, < 3.1)
18
+ ruby2_keywords (>= 0.0.4)
19
+ faraday-net_http (3.0.0)
17
20
  hashdiff (1.0.1)
18
- hashie (4.1.0)
19
- jwt (2.2.2)
20
- multi_json (1.15.0)
21
+ hashie (5.0.0)
22
+ jwt (2.5.0)
21
23
  multi_xml (0.6.0)
22
- multipart-post (2.1.1)
23
- oauth2 (1.4.4)
24
- faraday (>= 0.8, < 2.0)
24
+ oauth2 (2.0.7)
25
+ faraday (>= 0.17.3, < 3.0)
25
26
  jwt (>= 1.0, < 3.0)
26
- multi_json (~> 1.3)
27
27
  multi_xml (~> 0.5)
28
28
  rack (>= 1.2, < 3)
29
- omniauth (1.9.1)
29
+ rash_alt (>= 0.4, < 1)
30
+ version_gem (~> 1.1)
31
+ omniauth (2.1.0)
30
32
  hashie (>= 3.4.6)
31
- rack (>= 1.6.2, < 3)
32
- omniauth-oauth2 (1.2.0)
33
- faraday (>= 0.8, < 0.10)
34
- multi_json (~> 1.3)
35
- oauth2 (~> 1.0)
36
- omniauth (~> 1.2)
33
+ rack (>= 2.2.3)
34
+ rack-protection
35
+ omniauth-oauth2 (1.8.0)
36
+ oauth2 (>= 1.4, < 3)
37
+ omniauth (~> 2.0)
38
+ parallel (1.19.2)
39
+ parser (2.7.2.0)
40
+ ast (~> 2.4.1)
37
41
  public_suffix (4.0.6)
38
42
  rack (2.2.3)
43
+ rack-protection (2.2.2)
44
+ rack
39
45
  rack-test (1.1.0)
40
46
  rack (>= 1.0, < 3)
47
+ rainbow (3.0.0)
41
48
  rake (10.5.0)
49
+ rash_alt (0.4.12)
50
+ hashie (>= 3.4)
51
+ regexp_parser (1.8.1)
52
+ rexml (3.2.4)
42
53
  rspec (2.99.0)
43
54
  rspec-core (~> 2.99.0)
44
55
  rspec-expectations (~> 2.99.0)
@@ -47,10 +58,25 @@ GEM
47
58
  rspec-expectations (2.99.2)
48
59
  diff-lcs (>= 1.1.3, < 2.0)
49
60
  rspec-mocks (2.99.4)
61
+ rubocop (0.93.0)
62
+ parallel (~> 1.10)
63
+ parser (>= 2.7.1.5)
64
+ rainbow (>= 2.2.2, < 4.0)
65
+ regexp_parser (>= 1.8)
66
+ rexml
67
+ rubocop-ast (>= 0.6.0)
68
+ ruby-progressbar (~> 1.7)
69
+ unicode-display_width (>= 1.4.0, < 2.0)
70
+ rubocop-ast (0.7.1)
71
+ parser (>= 2.7.1.5)
72
+ ruby-progressbar (1.10.1)
73
+ ruby2_keywords (0.0.5)
50
74
  simplecov (0.19.0)
51
75
  docile (~> 1.1)
52
76
  simplecov-html (~> 0.11)
53
77
  simplecov-html (0.12.3)
78
+ unicode-display_width (1.7.0)
79
+ version_gem (1.1.0)
54
80
  webmock (3.9.1)
55
81
  addressable (>= 2.3.6)
56
82
  crack (>= 0.3.2)
@@ -64,6 +90,7 @@ DEPENDENCIES
64
90
  rack-test
65
91
  rake (~> 10.0)
66
92
  rspec (~> 2.7)
93
+ rubocop (~> 0.93.0)
67
94
  simplecov
68
95
  webmock
69
96
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013 by Daniel Archer, Jen Aprahamian, Adam Bouck, Ray Zane
3
+ Copyright (c) 2020 by Nick Robinson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
data/README.md CHANGED
@@ -16,11 +16,11 @@ You can pull it in directly from github (if you really want to) e.g.:
16
16
 
17
17
  Once these are in, you need to add the following to your `config/initializers/devise.rb` (NOTE: A full enumeration of Square Permissions can be found [here](https://developer.squareup.com/docs/oauth-api/square-permissions).):
18
18
 
19
- config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE"}
19
+ config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE,MERCHANT_PROFILE_READ"}
20
20
 
21
21
  Sandbox Example:
22
22
 
23
- config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE", :client_options => {:connect_site => 'https://connect.squareupsandbox.com', :site => 'https://squareupsandbox.com'}}
23
+ config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE,MERCHANT_PROFILE_READ", :client_options => {:connect_site => 'https://connect.squareupsandbox.com', :site => 'https://squareupsandbox.com'}}
24
24
 
25
25
  You will obviously have to put in your key and secret, which you get when you register your app with Square (they call them Application Key and Secret Key).
26
26
 
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
7
-
8
+ task default: :spec
@@ -1,50 +1,47 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth/strategies/oauth2'
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class Square < OmniAuth::Strategies::OAuth2
8
+ option :name, 'square'
6
9
  option :client_options, {
7
- :site => 'https://squareup.com/',
8
- :connect_site => 'https://connect.squareup.com',
9
- :authorize_url => '/oauth2/authorize',
10
- :token_url => '/oauth2/token'
10
+ site: 'https://connect.squareup.com',
11
+ authorize_url: 'oauth2/authorize',
12
+ token_url: 'oauth2/token'
11
13
  }
12
14
 
13
- uid { raw_info["merchant"][0]["id"] }
15
+ uid { raw_info['merchant'][0]['id'] }
14
16
 
15
17
  info do
16
18
  prune!(
17
- :name => raw_info["merchant"][0]["business_name"],
18
- :country => raw_info["merchant"][0]["country"]
19
+ name: raw_info['merchant'][0]['business_name'],
20
+ country: raw_info['merchant'][0]['country'],
21
+ email: raw_info['email']
19
22
  )
20
23
  end
21
24
 
22
25
  extra do
23
- { :raw_info => raw_info }
26
+ { raw_info: raw_info }
27
+ end
28
+
29
+ def callback_url
30
+ full_host + script_name + callback_path
24
31
  end
25
32
 
26
33
  def build_access_token
27
- connect_client = client.dup
28
- connect_client.site = options.client_options.connect_site
29
- auth_params = {
30
- :redirect_uri => callback_url,
31
- :client_id => options.client_id,
32
- :client_secret => options.client_secret,
33
- :grant_type => "authorization_code"
34
- }.merge(token_params.to_hash(:symbolize_keys => true))
35
- connect_client.auth_code.get_token(
36
- request.params["code"],
37
- auth_params.merge(
38
- token_params.to_hash(:symbolize_keys => true)
39
- ),
40
- deep_symbolize(options.auth_token_params)
41
- )
34
+ options.token_params.merge!({client_id: options.client_id, client_secret: options.client_secret})
35
+ super
42
36
  end
43
37
 
44
- private
38
+ private
45
39
 
46
40
  def raw_info
47
41
  @raw_info ||= access_token.get('/v2/merchants').parsed
42
+ main_location_id = @raw_info['merchant'][0]['main_location_id']
43
+ location_data = access_token.get("/v2/locations/#{main_location_id}").parsed
44
+ @raw_info.merge!({email: location_data['location']['business_email']})
48
45
  end
49
46
 
50
47
  def prune!(hash)
@@ -57,4 +54,4 @@ module OmniAuth
57
54
  end
58
55
  end
59
56
 
60
- OmniAuth.config.add_camelization 'square', 'Square'
57
+ OmniAuth.config.add_camelization 'square', 'Square'
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Omniauth
2
4
  module Square
3
- VERSION = "0.0.1"
5
+ VERSION = '0.1.0'
4
6
  end
5
7
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-square/version'
4
+ require 'omniauth/strategies/square'
@@ -1,26 +1,28 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "omniauth-square/version"
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+ require 'omniauth-square/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "omniauth-square-oauth2"
7
+ s.name = 'omniauth-square-oauth2'
7
8
  s.version = Omniauth::Square::VERSION
8
- s.authors = ["Nick Robinson"]
9
- s.email = ["nrobinson13+github@gmail.com"]
10
- s.homepage = "https://github.com/nickrobinson/omniauth-square-oauth2"
11
- s.summary = %q{Square OAuth strategy for OmniAuth}
12
- s.description = %q{Square OAuth strategy for OmniAuth}
13
- s.license = "MIT"
9
+ s.authors = ['Nick Robinson']
10
+ s.email = ['nrobinson13+github@gmail.com']
11
+ s.homepage = 'https://github.com/nickrobinson/omniauth-square-oauth2'
12
+ s.summary = 'Square OAuth strategy for OmniAuth'
13
+ s.description = 'Square OAuth strategy for OmniAuth'
14
+ s.license = 'MIT'
14
15
 
15
16
  s.files = `git ls-files`.split("\n")
16
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+ s.require_paths = ['lib']
19
20
 
20
- s.add_runtime_dependency 'omniauth-oauth2', '>= 1.1.1', '< 1.3.0'
21
- s.add_development_dependency 'rspec', '~> 2.7'
21
+ s.add_runtime_dependency 'omniauth-oauth2', '>= 1.7.3'
22
22
  s.add_development_dependency 'rack-test'
23
- s.add_development_dependency "rake", "~> 10.0"
23
+ s.add_development_dependency 'rake', '~> 10.0'
24
+ s.add_development_dependency 'rspec', '~> 2.7'
25
+ s.add_development_dependency 'rubocop', '~> 0.93.0'
24
26
  s.add_development_dependency 'simplecov'
25
27
  s.add_development_dependency 'webmock'
26
28
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe OmniAuth::Strategies::Square do
4
6
  before :each do
5
- @request = double('Request', :scheme => '', :url => '')
7
+ @request = double('Request', scheme: '', url: '')
6
8
  @request.stub(:params) { {} }
7
9
  end
8
10
 
@@ -29,14 +31,14 @@ describe OmniAuth::Strategies::Square do
29
31
  describe '#info' do
30
32
  before :each do
31
33
  @raw_info = {
32
- "merchant" => [{
33
- "id" => "JGHJ0343",
34
- "business_name" => "Foobar Sports",
35
- "country" => "US",
36
- "language_code" => "en-US",
37
- "currency" => "USD",
38
- "status" => "ACTIVE",
39
- "main_location_id" => "DDM555V5KQPNS"
34
+ 'merchant' => [{
35
+ 'id' => 'JGHJ0343',
36
+ 'business_name' => 'Foobar Sports',
37
+ 'country' => 'US',
38
+ 'language_code' => 'en-US',
39
+ 'currency' => 'USD',
40
+ 'status' => 'ACTIVE',
41
+ 'main_location_id' => 'DDM555V5KQPNS'
40
42
  }]
41
43
  }
42
44
 
@@ -49,7 +51,7 @@ describe OmniAuth::Strategies::Square do
49
51
  end
50
52
 
51
53
  it 'returns raw info' do
52
- subject.extra[:raw_info]['merchant'][0]['business_name'].should eq("Foobar Sports")
54
+ subject.extra[:raw_info]['merchant'][0]['business_name'].should eq('Foobar Sports')
53
55
  end
54
56
  end
55
57
  end
@@ -104,4 +106,4 @@ describe OmniAuth::Strategies::Square do
104
106
  subject.credentials.should_not have_key('refresh_token')
105
107
  end
106
108
  end
107
- end
109
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
  SimpleCov.start
3
5
  require 'rspec'
4
6
  require 'rack/test'
5
7
  require 'webmock/rspec'
6
8
  require 'omniauth'
7
- require 'omniauth-square'
9
+ require 'omniauth-square-oauth2'
8
10
 
9
11
  RSpec.configure do |config|
10
12
  config.include WebMock::API
11
13
  config.include Rack::Test::Methods
12
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
14
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
13
15
  end
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # NOTE it would be useful if this lived in omniauth-oauth2 eventually
2
4
  shared_examples 'an oauth2 strategy' do
3
5
  describe '#client' do
4
6
  it 'should be initialized with symbolized client_options' do
5
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
7
+ @options = { client_options: { 'authorize_url' => 'https://example.com' } }
6
8
  subject.client.options[:authorize_url].should == 'https://example.com'
7
9
  end
8
10
  end
9
11
 
10
12
  describe '#token_params' do
11
13
  it 'should include any authorize params passed in the :authorize_params option' do
12
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
14
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
13
15
  subject.token_params['foo'].should eq('bar')
14
16
  subject.token_params['baz'].should eq('zip')
15
17
  end
16
18
 
17
19
  it 'should include top-level options that are marked as :authorize_options' do
18
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
20
+ @options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
19
21
  subject.token_params['scope'].should eq('bar')
20
22
  subject.token_params['foo'].should eq('baz')
21
23
  end
22
24
  end
23
- end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-square-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Robinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-10 00:00:00.000000000 Z
11
+ date: 2022-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -16,62 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.1
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 1.3.0
19
+ version: 1.7.3
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 1.1.1
30
- - - "<"
26
+ version: 1.7.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack-test
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
- version: 1.3.0
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
33
41
  - !ruby/object:Gem::Dependency
34
- name: rspec
42
+ name: rake
35
43
  requirement: !ruby/object:Gem::Requirement
36
44
  requirements:
37
45
  - - "~>"
38
46
  - !ruby/object:Gem::Version
39
- version: '2.7'
47
+ version: '10.0'
40
48
  type: :development
41
49
  prerelease: false
42
50
  version_requirements: !ruby/object:Gem::Requirement
43
51
  requirements:
44
52
  - - "~>"
45
53
  - !ruby/object:Gem::Version
46
- version: '2.7'
54
+ version: '10.0'
47
55
  - !ruby/object:Gem::Dependency
48
- name: rack-test
56
+ name: rspec
49
57
  requirement: !ruby/object:Gem::Requirement
50
58
  requirements:
51
- - - ">="
59
+ - - "~>"
52
60
  - !ruby/object:Gem::Version
53
- version: '0'
61
+ version: '2.7'
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
65
  requirements:
58
- - - ">="
66
+ - - "~>"
59
67
  - !ruby/object:Gem::Version
60
- version: '0'
68
+ version: '2.7'
61
69
  - !ruby/object:Gem::Dependency
62
- name: rake
70
+ name: rubocop
63
71
  requirement: !ruby/object:Gem::Requirement
64
72
  requirements:
65
73
  - - "~>"
66
74
  - !ruby/object:Gem::Version
67
- version: '10.0'
75
+ version: 0.93.0
68
76
  type: :development
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
71
79
  requirements:
72
80
  - - "~>"
73
81
  - !ruby/object:Gem::Version
74
- version: '10.0'
82
+ version: 0.93.0
75
83
  - !ruby/object:Gem::Dependency
76
84
  name: simplecov
77
85
  requirement: !ruby/object:Gem::Requirement
@@ -107,45 +115,14 @@ executables: []
107
115
  extensions: []
108
116
  extra_rdoc_files: []
109
117
  files:
118
+ - ".github/workflows/ruby.yml"
119
+ - ".gitignore"
110
120
  - Gemfile
111
121
  - Gemfile.lock
112
122
  - LICENSE
113
123
  - README.md
114
124
  - Rakefile
115
- - coverage/.last_run.json
116
- - coverage/.resultset.json
117
- - coverage/.resultset.json.lock
118
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png
119
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png
120
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png
121
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png
122
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png
123
- - coverage/assets/0.12.3/application.css
124
- - coverage/assets/0.12.3/application.js
125
- - coverage/assets/0.12.3/colorbox/border.png
126
- - coverage/assets/0.12.3/colorbox/controls.png
127
- - coverage/assets/0.12.3/colorbox/loading.gif
128
- - coverage/assets/0.12.3/colorbox/loading_background.png
129
- - coverage/assets/0.12.3/favicon_green.png
130
- - coverage/assets/0.12.3/favicon_red.png
131
- - coverage/assets/0.12.3/favicon_yellow.png
132
- - coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png
133
- - coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png
134
- - coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png
135
- - coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png
136
- - coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png
137
- - coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png
138
- - coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png
139
- - coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png
140
- - coverage/assets/0.12.3/images/ui-icons_222222_256x240.png
141
- - coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png
142
- - coverage/assets/0.12.3/images/ui-icons_454545_256x240.png
143
- - coverage/assets/0.12.3/images/ui-icons_888888_256x240.png
144
- - coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png
145
- - coverage/assets/0.12.3/loading.gif
146
- - coverage/assets/0.12.3/magnify.png
147
- - coverage/index.html
148
- - lib/omniauth-square.rb
125
+ - lib/omniauth-square-oauth2.rb
149
126
  - lib/omniauth-square/version.rb
150
127
  - lib/omniauth/strategies/square.rb
151
128
  - omniauth-square-oauth2.gemspec
@@ -1,5 +0,0 @@
1
- {
2
- "result": {
3
- "covered_percent": 80.0
4
- }
5
- }