omniauth-wonde 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f4cafe73363a4b663a6353606e0740b5d5a11aec5d594d82a3385dac52f64f5
4
- data.tar.gz: '0184c9eaafa3fe880391cf4493e1ad90bc5542ca1b2492c25e91cd3a72b85455'
3
+ metadata.gz: 2f8378726aa4b74e019db4256018a854cfbb53f70bc370fc3440e3822ba2e7f0
4
+ data.tar.gz: 6a1e2c0acbf412cbad01963bdefa1f99b6444581544b2a12e9c6f8ba7fd6c082
5
5
  SHA512:
6
- metadata.gz: f568386ac13ba3d620bd577318a23f800de8c879604e746b9e6b27f309c47f69e75d2590be0eb0d78c626fc6dd479d71455880d26c8a3c208fbc13a53a5fbf8e
7
- data.tar.gz: 00b04b4024d16552abec0ac76dd2f30f38ab659fa5af7829a553458c95a78ad1380bc28ec41ea41204a419afae8b77f4519b2537726a9b33e949f80b33d8c428
6
+ metadata.gz: 51863741987ebcbbc4d03e6db9d860a9a63dac60e986255788740556729d959a322d0c2e85ce081e3390640ffad96e703aa84965531a9f773d70e9af59e47242
7
+ data.tar.gz: 36fe27441c1f3876237d2357e7b425c9970f3c0e5dbfb806b5c221432e08223b19dc87bc292f939764c7dfca3132967f5ff7bec17d21400201452897f2754d85
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.2.0] - 2026-06-14
6
+
7
+ ### Changed
8
+
9
+ - Bumped minimum Ruby version to 3.0.0.
10
+ - Switched linter from RuboCop to StandardRb.
11
+
12
+ ### Removed
13
+
14
+ - Dropped support for Ruby 2.3, 2.4, 2.5, 2.6, and 2.7.
15
+
16
+ ## [0.1.0] - 2019-09-12
17
+
18
+ ### Added
19
+
20
+ - Initial release of the OmniAuth strategy for Wonde.
21
+
22
+ [Unreleased]: https://github.com/tcrouch/omniauth-wonde/compare/v0.2.0...HEAD
23
+ [0.2.0]: https://github.com/tcrouch/omniauth-wonde/compare/v0.1.0...v0.2.0
24
+ [0.1.0]: https://github.com/tcrouch/omniauth-wonde/releases/tag/v0.1.0
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # OmniAuth::Wonde
2
2
 
3
+ [![Gem Version](https://img.shields.io/gem/v/omniauth-wonde.svg)](https://rubygems.org/gems/omniauth-wonde)
4
+ [![Ruby](https://github.com/tcrouch/omniauth-wonde/actions/workflows/ruby.yml/badge.svg)](https://github.com/tcrouch/omniauth-wonde/actions/workflows/ruby.yml)
5
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/87b66fa1686348c38fc6936a85c63685)](https://www.codacy.com/manual/t.crouch/omniauth-wonde)
6
+
3
7
  Strategy to authenticate with Wonde via OAuth2 in OmniAuth.
4
8
 
5
9
  ## Installation
@@ -12,15 +16,88 @@ gem 'omniauth-wonde'
12
16
 
13
17
  And then execute:
14
18
 
15
- $ bundle
19
+ ```console
20
+ $ bundle
21
+ ```
16
22
 
17
23
  Or install it yourself as:
18
24
 
19
- $ gem install omniauth-wonde
25
+ ```console
26
+ $ gem install omniauth-wonde
27
+ ```
20
28
 
21
29
  ## Usage
22
30
 
23
- TODO: Write usage instructions here
31
+ For example, adding middleware to a Rails app in `config/initializers/omniauth.rb`:
32
+
33
+ ```ruby
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider :wonde, ENV['WONDE_CLIENT_ID'], ENV['WONDE_CLIENT_SECRET']
36
+ end
37
+ ```
38
+
39
+ The OmniAuth Wonde URL is then accessible at: `/auth/wonde`
40
+
41
+ ### Devise
42
+
43
+ Specify as a provider in `config/initializers/devise.rb`:
44
+
45
+ ```ruby
46
+ config.omniauth :wonde, ENV['WONDE_CLIENT_ID'], ENV['WONDE_CLIENT_SECRET']
47
+ ```
48
+
49
+ ### Configuration
50
+
51
+ Additional configuration options can be provided as keyword arguments.
52
+
53
+ - `redirect_uri:` specify a custom redirect URI
54
+
55
+ ## Auth hash
56
+
57
+ Example of authentication hash available in `request.env['omniauth.auth']`:
58
+
59
+ ```ruby
60
+ {
61
+ "provider" => "wonde",
62
+ "uid" => "A1000000000",
63
+ "info" => {
64
+ "name" => "John Schmidt",
65
+ "first_name" => "John",
66
+ "last_name" => "Schmidt",
67
+ "middle_names" => "Jacob Jingleheimer",
68
+ "school_name" => "Acorn Primary School",
69
+ "school_id" => "A1000000001",
70
+ "person_type" => "student",
71
+ "person_id" => "A100000002",
72
+ "upi" => "0d50e37c226a4c189404f2d0747f5839"
73
+ },
74
+ "credentials" => {
75
+ "token" => "[TOKEN]",
76
+ "refresh_token" => "[REFRESH_TOKEN]",
77
+ "expires_at" => 1496120719,
78
+ "expires" => true
79
+ },
80
+ "extra" => {
81
+ "raw_info" => {
82
+ "Me" => {
83
+ "id" => "A1000000000",
84
+ "Person" => {
85
+ "id" => "A100000002",
86
+ "type" => "student",
87
+ "forename" => "John",
88
+ "middle_names" => "Jacob Jingleheimer",
89
+ "surname" => "Schmidt",
90
+ "upi" => "0d50e37c226a4c189404f2d0747f5839",
91
+ "School" => {
92
+ "id" => "A1000000001",
93
+ "name" => "Acorn Primary School"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
24
101
 
25
102
  ## Development
26
103
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'omniauth-oauth2'
3
+ require "omniauth-oauth2"
4
4
 
5
5
  module OmniAuth
6
6
  module Strategies
@@ -9,6 +9,7 @@ module OmniAuth
9
9
  # Wonde implements OAuth 2 (three legged)
10
10
  class Wonde < OmniAuth::Strategies::OAuth2
11
11
  USER_INFO_URL = "https://api.wonde.com/graphql/me"
12
+ USER_QUERY_BODY = {query: File.read(File.expand_path("user_data.graphql", __dir__))}.to_json.freeze
12
13
 
13
14
  option :name, "wonde"
14
15
  option :provider_ignores_state, true
@@ -40,31 +41,14 @@ module OmniAuth
40
41
  )
41
42
  end
42
43
 
43
- # @return [String] JSON string
44
- def self.user_query_body
45
- @user_query_body ||= begin
46
- gql = File.read(File.expand_path("user_data.graphql", __dir__))
47
- { query: gql }.to_json
48
- end
49
- end
50
-
51
44
  # @return [Hash]
52
45
  def raw_info
53
- @raw_info ||= begin
54
- data = fetch_user_info.parsed || {}
55
- data["data"] || {}
56
- end
46
+ @raw_info ||= fetch_user_info.parsed&.dig("data") || {}
57
47
  end
58
48
 
59
49
  # @return [String]
60
50
  def callback_url
61
- options[:redirect_uri] ||
62
- (
63
- full_host +
64
- script_name +
65
- callback_path
66
- )
67
- # "#{full_host}#{script_name}#{callback_path}"
51
+ options[:redirect_uri] || (full_host + script_name + callback_path)
68
52
  end
69
53
 
70
54
  private
@@ -74,8 +58,8 @@ module OmniAuth
74
58
  # POST to Wonde GraphQL API
75
59
  def fetch_user_info
76
60
  access_token.post(USER_INFO_URL) do |req|
77
- req.headers['Content-Type'] = "application/json"
78
- req.body = self.class.user_query_body
61
+ req.headers["Content-Type"] = "application/json"
62
+ req.body = USER_QUERY_BODY
79
63
  end
80
64
  end
81
65
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Wonde
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -6,6 +6,5 @@ require "omniauth/strategies/wonde"
6
6
  module OmniAuth
7
7
  module Wonde
8
8
  class Error < StandardError; end
9
- # Your code goes here...
10
9
  end
11
10
  end
@@ -1,34 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "omniauth/wonde/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = "omniauth-wonde"
9
- spec.version = OmniAuth::Wonde::VERSION
10
- spec.authors = ["Tom Crouch"]
11
- spec.email = ["tom.crouch@gmail.com"]
8
+ spec.name = "omniauth-wonde"
9
+ spec.version = OmniAuth::Wonde::VERSION
10
+ spec.authors = ["Tom Crouch"]
11
+ spec.email = ["tom.crouch@gmail.com"]
12
12
 
13
- spec.summary = "OmniAuth strategy for Wonde"
14
- spec.homepage = "https://github.com/tcrouch/omniauth-wonde"
15
- spec.license = "MIT"
13
+ spec.summary = "OmniAuth strategy for Wonde"
14
+ spec.homepage = "https://github.com/tcrouch/omniauth-wonde"
15
+ spec.license = "MIT"
16
16
 
17
- # Specify which files should be added to the gem when it is released.
18
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- end
22
- spec.bindir = "exe"
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.files = Dir["lib/**/*", "*.gemspec", "CHANGELOG*", "LICENSE*", "README*"]
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
20
  spec.require_paths = ["lib"]
25
- spec.required_ruby_version = ">= 2.3.0"
21
+ spec.required_ruby_version = ">= 3.0.0"
26
22
 
27
23
  spec.add_runtime_dependency "omniauth-oauth2"
28
24
 
29
- spec.add_development_dependency "bundler", "~> 2.0"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "relaxed-rubocop", "~> 2.4"
25
+ spec.add_development_dependency "rake", "~> 13.0"
32
26
  spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "rubocop", "~> 0.74"
27
+ spec.add_development_dependency "standard", "~> 1.54"
34
28
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-wonde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Crouch
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2019-09-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: omniauth-oauth2
@@ -24,48 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
41
26
  - !ruby/object:Gem::Dependency
42
27
  name: rake
43
28
  requirement: !ruby/object:Gem::Requirement
44
29
  requirements:
45
30
  - - "~>"
46
31
  - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: relaxed-rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.4'
32
+ version: '13.0'
62
33
  type: :development
63
34
  prerelease: false
64
35
  version_requirements: !ruby/object:Gem::Requirement
65
36
  requirements:
66
37
  - - "~>"
67
38
  - !ruby/object:Gem::Version
68
- version: '2.4'
39
+ version: '13.0'
69
40
  - !ruby/object:Gem::Dependency
70
41
  name: rspec
71
42
  requirement: !ruby/object:Gem::Requirement
@@ -81,36 +52,28 @@ dependencies:
81
52
  - !ruby/object:Gem::Version
82
53
  version: '3.0'
83
54
  - !ruby/object:Gem::Dependency
84
- name: rubocop
55
+ name: standard
85
56
  requirement: !ruby/object:Gem::Requirement
86
57
  requirements:
87
58
  - - "~>"
88
59
  - !ruby/object:Gem::Version
89
- version: '0.74'
60
+ version: '1.54'
90
61
  type: :development
91
62
  prerelease: false
92
63
  version_requirements: !ruby/object:Gem::Requirement
93
64
  requirements:
94
65
  - - "~>"
95
66
  - !ruby/object:Gem::Version
96
- version: '0.74'
97
- description:
67
+ version: '1.54'
98
68
  email:
99
69
  - tom.crouch@gmail.com
100
70
  executables: []
101
71
  extensions: []
102
72
  extra_rdoc_files: []
103
73
  files:
104
- - ".gitignore"
105
- - ".rspec"
106
- - ".rubocop.yml"
107
- - ".travis.yml"
108
- - Gemfile
74
+ - CHANGELOG.md
109
75
  - LICENSE.txt
110
76
  - README.md
111
- - Rakefile
112
- - bin/console
113
- - bin/setup
114
77
  - lib/omniauth/strategies/user_data.graphql
115
78
  - lib/omniauth/strategies/wonde.rb
116
79
  - lib/omniauth/wonde.rb
@@ -120,7 +83,6 @@ homepage: https://github.com/tcrouch/omniauth-wonde
120
83
  licenses:
121
84
  - MIT
122
85
  metadata: {}
123
- post_install_message:
124
86
  rdoc_options: []
125
87
  require_paths:
126
88
  - lib
@@ -128,16 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
90
  requirements:
129
91
  - - ">="
130
92
  - !ruby/object:Gem::Version
131
- version: 2.3.0
93
+ version: 3.0.0
132
94
  required_rubygems_version: !ruby/object:Gem::Requirement
133
95
  requirements:
134
96
  - - ">="
135
97
  - !ruby/object:Gem::Version
136
98
  version: '0'
137
99
  requirements: []
138
- rubyforge_project:
139
- rubygems_version: 2.7.6
140
- signing_key:
100
+ rubygems_version: 4.0.10
141
101
  specification_version: 4
142
102
  summary: OmniAuth strategy for Wonde
143
103
  test_files: []
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /Gemfile.lock
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,11 +0,0 @@
1
- inherit_gem:
2
- relaxed-rubocop: .rubocop.yml
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.3
6
-
7
- Layout/AlignArguments:
8
- EnforcedStyle: with_fixed_indentation
9
- Metrics/BlockLength:
10
- Exclude:
11
- - "spec/**/*.rb"
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.3
7
- - 2.4
8
- - 2.5.3
9
- - 2.6
10
- - ruby-head
11
- matrix:
12
- allow_failures:
13
- - rvm: ruby-head
14
- fast_finish: true
15
- before_install: gem install bundler -v 2.0.1
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in omniauth-wonde.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,8 +0,0 @@
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
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "omniauth/wonde"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here