diff --git a/CHANGELOG.md b/CHANGELOG.md index c47ae65..9007056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 7e8db66..a49dedd 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/lib/omniauth/strategies/yoti.rb b/lib/omniauth/strategies/yoti.rb index 653bf01..1aefb91 100644 --- a/lib/omniauth/strategies/yoti.rb +++ b/lib/omniauth/strategies/yoti.rb @@ -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'] } diff --git a/lib/omniauth/yoti/version.rb b/lib/omniauth/yoti/version.rb index d612bbf..3e16d1d 100644 --- a/lib/omniauth/yoti/version.rb +++ b/lib/omniauth/yoti/version.rb @@ -1,5 +1,5 @@ module Omniauth module Yoti - VERSION = '1.0.1'.freeze + VERSION = '1.1.0'.freeze end end diff --git a/omniauth-yoti.gemspec b/omniauth-yoti.gemspec index cc1c5c6..3ffae2c 100644 --- a/omniauth-yoti.gemspec +++ b/omniauth-yoti.gemspec @@ -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' @@ -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' @@ -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 diff --git a/spec/omniauth/strategies/yoti_spec.rb b/spec/omniauth/strategies/yoti_spec.rb index 35e60b5..71c1c4a 100644 --- a/spec/omniauth/strategies/yoti_spec.rb +++ b/spec/omniauth/strategies/yoti_spec.rb @@ -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 @@ -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 @@ -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 @@ -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' }