Socialmetrica/Datanalitica.package/TwitterAPIResponse.class/instance/messagesAuthors.st

12 lines
407 B
Smalltalk

accessing
messagesAuthors
| groupedTweets |
self includes at: 'users' ifAbsent: [ ^ nil ].
groupedTweets := self data groupedBy: [:each | each at: 'author_id' ].
^ (self includes at: 'users') collect: [:userDict | | user |
user := TwitterUser new fromDictionary: userDict.
(groupedTweets at: (user id)) do: [:tweetDict |
user tweets add: (Tweet new fromDictionary: tweetDict)
].
user.
]