Starting NitterInstance modelling.
This commit is contained in:
parent
27a8a66dd3
commit
abc2752292
@ -1,3 +0,0 @@
|
||||
accessing
|
||||
columnKeys
|
||||
^ #('url' 'healthy' 'healthy_percentage_overall' 'rss' 'version')
|
@ -0,0 +1,8 @@
|
||||
accessing
|
||||
columnsDictionary
|
||||
^ {
|
||||
'url' -> 'url' .
|
||||
'healthy' -> 'healthy'.
|
||||
'healthy_percentage_overall' -> 'uptime' .
|
||||
'rss' -> 'rss' .
|
||||
'version' -> 'version'} asDictionary
|
@ -1,7 +1,8 @@
|
||||
accessing
|
||||
instanceRows
|
||||
^ (self instances at: 'hosts') collect: [:rawRow | | newRow |
|
||||
newRow := OrderedCollection new.
|
||||
self columnKeys do: [:key | newRow add: (rawRow at: key) ].
|
||||
newRow := NitterInstance new.
|
||||
self columnsDictionary keysAndValuesDo: [:key :value |
|
||||
newRow writeSlotNamed: value value: (rawRow at: key) ].
|
||||
newRow
|
||||
].
|
@ -1,4 +1,3 @@
|
||||
accessing
|
||||
instances
|
||||
|
||||
^ STONJSON fromString: 'https://status.d420.de/api/v1/instances' asUrl retrieveContents
|
||||
^ self instancesCache
|
@ -0,0 +1,9 @@
|
||||
accessing
|
||||
instancesCache
|
||||
| cache cacheFile |
|
||||
cacheFile := FileLocator temp / 'nitter-instances.ston'.
|
||||
cacheFile exists
|
||||
ifFalse: [
|
||||
cache := STON fromString: 'https://status.d420.de/api/v1/instances' asUrl retrieveContents.
|
||||
MarkupFile exportAsFileOn: cacheFile containing: cache ].
|
||||
^ STON fromString: cacheFile contents
|
@ -11,6 +11,6 @@ viewInstancesFor: aView
|
||||
columnNames doWithIndex: [:aName :index |
|
||||
columnedList
|
||||
column: aName
|
||||
text: [:instanceRow | (instanceRow at: index) ifNil: [''] ]
|
||||
text: [:instanceRow | (instanceRow slots at: index) ifNil: [''] ]
|
||||
].
|
||||
^ columnedList
|
@ -0,0 +1,5 @@
|
||||
accessing
|
||||
printOn: aStream
|
||||
super printOn: aStream.
|
||||
^ aStream
|
||||
nextPutAll: '( ', self url ,' | uptime: ', self uptime asString, ' )'
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
uptime
|
||||
^ uptime
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
url
|
||||
^ url
|
17
Socialmetrica.package/NitterInstance.class/properties.json
Normal file
17
Socialmetrica.package/NitterInstance.class/properties.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"commentStamp" : "",
|
||||
"super" : "Object",
|
||||
"category" : "Socialmetrica",
|
||||
"classinstvars" : [ ],
|
||||
"pools" : [ ],
|
||||
"classvars" : [ ],
|
||||
"instvars" : [
|
||||
"url",
|
||||
"healthy",
|
||||
"uptime",
|
||||
"rss",
|
||||
"version"
|
||||
],
|
||||
"name" : "NitterInstance",
|
||||
"type" : "normal"
|
||||
}
|
Loading…
Reference in New Issue
Block a user