From 0d24cc738f3860397733d1191d20953fbe7b34db Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 3 Sep 2021 10:12:07 -0500 Subject: [PATCH] Improving API keys loading. --- Datanalitica.package/TwitterAPI.class/class/apiKeysFile..st | 3 +++ Datanalitica.package/TwitterAPI.class/class/apiKeysFile.st | 5 +++++ Datanalitica.package/TwitterAPI.class/class/loadKeys.st | 4 ++-- Datanalitica.package/TwitterAPI.class/properties.json | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Datanalitica.package/TwitterAPI.class/class/apiKeysFile..st create mode 100644 Datanalitica.package/TwitterAPI.class/class/apiKeysFile.st diff --git a/Datanalitica.package/TwitterAPI.class/class/apiKeysFile..st b/Datanalitica.package/TwitterAPI.class/class/apiKeysFile..st new file mode 100644 index 0000000..59a8da7 --- /dev/null +++ b/Datanalitica.package/TwitterAPI.class/class/apiKeysFile..st @@ -0,0 +1,3 @@ +accessing +apiKeysFile: aFileReference + apiKeysFile := aFileReference \ No newline at end of file diff --git a/Datanalitica.package/TwitterAPI.class/class/apiKeysFile.st b/Datanalitica.package/TwitterAPI.class/class/apiKeysFile.st new file mode 100644 index 0000000..cf4eb03 --- /dev/null +++ b/Datanalitica.package/TwitterAPI.class/class/apiKeysFile.st @@ -0,0 +1,5 @@ +accessing +apiKeysFile + "Return the defined apiKeysFile or assign a default location following the Linux Standard + File Hierarchy, which is relatively portable to other Operative Systems." + ^ apiKeysFile ifNil: [ apiKeysFile := FileLocator home / '.config/Datanalitica/twitter-api-keys.json' ] \ No newline at end of file diff --git a/Datanalitica.package/TwitterAPI.class/class/loadKeys.st b/Datanalitica.package/TwitterAPI.class/class/loadKeys.st index 63657c6..fd5fcbb 100644 --- a/Datanalitica.package/TwitterAPI.class/class/loadKeys.st +++ b/Datanalitica.package/TwitterAPI.class/class/loadKeys.st @@ -1,4 +1,4 @@ accessing loadKeys - keys := STONJSON fromString: FileLocator home / '.config/Datanalitica/twitter-api-keys.json' contents. - ^ self keys \ No newline at end of file + keys := STONJSON fromString: self apiKeysFile contents. + ^ self \ No newline at end of file diff --git a/Datanalitica.package/TwitterAPI.class/properties.json b/Datanalitica.package/TwitterAPI.class/properties.json index 38e35df..11ac87e 100644 --- a/Datanalitica.package/TwitterAPI.class/properties.json +++ b/Datanalitica.package/TwitterAPI.class/properties.json @@ -5,6 +5,7 @@ "classinstvars" : [ ], "pools" : [ ], "classvars" : [ + "apiKeysFile", "keys" ], "instvars" : [