Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent Occurrences Endpoint #5

Closed
Vanethos opened this issue Aug 14, 2019 · 0 comments · Fixed by #62
Closed

Recent Occurrences Endpoint #5

Vanethos opened this issue Aug 14, 2019 · 0 comments · Fixed by #62
Assignees

Comments

@Vanethos
Copy link
Contributor

Description
Create all the classes and functions needed to access the GET endpoint {{base_url}}/occurrences

File Location

- data
|__ remote
- domain
|_ mamagers

Requirements

  • A endpoints class where the endpoint is declared must be created
  • A services class where the mapping from Response to Occurence must be created

This endpoint must expose the following query parameters to be used:

  • page[number]
  • page[size]
  • search
  • exact
  • events
  • types
  • statuses:
  • districts
  • counties
  • parishes
  • sort
  • order

The following methods must be exposed in an abstracted class called OccurrencesManager:

  • Search for the most recent occurences - including pagination, with filter options
  • Search for a list of occurrences given an id - with filter options

Example Response

{
    "links": {
        "first": "https://api.vost.pt/v1/occurrences?page=1",
        "last": "https://api.vost.pt/v1/occurrences?page=42751",
        "next": "https://api.vost.pt/v1/occurrences?page=2"
    },
    "data": [
        {
            "type": "occurrences",
            "id": "42751",
            "attributes": {
                "locality": "Ervedosa do Douro",
                "latitude": 41.16918811,
                "longitude": -7.49500763,
                "started_at": "2019-08-10 14:23:00",
                "ended_at": null,
                "created_at": "2019-08-10 15:05:02",
                "updated_at": "2019-08-10 15:05:02"
            },
            "relationships": {
                "type": {
                    "data": {
                        "type": "occurrence_types",
                        "id": "108"
                    }
                },
                "status": {
                    "data": {
                        "type": "occurrence_statuses",
                        "id": "5"
                    }
                },
                "parish": {
                    "data": {
                        "type": "parishes",
                        "id": "2759"
                    }
                }
            },
            "links": {
                "self": "https://api.vost.pt/v1/occurrences/42751"
            }
        }
    ],
    "included": [
        {
            "type": "occurrence_types",
            "id": "108",
            "attributes": {
                "code": 4305,
                "name": "Limpeza de Via e Sinalização de Perigo",
                "created_at": "2019-07-02 13:31:19",
                "updated_at": "2019-07-02 13:31:19"
            }
        },
        {
            "type": "occurrence_statuses",
            "id": "5",
            "attributes": {
                "code": 5,
                "name": "Em Curso",
                "created_at": "2019-07-02 13:31:18",
                "updated_at": "2019-07-02 13:31:18"
            }
        },
        {
            "type": "parishes",
            "id": "2759",
            "attributes": {
                "code": "181502",
                "name": "ERVEDOSA DO DOURO",
                "created_at": "2019-07-02 13:31:16",
                "updated_at": "2019-07-02 13:31:16"
            },
            "links": {
                "self": "https://api.vost.pt/v1/parishes/2759"
            }
        }
    ],
    "meta": {
        "items": 1,
        "total": 42751
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants