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 [
|
2021-10-19 01:23:18 +00:00
|
|
|
| recordsTemp |
|
|
|
|
recordsTemp := (NeoJSONReader fromString: self rawRecords contents) at: 'records'.
|
|
|
|
^ recordsTemp collect: [ :recordsDict |
|
|
|
|
AirtableRecord new
|
|
|
|
id: (recordsDict at: 'id');
|
|
|
|
createdTime: (recordsDict at: 'createdTime');
|
|
|
|
fields: (recordsDict at: 'fields')
|
|
|
|
]
|
|
|
|
|
2021-10-19 00:01:35 +00:00
|
|
|
]
|