metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Allow to use harmonised code and abbreviation for stage without invoking constructor #137

Closed mico closed 1 year ago

mico commented 1 year ago

@mico The point of https://github.com/metanorma/pubid-iso/issues/102 was so that I would not be forced to invoke a separate Stage constructor when initialising the identifier.

It turns out I have to invoke the Stage constructor after all, in order to include harmonized_code. So there was no point removing the Stage constructor after all.

I am closing this ticket, because enough time has been squandered on refactoring the API.

Originally posted by @opoudjis in https://github.com/metanorma/pubid-iso/issues/129#issuecomment-1272545953

So we want to be able to do:

> Pubid::Iso::Identifier.new(number: 200, amendments: [{ :number=>"1", stage: { abbr: :CD, harmonized_code: "30.20" }])

Also only abbreviation or harmonized code could be applied without using hash:

> Pubid::Iso::Identifier.new(number: 200, amendments: [{ :number=>"1", stage: :CD ])
> Pubid::Iso::Identifier.new(number: 200, amendments: [{ :number=>"1", stage: "30.20" ])
opoudjis commented 1 year ago

@ronaldtse wants #130 done instead; the question is how long #130 is going to take. If it is going to take a significant amount of time, this ticket should be done in the interim.

@ronaldtse You decide.

ronaldtse commented 1 year ago

We should do #130 first and then investigate what else is necessary.

mico commented 1 year ago

Already implemented: https://github.com/metanorma/pubid-iso/blob/46516de6756d8bb198e26f41b5e301d2db93c688/spec/pubid_iso/identifier/create_new_identifier_spec.rb#L90-L96