Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Metacello new
Dependencies are:

* [XMLParser](https://github.com/pharo-contributions/XML-XMLParser)
* [NeoJSON](https://github.com/svenvc/NeoJSON)
3 changes: 3 additions & 0 deletions src/BaselineOfOWS/BaselineOfOWS.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ BaselineOfOWS >> dependencies: spec [

spec baseline: 'XMLParser' with: [
spec repository: 'github://pharo-contributions/XML-XMLParser/src' ].

spec baseline: 'NeoJSON' with: [
spec repository: 'github://svenvc/NeoJSON/repository' ].
]
58 changes: 58 additions & 0 deletions src/OWS-Tests/OWSAPIProcessesTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Class {
#name : #OWSAPIProcessesTest,
#superclass : #TestCase,
#instVars : [
'api'
],
#category : #'OWS-Tests'
}

{ #category : #running }
OWSAPIProcessesTest >> setUp [
super setUp.

api := OWSAPIProcesses new.
api url: 'https://demo.pygeoapi.io/master/'.
]

{ #category : #tests }
OWSAPIProcessesTest >> testConformance [

| json |

json := api conformance.
self assert: (json isCollection).
]

{ #category : #tests }
OWSAPIProcessesTest >> testJobs [

| json |

json := api jobs.
self assert: (json isCollection).
]

{ #category : #tests }
OWSAPIProcessesTest >> testLandingPage [

| json |

json := api landingpage.

self assert: (json includesKey: 'links').
self assert: (json includesKey: 'description').
self assert: (json includesKey: 'title').
]

{ #category : #tests }
OWSAPIProcessesTest >> testProcesses [

| json |

json := api processes.
self assert: json size equals: 6.

json := api process: 'hello-world'.
self assert: (json at: 'id') equals: 'hello-world'.
]
33 changes: 33 additions & 0 deletions src/OWS/OWSAPI.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Class {
#name : #OWSAPI,
#superclass : #Object,
#instVars : [
'url',
'client'
],
#category : #'OWS-API'
}

{ #category : #accessing }
OWSAPI >> client [
client ifNil:[client := ZnClient new].
^ client
]

{ #category : #accessing }
OWSAPI >> client: anObject [

client := anObject
]

{ #category : #accessing }
OWSAPI >> url [

^ url ifNil: [ url := 'localhost' ]
]

{ #category : #accessing }
OWSAPI >> url: anObject [

url := anObject
]
76 changes: 76 additions & 0 deletions src/OWS/OWSAPIProcesses.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Class {
#name : #OWSAPIProcesses,
#superclass : #OWSAPI,
#category : #'OWS-API'
}

{ #category : #'as yet unclassified' }
OWSAPIProcesses >> conformance [

| params json |
params := '/conformance?f=json'.
json := self client get: self url, params.
^ (NeoJSONReader fromString: json) at: 'conformsTo'
]

{ #category : #accessing }
OWSAPIProcesses >> job: id [

| params json |
params := '/jobs/', id, '?f=json'.
json := self client get: self url, params.
^ NeoJSONReader fromString: json
]

{ #category : #'as yet unclassified' }
OWSAPIProcesses >> jobs [

| params json |
params := '/jobs?f=json'.
json := self client get: self url, params.
^ (NeoJSONReader fromString: json) at: 'jobs'
]

{ #category : #'as yet unclassified' }
OWSAPIProcesses >> landingpage [

| json |
json := self client get: self url, '?f=json'.
^ NeoJSONReader fromString: json
]

{ #category : #accessing }
OWSAPIProcesses >> process: id [

| params json |
params := '/processes/', id, '?f=json'.
json := self client get: self url, params.
^ NeoJSONReader fromString: json
]

{ #category : #private }
OWSAPIProcesses >> process: id params: aJsonDict [

| params json entity res |
params := '/processes/', id, '/execution?f=json'.
json := NeoJSONWriter toString: aJsonDict.

entity := ZnEntity text: json.
entity contentType: ZnMimeType applicationJson.

res := self client
url: self url, params;
entity: entity;
post.

^ NeoJSONReader fromString: res
]

{ #category : #private }
OWSAPIProcesses >> processes [

| params json |
params := '/processes?f=json'.
json := self client get: self url, params.
^ (NeoJSONReader fromString: json) at: 'processes'
]