Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jvicentem committed Feb 15, 2020
2 parents d643de2 + 33d9d5a commit bc3eacc
Show file tree
Hide file tree
Showing 18 changed files with 1,301 additions and 836 deletions.
530 changes: 283 additions & 247 deletions citram_api/api/lines/lines.py

Large diffs are not rendered by default.

112 changes: 64 additions & 48 deletions citram_api/api/offices/offices.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,65 @@ def get_offices_by_type(offices_type):
"""
Returns all the offices of the specified type.
Example: get_offices_by_type(OfficeTypes.OFICINA.value)
Example:
.. code-block:: python
get_offices_by_type(OfficeTypes.OFICINA.value)
:param str offices_type: Office type. Use constants.OfficeTypes to choose the available types easily.
:return dict: A dictionary with a list of offices of the specified type.
{
'offices': {
'Office': [{
'codOffice': '01_000015',
'name': 'Oficina de Gestión del Consorcio Regional de Transportes de Madrid',
'address': 'Plaza Descubridor Diego de Ordás, 3. 28003 Madrid',
'openTime': 'Horario de atención al público: Lunes a Viernes de 8 a 20 h',
'coordinates': {
'longitude': -3.700064,
'latitude': 40.44086
},
'type': 'gestion'
}, {
'codOffice': '01_000020',
'name': 'Oficina de Gestión de Moncloa',
'address': 'Plaza de la Moncloa, 1. 28008 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h: Sábados y domingos de 10 a 22 h',
'coordinates': {
'longitude': -3.719445,
'latitude': 40.43502
},
'type': 'gestion'
}, {
'codOffice': '01_000025',
'name': 'Oficina de Gestión de Sol',
'address': 'Plaza de la Puerta del Sol, 6. 28013 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h; Sábados y domingos de 10 a 22 h',
'coordinates': {
'longitude': -3.703257,
'latitude': 40.416877
},
'type': 'gestion'
}, {
'codOffice': '01_000030',
'name': 'Oficina de Gestión de Príncipe Pío',
'address': 'Paseo de la Florida, 2. 28008 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h; Sábados de 10 a 22 h',
'coordinates': {
'longitude': -3.720322,
'latitude': 40.421069
.. code-block:: python
{
'offices': {
'Office': [{
'codOffice': '01_000015',
'name': 'Oficina de Gestión del Consorcio Regional de Transportes de Madrid',
'address': 'Plaza Descubridor Diego de Ordás, 3. 28003 Madrid',
'openTime': 'Horario de atención al público: Lunes a Viernes de 8 a 20 h',
'coordinates': {
'longitude': -3.700064,
'latitude': 40.44086
},
'type': 'gestion'
}, {
'codOffice': '01_000020',
'name': 'Oficina de Gestión de Moncloa',
'address': 'Plaza de la Moncloa, 1. 28008 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h: Sábados y domingos de 10 a 22 h',
'coordinates': {
'longitude': -3.719445,
'latitude': 40.43502
},
'type': 'gestion'
}, {
'codOffice': '01_000025',
'name': 'Oficina de Gestión de Sol',
'address': 'Plaza de la Puerta del Sol, 6. 28013 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h; Sábados y domingos de 10 a 22 h',
'coordinates': {
'longitude': -3.703257,
'latitude': 40.416877
},
'type': 'gestion'
}, {
'codOffice': '01_000030',
'name': 'Oficina de Gestión de Príncipe Pío',
'address': 'Paseo de la Florida, 2. 28008 Madrid',
'openTime': 'Horario de atención al público: Lunes a viernes de 7 a 22 h; Sábados de 10 a 22 h',
'coordinates': {
'longitude': -3.720322,
'latitude': 40.421069
},
'type': 'gestion'
},
'type': 'gestion'
},
...
}]
...
}]
}
}
}
"""
if offices_type is not None:
url_formatted = (Urls.CITRAM_WIDGET_SERVICE.value +
Expand All @@ -75,7 +83,11 @@ def get_offices_by_postcode(post_code, offices_type=None):
Returns all the offices from the specified zip code. If offices_type is specified, the results will be filtered,
returning only offices of that type.
Example: get_offices_by_postcode(28004)
Example:
.. code-block:: python
get_offices_by_postcode(28004)
:param int post_code: Zip code of the area to look for offices.
:param str offices_type: Office type. If set, filters the results by the office type specified.
Expand All @@ -100,7 +112,11 @@ def get_offices_by_municipality(cod_municipality, offices_type=None):
Returns all the offices from the specified municipality. If offices_type is specified, the results will be filtered,
returning only offices of that type.
Example: get_offices_by_municipality(Municipalities.FUENLABRADA.value, OfficeTypes.OFICINA.value)
Example:
.. code-block:: python
get_offices_by_municipality(Municipalities.FUENLABRADA.value, OfficeTypes.OFICINA.value)
:param int cod_municipality: Id of a municipality. Use constants.Municipalities to easily select transport modes ids.
:param str offices_type: Office type. If set, filters the results by the office type specified.
Expand Down
116 changes: 61 additions & 55 deletions citram_api/api/others/others.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ def get_municipalities():
Returns the municipalities that are in CRTM system with their ids.
:return dict: A dictionary with the municipalities and ids. It looks like this:
{
'municipalities': {
'Municipality': [{
'codMunicipality': '4273',
'name': 'ACEBEDA, LA'
}, {
'codMunicipality': '4274',
'name': 'AJALVIR'
}, {
'codMunicipality': '4275',
'name': 'ALAMEDA DEL VALLE'
}, {
'codMunicipality': '4276',
'name': 'ÁLAMO, EL'
}, {
'codMunicipality': '4277',
'name': 'ALCALÁ DE HENARES'
}, {
'codMunicipality': '4278',
'name': 'ALCOBENDAS'
},
...
]
.. code-block:: python
{
'municipalities': {
'Municipality': [{
'codMunicipality': '4273',
'name': 'ACEBEDA, LA'
}, {
'codMunicipality': '4274',
'name': 'AJALVIR'
}, {
'codMunicipality': '4275',
'name': 'ALAMEDA DEL VALLE'
}, {
'codMunicipality': '4276',
'name': 'ÁLAMO, EL'
}, {
'codMunicipality': '4277',
'name': 'ALCALÁ DE HENARES'
}, {
'codMunicipality': '4278',
'name': 'ALCOBENDAS'
},
...
]
}
}
}
"""
url_formatted = (Urls.CITRAM_WIDGET_SERVICE.value + '/GetMunicipalities.php')

Expand Down Expand Up @@ -73,38 +76,41 @@ def get_transport_modes():
Returns the transport modes available and their id.
:return dict: Transport modes and their ids. The result looks like this:
{
'modes': {
'Mode': [{
'codMode': '4',
'name': 'METRO'
}, {
'codMode': '6',
'name': 'AUTOBUSES EMT'
}, {
'codMode': '5',
'name': 'CERCANIAS'
}, {
'codMode': '10',
'name': 'METRO LIGERO/TRANVÍA'
}, {
'codMode': '8',
'name': 'AUTOBUSES INTERURBANOS'
}, {
'codMode': '9',
'name': 'AUTOBUSES URBANOS OTROS MUNICIPIOS'
}, {
'codMode': '90',
'name': 'INTERCAMBIADORES'
}, {
'codMode': '0',
'name': 'LARGO RECORRIDO'
}, {
'codMode': '1',
'name': 'APARCAMIENTOS'
}]
.. code-block:: python
{
'modes': {
'Mode': [{
'codMode': '4',
'name': 'METRO'
}, {
'codMode': '6',
'name': 'AUTOBUSES EMT'
}, {
'codMode': '5',
'name': 'CERCANIAS'
}, {
'codMode': '10',
'name': 'METRO LIGERO/TRANVÍA'
}, {
'codMode': '8',
'name': 'AUTOBUSES INTERURBANOS'
}, {
'codMode': '9',
'name': 'AUTOBUSES URBANOS OTROS MUNICIPIOS'
}, {
'codMode': '90',
'name': 'INTERCAMBIADORES'
}, {
'codMode': '0',
'name': 'LARGO RECORRIDO'
}, {
'codMode': '1',
'name': 'APARCAMIENTOS'
}]
}
}
}
"""
url_formatted = (Urls.CITRAM_WIDGET_SERVICE.value + '/GetModes.php')

Expand Down

0 comments on commit bc3eacc

Please sign in to comment.