GrafoscopioUtils/repository/Grafoscopio-Utils/Airtable.class.st

43 lines
687 B
Smalltalk
Raw Normal View History

2021-10-19 00:01:35 +00:00
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'
]