yoti 1.0.3 → 1.1.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: f94e5f9c2f83cc70f4bf1a18188e27acb47f61cb
4
- data.tar.gz: d4f76df114cd63accfe3d28da9f3895b498ba709
3
+ metadata.gz: 687ddf7f2ce726749774b2cbbd5bbe97419d9df5
4
+ data.tar.gz: 8f8cdefad48fd070ac6c0dbe7fc5994f4a8878fb
5
5
  SHA512:
6
- metadata.gz: 9e5775c842fa28100fcd88a2f1a8383211bbcbbb4c060f2aeffe1624be53e219f85be045e4e7dcf3fbb9b707af18119db9a97cf4b2d4321ce304b9b7b994e5a4
7
- data.tar.gz: 664c852640e703f8ec8431027e7a9bcdf6aa010df409065a8e0eed19b3f7c3a8b7f107e22563274a48f54b76ac23022b25018dfa9a00d8ef86f5a3c700c7fdaa
6
+ metadata.gz: 603439330c7f7298590d4d3b1f1a8b7bdd6ec6756876729ac5fb9e02522bfe141cbfc12e7dc7afda4ffb5283771036e63127ddb8a9c89ef5324c2394df08ab32
7
+ data.tar.gz: 2cd356bf349ae241461f949f3214fe698a84aebfbc871fd7bcb76d0e75c2381bdff7a83ec358c548b1e00dea794fb4bc700bc28f14fb02d162f3850011d5379c
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ 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.1.0 - 2017-10-24
8
+ ### Changed
9
+ - `user_profile['selfie']` will return image data instead of an image URI
10
+
11
+ ### Added
12
+ - `user_profile.base64_selfie_uri` helper returns the base64 selfie URI
13
+
7
14
  ## 1.0.3 - 2017-10-17
8
15
  ### Changed
9
16
  - Switched from proprietary to MIT license
data/CONTRIBUTING.md CHANGED
@@ -74,12 +74,6 @@ $ bundle exec rake measurement
74
74
 
75
75
  Verifies the documentation with [Yardstick][] and generates the `measurement/report.txt` file, containing tips on how to improve the documentation coverage.
76
76
 
77
- ```shell
78
- $ bundle exec rake verify_measurements
79
- ```
80
-
81
- Verifies that the [Yardstick][] coverage matches the one set in the [Rakefile](Rakefile).
82
-
83
77
  ```shell
84
78
  $ bundle exec rake yard
85
79
  ```
data/README.md CHANGED
@@ -214,7 +214,7 @@ Where `your_user_search_function` is a piece of logic in your app that is suppos
214
214
  ## Running the examples
215
215
 
216
216
  The examples can be found in the [examples folder](examples).
217
- For them to work you will need a working callback URL that your browser can redirect to. A good way of doing this is to use [ngrok][] to expose the local development URL. The callback URL for both examples will be: `http://your-local-url.domain/profile`.
217
+ For them to work you will need a working callback URL that your browser can redirect to. The callback URL for both examples will be: `http://your-local-url.domain/profile`.
218
218
 
219
219
  The examples also use the `YOTI_APPLICATION_ID` environment variable to display the Yoti Connect button. This value can be found in your Yoti account, on the *Keys* settings page.
220
220
 
@@ -234,14 +234,12 @@ Visiting the `http://your-local-url.domain` should show a Yoti Connect button
234
234
 
235
235
  Visiting the `http://your-local-url.domain` should show a Yoti Connect button
236
236
 
237
- [ngrok]: https://ngrok.com/
238
-
239
237
  ## API coverage
240
238
 
241
239
  * Activity Details
242
240
  * [X] User ID `user_id`
243
241
  * [X] Profile
244
- * [X] Photo `selfie`
242
+ * [X] Selfie `selfie`
245
243
  * [X] Given Names `given_names`
246
244
  * [X] Family Name `family_name`
247
245
  * [X] Mobile Number `phone_number`
@@ -250,6 +248,7 @@ Visiting the `http://your-local-url.domain` should show a Yoti Connect button
250
248
  * [X] Address `postal_address`
251
249
  * [X] Gender `gender`
252
250
  * [X] Nationality `nationality`
251
+ * [X] Base64 Selfie URI `base64_selfie_uri`
253
252
 
254
253
  ## Support
255
254
 
data/Rakefile CHANGED
@@ -34,11 +34,6 @@ Yardstick::Rake::Measurement.new(:measurement, yardstick_options) do |measuremen
34
34
  measurement.output = 'measurement/report.txt'
35
35
  end
36
36
 
37
- require 'yardstick/rake/verify'
38
- Yardstick::Rake::Verify.new(:verify_measurements, yardstick_options) do |verify|
39
- verify.threshold = 89.0
40
- end
41
-
42
37
  ################################
43
38
  # Defaults #
44
39
  ################################
@@ -12,6 +12,9 @@ module Yoti
12
12
  # @return [Hash] the decoded profile attributes
13
13
  attr_reader :user_profile
14
14
 
15
+ # @return [String] the selfie in base64 format
16
+ attr_reader :base64_selfie_uri
17
+
15
18
  # @param receipt [Hash] the receipt from the API request
16
19
  # @param decrypted_profile [Object] Protobuf AttributeList decrypted object containing the profile attributes
17
20
  def initialize(receipt, decrypted_profile = nil)
@@ -21,6 +24,10 @@ module Yoti
21
24
  if !@decrypted_profile.nil? && @decrypted_profile.respond_to_has_and_present?(:attributes)
22
25
  @decrypted_profile.attributes.each do |field|
23
26
  @user_profile[field.name] = Yoti::Protobuf.value_based_on_content_type(field.value, field.content_type)
27
+
28
+ if field.name == 'selfie'
29
+ @base64_selfie_uri = Yoti::Protobuf.image_uri_based_on_content_type(field.value, field.content_type)
30
+ end
24
31
  end
25
32
  end
26
33
 
@@ -29,17 +29,22 @@ module Yoti
29
29
  raise ProtobufError, 'The content type is invalid.'
30
30
  when CT_STRING
31
31
  value.encode('utf-8')
32
- when CT_JPEG
33
- 'data:image/jpeg;base64,'.concat(Base64.strict_encode64(value))
34
32
  when CT_DATE
35
33
  value.encode('utf-8')
36
- when CT_PNG
37
- 'data:image/png;base64,'.concat(Base64.strict_encode64(value))
38
34
  else
39
35
  value
40
36
  end
41
37
  end
42
38
 
39
+ def image_uri_based_on_content_type(value, content_type = nil)
40
+ case content_type
41
+ when CT_JPEG
42
+ 'data:image/jpeg;base64,'.concat(Base64.strict_encode64(value))
43
+ when CT_PNG
44
+ 'data:image/png;base64,'.concat(Base64.strict_encode64(value))
45
+ end
46
+ end
47
+
43
48
  private
44
49
 
45
50
  def valid_receipt?(receipt)
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.3'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  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.3
4
+ version: 1.1.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-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf