Twitter user now includes tweets. Improvements on data collection and presentation.
This commit is contained in:
parent
e045592827
commit
907deb5752
@ -1,12 +0,0 @@
|
||||
accessing
|
||||
gtUsersMentioning: userName On: aView
|
||||
<gtView>
|
||||
^ aView columnedList
|
||||
title: 'Users mentioning @',userName translated;
|
||||
priority: 5;
|
||||
items: [ self usersMentioning: userName ];
|
||||
column: 'Imagen'
|
||||
icon: [ :aTwitterUser | aTwitterUser profileImage asElement asScalableElement size: 32 @ 32 ]
|
||||
width: 75;
|
||||
column: 'User Name' text: [ :aTwitterUser | aTwitterUser userName ];
|
||||
column: 'Name' text: [ :aTwitterUser | aTwitterUser name ]
|
@ -2,6 +2,7 @@ accessing
|
||||
userEndPointFor: username selecting: tweetsOrMentions
|
||||
"I build a shared URL for querying last 100 mentions or tweets for a particular user.
|
||||
Second parameter should be only 'tweets' or 'mentions', dateString, if present, should be YYYY-MM-DD."
|
||||
| commonQueryParameters |
|
||||
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username,name,profile_image_url&max_results=100'.
|
||||
| commonQueryParameters userFields |
|
||||
userFields := 'user.fields=username,name,description,profile_image_url'.
|
||||
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&', userFields, '&max_results=100'.
|
||||
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters
|
@ -0,0 +1,5 @@
|
||||
accessing
|
||||
usersGroupMentioning: userName
|
||||
^ TwitterUsersGroup new
|
||||
users: (self usersMentioning: userName);
|
||||
title: 'Users mentioning @', userName
|
@ -1,6 +1,12 @@
|
||||
accessing
|
||||
messagesAuthors
|
||||
| groupedTweets |
|
||||
self includes at: 'users' ifAbsent: [ ^ nil ].
|
||||
^ (self includes at: 'users') collect: [:userDict |
|
||||
TwitterUser new fromDictionary: userDict
|
||||
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.
|
||||
]
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
description
|
||||
^ description
|
@ -3,4 +3,5 @@ fromDictionary: userDict
|
||||
id := userDict at: 'id'.
|
||||
name := userDict at: 'name'.
|
||||
userName := userDict at: 'username'.
|
||||
profileImageUrl := userDict at: 'profile_image_url'.
|
||||
profileImageUrl := userDict at: 'profile_image_url'.
|
||||
description := userDict at: 'description'.
|
@ -9,6 +9,7 @@ gtViewContactDetailsOn: aView
|
||||
details := String streamContents: [:aStream |
|
||||
aStream nextPutAll: self name.
|
||||
aStream cr.
|
||||
aStream nextPutAll: self description.
|
||||
].
|
||||
|
||||
container := BlElement new
|
||||
|
3
Datanalitica.package/TwitterUser.class/instance/id.st
Normal file
3
Datanalitica.package/TwitterUser.class/instance/id.st
Normal file
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
id
|
||||
^ id
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
metrics: aDictionary
|
||||
metrics := aDictionary
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
metrics
|
||||
^ metrics ifNil: [ metrics := Dictionary new]
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
tweets: aTweetsCollection
|
||||
tweets := aTweetsCollection
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
tweets
|
||||
^ tweets ifNil: [ tweets := OrderedCollection new]
|
@ -9,7 +9,10 @@
|
||||
"id",
|
||||
"name",
|
||||
"userName",
|
||||
"profileImageUrl"
|
||||
"profileImageUrl",
|
||||
"description",
|
||||
"metrics",
|
||||
"tweets"
|
||||
],
|
||||
"name" : "TwitterUser",
|
||||
"type" : "normal"
|
||||
|
@ -0,0 +1,13 @@
|
||||
accessing
|
||||
gtTwitterUsersGroupOn: aView
|
||||
<gtView>
|
||||
^ aView columnedList
|
||||
title: self title translated;
|
||||
priority: 5;
|
||||
items: [ self users ];
|
||||
column: 'Imagen'
|
||||
icon: [ :aTwitterUser | aTwitterUser profileImage asElement asScalableElement size: 32 @ 32 ]
|
||||
width: 75;
|
||||
column: 'User Name' text: [ :aTwitterUser | '@', aTwitterUser userName ];
|
||||
column: 'Name' text: [ :aTwitterUser | aTwitterUser name ];
|
||||
column: 'Mentions' text: [ :aTwitterUser | aTwitterUser tweets size asString ]
|
@ -1,12 +0,0 @@
|
||||
accessing
|
||||
gtUsersMentioningOn: aView
|
||||
<gtView>
|
||||
^ aView columnedList
|
||||
title: self title translated;
|
||||
priority: 5;
|
||||
items: [ self users ];
|
||||
column: 'Imagen'
|
||||
icon: [ :aTwitterUser | aTwitterUser profileImage asElement asScalableElement size: 32 @ 32 ]
|
||||
width: 75;
|
||||
column: 'User Name' text: [ :aTwitterUser | aTwitterUser userName ];
|
||||
column: 'Name' text: [ :aTwitterUser | aTwitterUser name ]
|
Loading…
Reference in New Issue
Block a user