Releases: BlockScore/blockscore-ruby
Releases · BlockScore/blockscore-ruby
v4.2.0
Fixes
BlockScore::Collection#all
where it previously requested all items in the member resource it nows returns self. This could have lead one to falsely assume something likeperson.question_sets.all
returned a collection that contained question sets belonging to the person. The collection itself is now just tied to the embedded member ids in the parent resource. This could introduce a breaking change for those expectingCollection#all
to behave like QuestionSet#all.- Fixes
BlockScore::Person
to automatically add previously created question set ids to theBlockScore::Person#question_sets
collection
Breaking Changes
BlockScore::Collection#all
returns self and no longer delegates to the member class method.BlockScore::Collection#retrieve
no longer accepts options and returnsBlockScore::Collection::Member
simple delegator around member instanceBlockScore::Collection#create
returnsBlockScore::Collection::Member
simple delegator around instance
Some Improvements
- Attributes in
BlockScore::Base
are lazily loaded when retrieved and maybe refreshed usingBlockScore::Base#refresh
orBlockScore::Collection#refresh
. This allows the QuestionSet id's included in the person attributes to be lazily loaded into a collection. BlockScore::Collection#refresh
reloads the persisted and associated members of the parent, but may leave out or not contain items if parent is not refreshed.BlockScore::Collection#create
will include parent id automatically and add to collection, e.g.person.questions_sets.create
is handles adding theperson_id
and adding the created question set to the collection, which was previously handled byQuestionSet
.- Creation fails if parent is not saved, e.g.
person.question_sets.create
fails ifperson.persisted?
isfalse
. BlockScore::Collection#retrieve
checks parent id and fails if not belonging.BlockScore::Collection#new
adds parent id to new member
Updates retrieve to be lazy
- BlockScore::Actions::Retrieve::ClassMethods#retrieve
Adds methods in Base
- BlockScore::Base#force!
- BlockScore::Base#id
- BlockScore::Base#persisted?
Updates methods in Base
- BlockScore::Base#attributes
- BlockScore::Base#inspect
- BlockScore::Base#initialize
Updates Collection with Actions
- BlockScore::Collection#all
- BlockScore::Collection#new
- BlockScore::Collection#refresh
- BlockScore::Collection#create
- BlockScore::Collection#retrieve
- BlockScore::Collection#parent
- BlockScore::Collection#parent_name