Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-1133: Retrieve the same attribute with different constraints #76

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

emmas-yoti
Copy link
Contributor

@emmas-yoti emmas-yoti commented Nov 29, 2019

Add get_all_attributes_by_name(string):array to return a list of
attributes sharing the same attribute name.

TODO

  • Test on Live

@emmas-yoti emmas-yoti force-pushed the SDK-1133-RetieveSameAttributeWithDiffConstraints branch 2 times, most recently from b58e5f6 to 364d04c Compare November 29, 2019 11:59
Copy link
Contributor

@echarrod echarrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's wait to test on the example project before merging though 👍

Copy link
Contributor

@davidgrayston davidgrayston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a breaking change in here (although it's unlikely anyone would be instantiating a profile themselves)

attr_reader :attributes
def attributes
@attributes.map { |key, value| [key, value[0]] }.to_h
end

#
# @param [Hash{String => Yoti::Attribute}] profile_data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this constructor support both [Hash{String => Array<Yoti::Attribute>}] and [Hash{String => Yoti::Attribute}] for backwards compatibility?

Or perhaps [Hash{String => Yoti::Attribute}] and Array<Yoti::Attribute>? (When a hash is provided, process into @attributes_list Array)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think @attributes can be a Hash of Objects any more? It's always set with a Hash-of-list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait this isn't a constructor.

Copy link
Contributor

@davidgrayston davidgrayston Dec 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant this comment to correspond with line 18

I was thinking you could provide a Array<Yoti::Attribute> and process this into both a [Hash{String => Array<Yoti::Attribute>}] and [Hash{String => Yoti::Attribute}] (for backwards compatibility).

(but you'd also have to support [Hash{String => Yoti::Attribute}] being passed into the constructor as before, so a bit fiddly)

lib/yoti/data_type/base_profile.rb Show resolved Hide resolved
@@ -18,7 +18,7 @@
"#{Yoti::Attribute::AGE_OVER}21" => 'false' }

profile_data = profile_values.map do |name, value|
[name, Yoti::Attribute.new(name, value, {}, {})]
[name, [Yoti::Attribute.new(name, value, {}, {})]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indicates a breaking change (although a low risk one)

@emmas-yoti emmas-yoti force-pushed the SDK-1133-RetieveSameAttributeWithDiffConstraints branch from 364d04c to 5f4ece1 Compare December 4, 2019 16:32
@emmas-yoti emmas-yoti force-pushed the SDK-1133-RetieveSameAttributeWithDiffConstraints branch from 5f4ece1 to f244351 Compare December 4, 2019 16:58
@emmas-yoti emmas-yoti force-pushed the SDK-1133-RetieveSameAttributeWithDiffConstraints branch from c51e6f8 to e047a36 Compare January 15, 2020 13:47
@emmas-yoti emmas-yoti added the WIP label Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants