yoti 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfb76c3f0cb4149f6435e965d87689bb31c216b3
4
- data.tar.gz: 72f3665e525e4448b901696a7f73237ca54a1a6b
3
+ metadata.gz: d6ee915ecf74fb4729d9b139b48273c9b41afe41
4
+ data.tar.gz: 0e9719ea688f33a2fa78d16dc249d161e69af0fc
5
5
  SHA512:
6
- metadata.gz: 98d40f82a5669b6951af5bd514f2fce613ad6ce361ca2d6e50c4cc2ae574a43daa96bfb81a1613c1e8053fedbc07add83263a4d30bb00fadd4a07d2ac7b7e12b
7
- data.tar.gz: 8bac080587f596a68fb897ba996c0be25bb263330b30cf9b0f8ed7a3a4e2209f0fb146ca5ddfeed6b23f21c1a682862665a260c86d9538da82039249e6c6b16b
6
+ metadata.gz: 6ef84e4667576bb61cbe84f116ca49d528dd3b3df51bde40d8a2240f05e8753237d507288a89629a3191e7edf0ba42f9ca6c77e8ed17f0eb1e7563d241078deb
7
+ data.tar.gz: 0a3a2c492f0ed1f22db4949a95936802197647640072af6f35432c0660b885bc51936af304ba072594cfbcbf965520c107a56b21468bf945f16f44271f5a0bf6
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## 1.0.2 - 2017-03-15
8
+ ### Added
9
+ - Allow empty profiles
10
+
7
11
  ## 1.0.1 - 2016-11-28
8
12
  ### Added
9
13
  - Yoti proprietary license
data/README.md CHANGED
@@ -200,14 +200,15 @@ Visiting the `http://your-local-url.domain` should show a Yoti Connect button
200
200
  ## API coverage
201
201
 
202
202
  * Activity Details
203
- * [X] User ID
203
+ * [X] User ID `user_id`
204
204
  * [X] Profile
205
205
  * [X] Photo `selfie`
206
206
  * [X] Given Names `given_names`
207
207
  * [X] Family Name `family_name`
208
208
  * [X] Mobile Number `phone_number`
209
+ * [X] Email address `email_address`
209
210
  * [X] Date of Birth `date_of_birth`
210
- * [X] Address `post_code`
211
+ * [X] Address `postal_address`
211
212
  * [X] Gender `gender`
212
213
  * [X] Nationality `nationality`
213
214
 
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  require 'yardstick/rake/verify'
38
38
  Yardstick::Rake::Verify.new(:verify_measurements, yardstick_options) do |verify|
39
- verify.threshold = 88.5
39
+ verify.threshold = 88.9
40
40
  end
41
41
 
42
42
  ################################
@@ -14,11 +14,11 @@ module Yoti
14
14
 
15
15
  # @param receipt [Hash] the receipt from the API request
16
16
  # @param decrypted_profile [Object] Protobuf AttributeList decrypted object containing the profile attributes
17
- def initialize(receipt, decrypted_profile)
17
+ def initialize(receipt, decrypted_profile = nil)
18
18
  @decrypted_profile = decrypted_profile
19
19
  @user_profile = {}
20
20
 
21
- if @decrypted_profile.respond_to_has_and_present?(:attributes)
21
+ if !@decrypted_profile.nil? && @decrypted_profile.respond_to_has_and_present?(:attributes)
22
22
  @decrypted_profile.attributes.each do |field|
23
23
  @user_profile[field.name] = Yoti::Protobuf.value_based_on_content_type(field.value, field.content_type)
24
24
  end
data/lib/yoti/client.rb CHANGED
@@ -8,6 +8,9 @@ module Yoti
8
8
  def self.get_activity_details(encrypted_connect_token)
9
9
  receipt = Yoti::Request.new(encrypted_connect_token).receipt
10
10
  encrypted_data = Protobuf.current_user(receipt)
11
+
12
+ return ActivityDetails.new(receipt) if encrypted_data.nil?
13
+
11
14
  unwrapped_key = Yoti::SSL.decrypt_token(receipt['wrapped_receipt_key'])
12
15
  decrypted_data = Yoti::SSL.decipher(unwrapped_key, encrypted_data.iv, encrypted_data.cipher_text)
13
16
  decrypted_profile = Protobuf.attribute_list(decrypted_data)
@@ -54,7 +54,7 @@ module Yoti
54
54
  end
55
55
 
56
56
  # Raises an error if the setting receives an invalid value
57
- # @param value [String] the value to be assigned
57
+ # @param config [String] the value to be assigned
58
58
  # @param allowed_values [Array] an array of allowed values for the variable
59
59
  # @return [nil]
60
60
  def validate_value(config, allowed_values)
@@ -75,7 +75,7 @@ module Yoti
75
75
  end
76
76
 
77
77
  # Checks if a configuration has been set as a instance variable
78
- # @param name [String] the name of the configuration
78
+ # @param config [String] the name of the configuration
79
79
  # @return [Boolean]
80
80
  def config_set?(config)
81
81
  instance_variable_get("@#{config}").to_s != ''
@@ -12,7 +12,8 @@ module Yoti
12
12
  CT_PNG = 4 # standard .png image
13
13
 
14
14
  def current_user(receipt)
15
- raise ProtobufError, 'The receipt has invalid data.' unless valid_recepit?(receipt)
15
+ return nil unless valid_receipt?(receipt)
16
+
16
17
  profile_content = receipt['other_party_profile_content']
17
18
  decoded_profile_content = Base64.decode64(profile_content)
18
19
  V1::Compubapi::EncryptedData.decode(decoded_profile_content)
@@ -41,8 +42,10 @@ module Yoti
41
42
 
42
43
  private
43
44
 
44
- def valid_recepit?(receipt)
45
- receipt.key?('other_party_profile_content') && !receipt['other_party_profile_content'].nil?
45
+ def valid_receipt?(receipt)
46
+ receipt.key?('other_party_profile_content') &&
47
+ !receipt['other_party_profile_content'].nil? &&
48
+ receipt['other_party_profile_content'] != ''
46
49
  end
47
50
  end
48
51
  end
data/lib/yoti/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Yoti
2
2
  # @return [String] the gem's current version
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.0.2'.freeze
4
4
  end
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.4
5
5
  Exclude:
6
6
  - 'examples/rails/config/**/*'
7
7
 
@@ -10,12 +10,18 @@ Metrics/AbcSize:
10
10
  Exclude:
11
11
  - examples/rails/app/controllers/yoti_controller.rb
12
12
 
13
+ Metrics/BlockLength:
14
+ Exclude:
15
+ - spec/**/**/*.rb
16
+
13
17
  Metrics/LineLength:
14
18
  Enabled: false
15
19
 
16
20
  Metrics/MethodLength:
17
21
  CountComments: false
18
22
  Max: 15
23
+ Exclude:
24
+ - examples/rails/app/controllers/yoti_controller.rb
19
25
 
20
26
  Style/Documentation:
21
27
  Enabled: false
data/yoti.gemspec CHANGED
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency 'protobuf', '~> 3.6'
28
28
 
29
- spec.add_development_dependency 'bundler'
30
- spec.add_development_dependency 'dotenv'
31
- spec.add_development_dependency 'generator_spec'
32
- spec.add_development_dependency 'rake'
33
- spec.add_development_dependency 'rspec'
34
- spec.add_development_dependency 'simplecov'
35
- spec.add_development_dependency 'webmock'
36
- spec.add_development_dependency 'yard'
37
- spec.add_development_dependency 'yardstick'
29
+ spec.add_development_dependency 'bundler', '~> 1.13'
30
+ spec.add_development_dependency 'dotenv', '~> 2.2'
31
+ spec.add_development_dependency 'generator_spec', '~> 0.9'
32
+ spec.add_development_dependency 'rake', '~> 12.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.5'
34
+ spec.add_development_dependency 'simplecov', '~> 0.13'
35
+ spec.add_development_dependency 'webmock', '~> 2.3'
36
+ spec.add_development_dependency 'yard', '~> 0.9'
37
+ spec.add_development_dependency 'yardstick', '~> 0.9'
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasile Zaremba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf
@@ -28,128 +28,128 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.13'
34
34
  type: :development
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: '0'
40
+ version: '1.13'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dotenv
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: generator_spec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '12.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '12.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '3.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '3.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '0.13'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '0.13'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '2.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '2.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: yard
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '0.9'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '0.9'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: yardstick
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '0.9'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '0.9'
153
153
  description: |2
154
154
  This gem contains the tools you need to quickly integrate your Ruby back-end
155
155
  with Yoti, so that your users can share their identity details with your
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 2.5.1
214
+ rubygems_version: 2.6.8
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Yoti Ruby SDK for back-end integration.