Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Commit ad24d72

Browse files
author
Vasile Zaremba
authored
Merge pull request #1 from getyoti/update_extra_fields
Update extra fields
2 parents b26a694 + 19614c3 commit ad24d72

File tree

6 files changed

+56
-32
lines changed

6 files changed

+56
-32
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.1.0 - 2017-04-11
8+
Updates dependencies to the latest versions and aligns extra fields naming conventions with the Yoti attributes.
9+
10+
### Added
11+
- `email_address` field
12+
13+
### Changed
14+
- renamed `photo` to `selfie`
15+
- renamed `mobile_number` to `phone_number`
16+
- renamed `address` to `postal_address`
17+
18+
### Updated dependencies
19+
- Required Ruby version `>= 2.1.9`
20+
- `omniauth` `~> 1.6`
21+
- `rake` `~> 12.0`
22+
- `rspec` `~> 3.5`
23+
- `simplecov` `~> 0.14`
24+
- `webmock` `~> 2.3`
25+
26+
727
## 1.0.1 - 2016-11-28
828
### Added
929
- Yoti proprietary license

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,16 @@ A call to `/auth/yoti/callback` will open the Yoti authentication page, and afte
6767
},
6868
"credentials" => {},
6969
"extra" => {
70-
"photo" => "data:image/jpeg;base64,/9j/2wCEAAMCAg...",
71-
"given_names" => "Given Name",
72-
"family_name" => "Family Name",
73-
"mobile_number" => "07474747474",
74-
"date_of_birth" => nil,
75-
"address" => nil,
76-
"gender" => nil,
77-
"nationality" => nil
70+
"selfie" => "data:image/jpeg;base64,/9j/2wCEAAMCAg...",
71+
"given_names" => "Given Name",
72+
"family_name" => "Family Name",
73+
"phone_number" => "07474747474",
74+
"email_address" => "[email protected]",
75+
"date_of_birth" => nil,
76+
"postal_address" => nil,
77+
"gender" => 'MALE',
78+
"nationality" => nil
7879
}
7980
}
8081

8182
```
82-
83-
## License
84-
85-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

lib/omniauth/strategies/yoti.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ def request_phase
1717

1818
def extra
1919
@raw_info ||= {
20-
photo: yoti_user_profile['selfie'],
20+
selfie: yoti_user_profile['selfie'],
2121
given_names: yoti_user_profile['given_names'],
2222
family_name: yoti_user_profile['family_name'],
23-
mobile_number: yoti_user_profile['phone_number'],
23+
phone_number: yoti_user_profile['phone_number'],
24+
email_address: yoti_user_profile['email_address'],
2425
date_of_birth: yoti_user_profile['date_of_birth'],
25-
address: yoti_user_profile['post_code'],
26+
postal_address: yoti_user_profile['postal_address'],
2627
gender: yoti_user_profile['gender'],
2728
nationality: yoti_user_profile['nationality']
2829
}

lib/omniauth/yoti/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Omniauth
22
module Yoti
3-
VERSION = '1.0.1'.freeze
3+
VERSION = '1.1.0'.freeze
44
end
55
end

omniauth-yoti.gemspec

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# coding: utf-8
2+
23
lib = File.expand_path('../lib', __FILE__)
34
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
45
require 'omniauth/yoti/version'
@@ -7,7 +8,7 @@ Gem::Specification.new do |spec|
78
spec.name = 'omniauth-yoti'
89
spec.version = Omniauth::Yoti::VERSION
910
spec.authors = ['Vasile Zaremba']
10-
spec.email = ['vasile.zaremba@yoti.com']
11+
spec.email = ['tech@yoti.com']
1112

1213
spec.summary = 'Yoti strategy for OmniAuth'
1314
spec.homepage = 'https://github.com/getyoti/omniauth-yoti'
@@ -18,14 +19,14 @@ Gem::Specification.new do |spec|
1819
end
1920
spec.require_paths = ['lib']
2021

21-
spec.required_ruby_version = '>= 2'
22+
spec.required_ruby_version = '>= 2.1.9'
2223

23-
spec.add_dependency 'omniauth', '~> 1.3'
24+
spec.add_dependency 'omniauth', '~> 1.6'
2425
spec.add_dependency 'yoti', '~> 1.0'
2526

2627
spec.add_development_dependency 'bundler', '~> 1.13'
27-
spec.add_development_dependency 'rake', '~> 10.0'
28-
spec.add_development_dependency 'rspec', '~> 3.0'
29-
spec.add_development_dependency 'simplecov'
30-
spec.add_development_dependency 'webmock'
28+
spec.add_development_dependency 'rake', '~> 12.0'
29+
spec.add_development_dependency 'rspec', '~> 3.5'
30+
spec.add_development_dependency 'simplecov', '~> 0.14'
31+
spec.add_development_dependency 'webmock', '~> 2.3'
3132
end

spec/omniauth/strategies/yoti_spec.rb

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@
5353

5454
describe '#extra' do
5555
context 'when using a mock request' do
56-
it 'has the correct photo' do
56+
it 'has the correct selfie' do
5757
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8')
58-
expect(subject.extra[:photo]).to eql(selfie)
58+
expect(subject.extra[:selfie]).to eql(selfie)
5959
end
6060

6161
it 'has the correct phone number' do
62-
expect(subject.extra[:mobile_number]).to eql('+447474747474')
62+
expect(subject.extra[:phone_number]).to eql('+447474747474')
6363
end
6464
end
6565

@@ -69,7 +69,7 @@
6969
end
7070

7171
it 'has the correct selfie' do
72-
expect(subject.extra[:photo]).to eql('photo.png')
72+
expect(subject.extra[:selfie]).to eql('selfie.png')
7373
end
7474

7575
it 'has the correct given names' do
@@ -81,15 +81,19 @@
8181
end
8282

8383
it 'has the correct mobile number' do
84-
expect(subject.extra[:mobile_number]).to eql('07474747474')
84+
expect(subject.extra[:phone_number]).to eql('07474747474')
85+
end
86+
87+
it 'has the correct email address' do
88+
expect(subject.extra[:email_address]).to eql('[email protected]')
8589
end
8690

8791
it 'has the correct date of birth' do
8892
expect(subject.extra[:date_of_birth]).to eql('2000.12.12')
8993
end
9094

91-
it 'has the correct address' do
92-
expect(subject.extra[:address]).to eql('WC2N 4JH')
95+
it 'has the correct postal address' do
96+
expect(subject.extra[:postal_address]).to eql('WC2N 4JH')
9397
end
9498

9599
it 'has the correct gender' do
@@ -106,12 +110,13 @@
106110

107111
def raw_info_hash
108112
{
109-
'selfie' => 'photo.png',
113+
'selfie' => 'selfie.png',
110114
'given_names' => 'Given Names',
111115
'family_name' => 'Family Name',
112116
'phone_number' => '07474747474',
117+
'email_address' => '[email protected]',
113118
'date_of_birth' => '2000.12.12',
114-
'post_code' => 'WC2N 4JH',
119+
'postal_address' => 'WC2N 4JH',
115120
'gender' => 'male',
116121
'nationality' => 'British'
117122
}

0 commit comments

Comments
 (0)