Reimplementing airtable minimal api.

This commit is contained in:
Ruidajo 2021-10-18 19:01:35 -05:00
parent 8b7f2047b7
commit 2b751b60ed

View File

@ -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'
]