From 2b751b60ed036ddf2f8927c66b027ea7c8ea7615 Mon Sep 17 00:00:00 2001 From: Ruidajo Date: Mon, 18 Oct 2021 19:01:35 -0500 Subject: [PATCH] Reimplementing airtable minimal api. --- .../Grafoscopio-Utils/Airtable.class.st | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 repository/Grafoscopio-Utils/Airtable.class.st diff --git a/repository/Grafoscopio-Utils/Airtable.class.st b/repository/Grafoscopio-Utils/Airtable.class.st new file mode 100644 index 0000000..19bcfa3 --- /dev/null +++ b/repository/Grafoscopio-Utils/Airtable.class.st @@ -0,0 +1,42 @@ +Class { + #name : #Airtable, + #superclass : #Object, + #instVars : [ + 'id', + 'apiKey' + ], + #category : #'Grafoscopio-Utils-Grafoscopio-Utils' +} + +{ #category : #accessing } +Airtable >> apiKey [ + ^ apiKey +] + +{ #category : #accessing } +Airtable >> apiKey: anString [ + apiKey := anString +] + +{ #category : #accessing } +Airtable >> id [ + ^ id +] + +{ #category : #accessing } +Airtable >> id: idString [ + id := idString +] + +{ #category : #accessing } +Airtable >> rawRecords [ + ^ ZnClient new + url: (self id); + headerAt: 'Authorization' put: 'Bearer ', (self apiKey); + get. +] + +{ #category : #accessing } +Airtable >> records [ + ^ (NeoJSONReader fromString: self rawRecords contents) at: 'records' +]