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

Update extra fields #1

Merged
merged 2 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.1.0 - 2017-04-11
Updates dependencies to the latest versions and aligns extra fields naming conventions with the Yoti attributes.

### Added
- `email_address` field

### Changed
- renamed `photo` to `selfie`
- renamed `mobile_number` to `phone_number`
- renamed `address` to `postal_address`

### Updated dependencies
- Required Ruby version `>= 2.1.9`
- `omniauth` `~> 1.6`
- `rake` `~> 12.0`
- `rspec` `~> 3.5`
- `simplecov` `~> 0.14`
- `webmock` `~> 2.3`


## 1.0.1 - 2016-11-28
### Added
- Yoti proprietary license
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,16 @@ A call to `/auth/yoti/callback` will open the Yoti authentication page, and afte
},
"credentials" => {},
"extra" => {
"photo" => "data:image/jpeg;base64,/9j/2wCEAAMCAg...",
"given_names" => "Given Name",
"family_name" => "Family Name",
"mobile_number" => "07474747474",
"date_of_birth" => nil,
"address" => nil,
"gender" => nil,
"nationality" => nil
"selfie" => "data:image/jpeg;base64,/9j/2wCEAAMCAg...",
"given_names" => "Given Name",
"family_name" => "Family Name",
"phone_number" => "07474747474",
"email_address" => "email@domain.com",
"date_of_birth" => nil,
"postal_address" => nil,
"gender" => 'MALE',
"nationality" => nil
}
}

```

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
7 changes: 4 additions & 3 deletions lib/omniauth/strategies/yoti.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def request_phase

def extra
@raw_info ||= {
photo: yoti_user_profile['selfie'],
selfie: yoti_user_profile['selfie'],
given_names: yoti_user_profile['given_names'],
family_name: yoti_user_profile['family_name'],
mobile_number: yoti_user_profile['phone_number'],
phone_number: yoti_user_profile['phone_number'],
email_address: yoti_user_profile['email_address'],
date_of_birth: yoti_user_profile['date_of_birth'],
address: yoti_user_profile['post_code'],
postal_address: yoti_user_profile['postal_address'],
gender: yoti_user_profile['gender'],
nationality: yoti_user_profile['nationality']
}
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/yoti/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Omniauth
module Yoti
VERSION = '1.0.1'.freeze
VERSION = '1.1.0'.freeze
end
end
15 changes: 8 additions & 7 deletions omniauth-yoti.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'omniauth/yoti/version'
Expand All @@ -7,7 +8,7 @@ Gem::Specification.new do |spec|
spec.name = 'omniauth-yoti'
spec.version = Omniauth::Yoti::VERSION
spec.authors = ['Vasile Zaremba']
spec.email = ['vasile.zaremba@yoti.com']
spec.email = ['tech@yoti.com']

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

spec.required_ruby_version = '>= 2'
spec.required_ruby_version = '>= 2.1.9'

spec.add_dependency 'omniauth', '~> 1.3'
spec.add_dependency 'omniauth', '~> 1.6'
spec.add_dependency 'yoti', '~> 1.0'

spec.add_development_dependency 'bundler', '~> 1.13'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'webmock'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rspec', '~> 3.5'
spec.add_development_dependency 'simplecov', '~> 0.14'
spec.add_development_dependency 'webmock', '~> 2.3'
end
23 changes: 14 additions & 9 deletions spec/omniauth/strategies/yoti_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@

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

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

Expand All @@ -69,7 +69,7 @@
end

it 'has the correct selfie' do
expect(subject.extra[:photo]).to eql('photo.png')
expect(subject.extra[:selfie]).to eql('selfie.png')
end

it 'has the correct given names' do
Expand All @@ -81,15 +81,19 @@
end

it 'has the correct mobile number' do
expect(subject.extra[:mobile_number]).to eql('07474747474')
expect(subject.extra[:phone_number]).to eql('07474747474')
end

it 'has the correct email address' do
expect(subject.extra[:email_address]).to eql('email@domain.com')
end

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

it 'has the correct address' do
expect(subject.extra[:address]).to eql('WC2N 4JH')
it 'has the correct postal address' do
expect(subject.extra[:postal_address]).to eql('WC2N 4JH')
end

it 'has the correct gender' do
Expand All @@ -106,12 +110,13 @@

def raw_info_hash
{
'selfie' => 'photo.png',
'selfie' => 'selfie.png',
'given_names' => 'Given Names',
'family_name' => 'Family Name',
'phone_number' => '07474747474',
'email_address' => 'email@domain.com',
'date_of_birth' => '2000.12.12',
'post_code' => 'WC2N 4JH',
'postal_address' => 'WC2N 4JH',
'gender' => 'male',
'nationality' => 'British'
}
Expand Down