Skip to content

Instantly share code, notes, and snippets.

@rsbohn
Created May 30, 2024 23:39
Show Gist options
  • Save rsbohn/720de8f21fbb8c6a8dd6a3ee08294878 to your computer and use it in GitHub Desktop.
Save rsbohn/720de8f21fbb8c6a8dd6a3ee08294878 to your computer and use it in GitHub Desktop.
Parks on the Air API explorer
'From Pharo11.0.0 of 7 March 2024 [Build information: Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)] on 30 May 2024 at 5:33:50.506 pm'!
Object subclass: #SpotList
instanceVariableNames: 'rawData'
classVariableNames: ''
package: 'ParksOnTheAir'!
!SpotList methodsFor: 'accessing' stamp: 'dexter 5/29/2024 15:39'!
rawData: spots
rawData := spots! !
!SpotList methodsFor: 'accessing' stamp: 'dexter 5/29/2024 15:53'!
spots
^ rawData collect: [:each | PotaActivator new rawData: each]! !
!SpotList methodsFor: 'accessing' stamp: 'dexter 5/29/2024 15:58'!
gtSpotsFor: aView
<gtView>
^ aView columnedList
title: 'Spots';
priority: 10;
items: [self spots];
column: 'activator' text: [:each | each at: 'activator'];
column: 'mode' text: [:each | each at: 'mode'];
column: 'location' text: [:each | each at: 'name']! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SpotList class
instanceVariableNames: ''!
!SpotList class methodsFor: 'accessing' stamp: 'dexter 5/30/2024 17:33'!
endpoint
^ 'https://api.pota.app/spot'! !
!SpotList class methodsFor: 'accessing' stamp: 'dexter 5/30/2024 17:33'!
live
| k spots |
k := ZnClient new get: (self endpoint).
spots := STON fromString: k.
^ self new rawData: spots! !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment