Imagine JSON response with an attribute set to nil --> previous code did not allow to modify this attribute in the HyperResource object due to failing method missing call
--> fixed + added test case
Second case: href already set
I encountered this while trying to build a new Hyperresource object from scratch (idea is to mimick Hyperresource::MyObject.new call, populate it with Form field data & then post it to the server)
First case: attribute-setter
Imagine JSON response with an attribute set to nil --> previous code did not allow to modify this attribute in the HyperResource object due to failing method missing call
--> fixed + added test case
Second case: href already set
I encountered this while trying to build a new Hyperresource object from scratch (idea is to mimick Hyperresource::MyObject.new call, populate it with Form field data & then post it to the server)
pseudo code:
my_client = HyperResource.new(root: http://whatever/api) my_client.new_from(resource: my_client, href: 'koekoek', body: {'_data_type' => 'MyObject','koekoek' => nil, 'blabla' => nil})
This will:
The current code overwrites the existing href with nil as no self ref is present in body The provided solution avoids this