[Pharo-users] what did I do wrong here

Roelof Wobben r.wobben at home.nl
Mon Feb 25 15:52:30 EST 2019


An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190225/3b129584/attachment.html>
-------------- next part --------------
Object subclass: #Painting
	instanceVariableNames: 'title painter imageUrl'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Paintings'!

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
painter
	^ painter! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
title: anObject
	title := anObject! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:17'!
imageUrl: anObject
	imageUrl := anObject! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:17'!
imageUrl
	^ imageUrl! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
title
	^ title! !

!Painting methodsFor: 'accessing' stamp: 'RoelofWobben 2/25/2019 20:09'!
painter: anObject
	painter := anObject! !


!Painting methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 20:10'!
fromJSON: json
    | instance |
    instance := self new.
    instance
        title: (json at: 'title');
        painter: (json at: 'principalOrFirstMaker');
        imageUrl: ((json at: 'webImage') at: 'url').
    ^ instance
 ! !



Object subclass: #Paintings
	instanceVariableNames: 'paintings'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Paintings'!

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 20:29'!
addPainting: aPainting
    paintings  add: aPainting. 
! !

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 20:12'!
fromJSON: json
    | instance artObjects |
    instance := self new.
    artObjects := json at: #artObjects.
    artObjects
        do: [ :eachArtObject | instance addPainting: (Painting fromJSON: eachArtObject) ].
    ^ instance! !

!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 2/25/2019 20:15'!
initialize 
    super initialize. 
    paintings := OrderedCollection new. 
! !


More information about the Pharo-users mailing list