Starting TwitterAPIReponse.
This commit is contained in:
parent
23fa2a12f5
commit
b87c834a7e
@ -0,0 +1,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 should be YYYY-MM-DD."
|
||||||
|
| commonQueryParameters |
|
||||||
|
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username&max_results=100'.
|
||||||
|
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters
|
@ -1,7 +1,5 @@
|
|||||||
accessing
|
accessing
|
||||||
userMentionsFor: username
|
userMentionsFor: username
|
||||||
| rawResponse queryURL |
|
| rawResponse queryURL |
|
||||||
"The following query gets the last tweets, that is the maximun allowed for a particular user without pagination:"
|
"The following query gets the last 100 mentions that is the maximun allowed for a particular user without pagination:"
|
||||||
queryURL := self usersBaseEndPoint, (self userIDFrom: username), '/mentions', self defaultQueryParameters.
|
^ self userQueryFor: username selecting: 'mentions'
|
||||||
rawResponse := self rawResponseForURL:queryURL.
|
|
||||||
^ (STONJSON fromString: rawResponse)
|
|
@ -0,0 +1,7 @@
|
|||||||
|
accessing
|
||||||
|
userQueryFor: username selecting: tweetsOrMentions
|
||||||
|
| rawResponse queryURL |
|
||||||
|
"The following query gets the last 100 tweets or mentions that is the maximun allowed for a particular user without pagination:"
|
||||||
|
queryURL := self userEndPointFor: username selecting: tweetsOrMentions.
|
||||||
|
rawResponse := self rawResponseForURL:queryURL.
|
||||||
|
^ TwitterAPIResponse new fromDictionary: (STONJSON fromString: rawResponse)
|
@ -1,7 +1,4 @@
|
|||||||
accessing
|
accessing
|
||||||
userTweetsFrom: username
|
userTweetsFrom: username
|
||||||
| rawResponse queryURL |
|
|
||||||
"The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:"
|
"The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:"
|
||||||
queryURL := self usersBaseEndPoint, (self userIDFrom: username), '/tweets', self defaultQueryParameters at: 'tweets'.
|
^ self userQueryFor: username selecting: 'tweets'
|
||||||
rawResponse := self rawResponseForURL:queryURL.
|
|
||||||
^ (STONJSON fromString: rawResponse)
|
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
data: anObject
|
||||||
|
data := anObject
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
data
|
||||||
|
^ data
|
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
fromDictionary: aDictionary
|
||||||
|
data := aDictionary at: 'data'.
|
||||||
|
includes := aDictionary at: 'includes'.
|
||||||
|
meta := aDictionary at: 'meta'.
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
includes: anObject
|
||||||
|
includes := anObject
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
includes
|
||||||
|
^ includes
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
meta: anObject
|
||||||
|
meta := anObject
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
meta
|
||||||
|
^ meta
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
nextToken
|
||||||
|
^ self meta at: 'next_token'
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
nextTokenPreview
|
||||||
|
^ (self nextToken copyFrom: 1 to: 7), '...'
|
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: '( size: ', self data size asString, ' | next token: ', self nextTokenPreview, ' )'
|
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Datanalitica-Datanalitica",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"data",
|
||||||
|
"includes",
|
||||||
|
"meta"
|
||||||
|
],
|
||||||
|
"name" : "TwitterAPIResponse",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user