omniauth-yoti 1.1.3 → 1.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
  SHA1:
3
- metadata.gz: '0764709e7bb83835d612ac5279ca733cdf6fbcec'
4
- data.tar.gz: 692ce05e5faae22f3370df7901de1934d6673d61
3
+ metadata.gz: 4dbb17c7f98c58491e886790858ba3b6a097d242
4
+ data.tar.gz: 36ae694b78aa792dd3b29ca58de17fe3430a34b5
5
5
  SHA512:
6
- metadata.gz: 044f4078c68d7e328904718253e7b24097d83c15ee54cbf17b94cef127eb9f8f43543a85fd8bd480cdd6c090d647abe35a5be224092da9447fd303832d760efa
7
- data.tar.gz: cdd2f2dc69c8b7ed12d46206c2d8e492cc2219832301766cdd06466cd0be40f5d6c1c144743e43595e6da9829515b9fbb627b5fca8c0c939a7812b5cb0cd9a37
6
+ metadata.gz: 78e98484084f29a6075c74b3a7780f06b3e2082ff527a2dc808311be33953e608b0b6ef29f7b63a769f9c69b8e3e3fee14f3bf8c3f4abba4702cf501ade6e772
7
+ data.tar.gz: 105219e7d3863a979747a4fc353b132d6372c13d111ad43df1c1b9f3f82cef371f4c50670eacbc334482703a8c64c7ff3761b2f6490cfb8564923a4b45160444
data/CHANGELOG.md CHANGED
@@ -1,17 +1,23 @@
1
- # Change Log
1
+ # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
- and this project adheres to [Semantic Versioning](http://semver.org/).
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## 1.1.3 - 2017-11-01
7
+ ## [1.2.0] - 2018-03-09
8
+ ### Added
9
+ - `age_verified` returns a boolean value of the age validation
10
+
11
+ ### Changed
12
+ - Moved the profile attributes in the response Hash from `extra` to `info`. Please check [README.md](README.md#upgrading-from-version-11) for details.
8
13
 
14
+ ## [1.1.3] - 2017-11-01
9
15
  ### Added
10
16
  - `base64_selfie_uri` value
11
17
 
12
- ## 1.1.2 - 2017-10-18
18
+ ## [1.1.2] - 2017-10-18
13
19
 
14
- ## 1.1.1 - 2017-09-13
20
+ ## [1.1.1] - 2017-09-13
15
21
  ### Changed
16
22
  - Switched from proprietary to MIT license
17
23
 
@@ -21,8 +27,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
21
27
  - `simplecov` `~> 0.15`
22
28
  - `webmock` `~> 3.0`
23
29
 
24
- ## 1.1.0 - 2017-04-11
25
- Updates dependencies to the latest versions and aligns extra fields naming conventions with the Yoti attributes.
30
+ ## [1.1.0] - 2017-04-11
31
+ Updated dependencies to the latest versions and aligns extra fields naming conventions with the Yoti attributes.
26
32
 
27
33
  ### Added
28
34
  - `email_address` field
@@ -40,10 +46,10 @@ Updates dependencies to the latest versions and aligns extra fields naming conve
40
46
  - `simplecov` `~> 0.14`
41
47
  - `webmock` `~> 2.3`
42
48
 
43
- ## 1.0.1 - 2016-11-28
49
+ ## [1.0.1] - 2016-11-28
44
50
  ### Added
45
51
  - Yoti proprietary license
46
52
 
47
- ## 1.0.0 - 2016-11-25
53
+ ## [1.0.0] - 2016-11-25
48
54
  ### Added
49
55
  - This is an initial public release.
data/README.md CHANGED
@@ -19,13 +19,13 @@ gem 'omniauth-yoti'
19
19
  And then execute:
20
20
 
21
21
  ```shell
22
- $ bundle
22
+ bundle
23
23
  ```
24
24
 
25
25
  Or install it yourself as:
26
26
 
27
27
  ```shell
28
- $ gem install omniauth-yoti
28
+ gem install omniauth-yoti
29
29
  ```
30
30
 
31
31
  ## Configuration
@@ -63,21 +63,42 @@ A call to `/auth/yoti/callback` will open the Yoti authentication page, and afte
63
63
  "provider" => "yoti",
64
64
  "uid" => "mHvpV4...",
65
65
  "info" => {
66
- "name" => "mHvpV4Mm+yMb...",
67
- "base64_selfie_uri" => "data:image/jpeg;base64,/9j/2wCEAAMCAg..."
68
- },
66
+ "name" => "John Doe",
67
+ "selfie" => "jpeg image data file",
68
+ "full_name" => "John Doe",
69
+ "given_names" => "John",
70
+ "family_name" => "Doe",
71
+ "phone_number" => "07474747474",
72
+ "email_address" => "email@example.com",
73
+ "date_of_birth" => "1989-11-09",
74
+ "postal_address" => "Fountain House\n130 Fenchurch St\nLONDON\nEC3M 5DJ",
75
+ "gender" => "MALE",
76
+ "nationality" => "GBR"
77
+ "base64_selfie_uri" => "data:image/jpeg;base64,/9j/2wCEAAMCAg..."
78
+ "age_verified" => true
79
+ },
69
80
  "credentials" => {},
70
81
  "extra" => {
71
- "selfie" => "jpeg image file",
72
- "given_names" => "Given Name",
73
- "family_name" => "Family Name",
74
- "phone_number" => "07474747474",
75
- "email_address" => "email@example.com",
76
- "date_of_birth" => nil,
77
- "postal_address" => nil,
78
- "gender" => 'MALE',
79
- "nationality" => nil
80
- }
82
+ { "raw_info" =>
83
+ {
84
+ "selfie" => "jpeg image data file",
85
+ "full_name" => "John Doe",
86
+ "given_names" => "Given Name",
87
+ "family_name" => "Family Name",
88
+ "phone_number" => "07474747474",
89
+ "email_address" => "email@example.com",
90
+ "date_of_birth" => "1989-11-09",
91
+ "postal_address" => "Fountain House\n130 Fenchurch St\nLONDON\nEC3M 5DJ",
92
+ "gender" => "MALE",
93
+ "nationality" => "GBR",
94
+ "age_over:18" => true
95
+ }
96
+ }
81
97
  }
82
-
83
98
  ```
99
+
100
+ ## Upgrading from version 1.1
101
+
102
+ Most of the profile attributes that were being stored in the `extra` fields got moved to `info`.
103
+
104
+ e.g. `request.env['omniauth.auth']['extra']['given_names']` will become `request.env['omniauth.auth']['info']['given_names']`
@@ -13,14 +13,12 @@ module OmniAuth
13
13
  end
14
14
 
15
15
  uid { yoti_user_id }
16
- info {{
17
- name: yoti_user_id,
18
- base64_selfie_uri: base64_selfie_uri
19
- }}
20
16
 
21
- def extra
22
- @raw_info ||= {
17
+ info do
18
+ {
19
+ name: yoti_user_profile['full_name'],
23
20
  selfie: yoti_user_profile['selfie'],
21
+ full_name: yoti_user_profile['full_name'],
24
22
  given_names: yoti_user_profile['given_names'],
25
23
  family_name: yoti_user_profile['family_name'],
26
24
  phone_number: yoti_user_profile['phone_number'],
@@ -28,10 +26,22 @@ module OmniAuth
28
26
  date_of_birth: yoti_user_profile['date_of_birth'],
29
27
  postal_address: yoti_user_profile['postal_address'],
30
28
  gender: yoti_user_profile['gender'],
31
- nationality: yoti_user_profile['nationality']
29
+ nationality: yoti_user_profile['nationality'],
30
+ base64_selfie_uri: base64_selfie_uri,
31
+ age_verified: age_verified
32
32
  }
33
33
  end
34
34
 
35
+ extra do
36
+ {
37
+ raw_info: raw_info
38
+ }
39
+ end
40
+
41
+ def raw_info
42
+ @raw_info ||= yoti_user_profile
43
+ end
44
+
35
45
  private
36
46
 
37
47
  def yoti_activity_details
@@ -53,6 +63,10 @@ module OmniAuth
53
63
  yoti_activity_details.base64_selfie_uri
54
64
  end
55
65
 
66
+ def age_verified
67
+ yoti_activity_details.age_verified
68
+ end
69
+
56
70
  def configure_yoti_client!
57
71
  ::Yoti.configure do |config|
58
72
  config.client_sdk_id = options.client_options[:client_sdk_id]
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Yoti
3
- VERSION = '1.1.3'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,4 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require 'omniauth/yoti/version'
6
4
 
@@ -22,7 +20,7 @@ Gem::Specification.new do |spec|
22
20
  spec.required_ruby_version = '>= 2.1.9'
23
21
 
24
22
  spec.add_dependency 'omniauth', '~> 1.6'
25
- spec.add_dependency 'yoti', '~> 1.1.0'
23
+ spec.add_dependency 'yoti', '~> 1.2.1'
26
24
 
27
25
  spec.add_development_dependency 'bundler', '~> 1.13'
28
26
  spec.add_development_dependency 'rake', '~> 12.1'
data/rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
  DisplayStyleGuide: true
4
- TargetRubyVersion: 2.3
4
+ TargetRubyVersion: 2.1.9
5
5
 
6
6
  Metrics/AbcSize:
7
7
  Max: 20
@@ -13,6 +13,9 @@ Metrics/MethodLength:
13
13
  CountComments: false
14
14
  Max: 15
15
15
 
16
+ Metrics/BlockLength:
17
+ Enabled: false
18
+
16
19
  Style/Documentation:
17
20
  Enabled: false
18
21
 
@@ -22,5 +25,5 @@ Style/FrozenStringLiteralComment:
22
25
  Style/NumericLiterals:
23
26
  Enabled: false
24
27
 
25
- Style/FileName:
28
+ Naming:
26
29
  Enabled: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-yoti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Zaremba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-01 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.0
33
+ version: 1.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.0
40
+ version: 1.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement