Renaming packages to include other publications and bibliographic manager systems, like JOSS.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-02-28 17:33:08 +00:00 committed by SantiagoBragagnolo
parent 2cc34e0ff3
commit d9854176e9
3 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,17 @@
"
I model the information of the Zotero API. I collaborate with other objects to define repetitive API urls.
"
Class {
#name : #ZoteroAPI,
#superclass : #Object,
#category : #Pubiblio
}
{ #category : #'as yet unclassified' }
ZoteroAPI class >> baseURL [
"I provide the base URL where the API services are provided.
For more information visit:
"
^ 'https://api.zotero.org/'
]

View File

@ -0,0 +1,113 @@
"
I allow to query zotero libraries, given the groupID or the userID that the libraries belong to.
"
Class {
#name : #ZoteroLibrary,
#superclass : #Object,
#instVars : [
'groupID',
'userID'
],
#category : #Pubiblio
}
{ #category : #utility }
ZoteroLibrary >> collectionsURL [
"I provide the common part of the collections URL for the Zotero API"
^ self groupURL, '/collections/'
]
{ #category : #utility }
ZoteroLibrary >> emptyValuesWarning [
self inform: 'WARNING! groupID or userID should be non-emtpy. Please fill them to get available collections'.
^ self
]
{ #category : #querying }
ZoteroLibrary >> generalInfo [
"I return the last 25 the public collections for a particular group or user"
^ NeoJSONReader fromString: (ZnEasy get: self groupURL) contents.
]
{ #category : #accessing }
ZoteroLibrary >> groupID [
^ groupID
]
{ #category : #accessing }
ZoteroLibrary >> groupID: aString [
groupID := aString
]
{ #category : #utility }
ZoteroLibrary >> groupURL [
"I provide the common part of the group URL for the Zotero API"
groupID ifNotNil: [ ^ ZoteroAPI baseURL,'groups/',groupID,'/' ].
userID
ifNotNil: [ ^ ZoteroAPI baseURL,'groups/',userID,'/' ]
ifNil: [ self emptyValuesWarning ]
]
{ #category : #querying }
ZoteroLibrary >> lastCollections [
"I return all the public collections for a particular group or user"
^ NeoJSONReader fromString: (ZnEasy get: self collectionsURL) contents
]
{ #category : #querying }
ZoteroLibrary >> lastItems [
"I return the last 25 items of the public collections for a particular group or user"
^ NeoJSONReader fromString: (ZnEasy get: self groupURL,'items') contents
]
{ #category : #querying }
ZoteroLibrary >> subcollection: keyString [
"I give the general info for a subcollection, given is alphanumeric key"
^ NeoJSONReader fromString: (ZnEasy get: (self subcollectionURL:keyString)) contents.
]
{ #category : #querying }
ZoteroLibrary >> subcollectionAsBibTeX: keyString [
"I give all the items for a subcollection, given is alphanumeric key, excluding notes and attachments, exported as bibtex"
^ (ZnEasy get: (self subcollectionURL: keyString,'/items?itemType=-note || attachment &format=bibtex')) contents utf8Decoded.
]
{ #category : #querying }
ZoteroLibrary >> subcollectionLastItems: keyString [
"I give the last 25 items for a subcollection, given is alphanumeric key, including notes, attachments"
^ NeoJSONReader fromString: (ZnEasy get: (self subcollectionURL: keyString,'/items')) contents.
]
{ #category : #querying }
ZoteroLibrary >> subcollectionLastParentItems: keyString [
"I give all the items for a subcollection, given is alphanumeric key, excluding notes and attachments"
^ NeoJSONReader fromString: (ZnEasy get: (self subcollectionURL:keyString,'/items?itemType=-note || attachment')) contents.
]
{ #category : #utility }
ZoteroLibrary >> subcollectionURL: keyString [
"I provide the common part of the subcollection URL for the Zotero API, given its key string"
^ self collectionsURL,keyString
]
{ #category : #accessing }
ZoteroLibrary >> userID [
^ userID
]
{ #category : #accessing }
ZoteroLibrary >> userID: aString [
userID := aString
]

1
src/Pubiblio/package.st Normal file
View File

@ -0,0 +1 @@
Package { #name : #Pubiblio }