Hello,
I try to make a�� app which displays images from a
external api .
I was hoping I could do it with only 1 json parsing but
to get the right size of images I need more then 1
Right now I have two classes with fromJson methods
Painting class >> fromJSON: json
������ | instance |
������ instance := self new.
������ instance
������ ������ title: (json at: #title);
������ ������ painter: (json at: #principalOrFirstMaker);
������ ������ imageUrl: ((json at: #webImage) at: #url).
������ ^ instance
Paintings class > fromJSON: json
fromJSON: json
������ | instance artObjects |
������ instance := self new.
������ artObjects := json at: #artObjects.
������ artObjects
������ ������ do:
������ ������ ������ [ :eachArtObject | instance addPainting:
(Painting fromJSON: eachArtObject) ].
������ ^ instance
but to get it working right , I have to do it like this
:
Painting class >> fromJSON: json
������ | instance |
������ instance := self new.
������ instance
������ ������ title: (json at: #objectNumber);
���� ^ instance
but the problem is now I need a second call to this url
:��
https://www.rijksmuseum.nl/api/nl/collection/<<objectNumber>/tiles?key=[API_KEY]&format=json
and then need a new imageUrl out of it.
and then have one object with objectNumber and the new url
Also I have to make a call to this url :
https://www.rijksmuseum.nl/api/nl/collection/<<<objectNumber>>?key=[API_KEY]&format=json
and also get some data out of it so that a painting will be one object with the objectNumber, new imageurl
and some data out of the last call
Do I need to make some more object to get this working or is there a way I can change the code I use now
to get things working
Regards,
Roelof