diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/GeofencingZonesMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/GeofencingZonesMapper.java index 81fd8209..fb7efe9d 100644 --- a/src/main/java/org/entur/lamassu/mapper/entitymapper/GeofencingZonesMapper.java +++ b/src/main/java/org/entur/lamassu/mapper/entitymapper/GeofencingZonesMapper.java @@ -136,6 +136,8 @@ private org.entur.lamassu.model.entities.GeofencingZones.Rule mapRule(GBFSRule r var mapped = new org.entur.lamassu.model.entities.GeofencingZones.Rule(); mapped.setVehicleTypeIds(rule.getVehicleTypeIds()); mapped.setRideAllowed(rule.getRideStartAllowed() && rule.getRideEndAllowed()); + mapped.setRideStartAllowed(rule.getRideStartAllowed()); + mapped.setRideEndAllowed(rule.getRideEndAllowed()); mapped.setRideThroughAllowed(rule.getRideThroughAllowed()); mapped.setMaximumSpeedKph( rule.getMaximumSpeedKph() != null ? rule.getMaximumSpeedKph() : null diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java index c633ccf3..283ea393 100644 --- a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java +++ b/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java @@ -32,9 +32,11 @@ import org.entur.lamassu.model.entities.Station; import org.entur.lamassu.model.entities.System; import org.entur.lamassu.model.entities.VehicleDocksAvailability; +import org.entur.lamassu.model.entities.VehicleDocksCapacity; import org.entur.lamassu.model.entities.VehicleType; import org.entur.lamassu.model.entities.VehicleTypeAvailability; import org.entur.lamassu.model.entities.VehicleTypeCapacity; +import org.entur.lamassu.model.entities.VehicleTypesCapacity; import org.jetbrains.annotations.NotNull; import org.mobilitydata.gbfs.v3_0.station_information.GBFSName; import org.mobilitydata.gbfs.v3_0.station_information.GBFSShortName; @@ -121,6 +123,7 @@ public Station mapStation( station.setCapacity( stationInformation.getCapacity() != null ? stationInformation.getCapacity() : null ); + station.setVehicleCapacity( stationInformation.getVehicleTypesCapacity() != null ? mapVehicleCapacities( @@ -129,6 +132,15 @@ public Station mapStation( ) : null ); + station.setVehicleTypesCapacity( + stationInformation.getVehicleTypesCapacity() != null + ? mapVehicleTypesCapacity( + stationInformation.getVehicleTypesCapacity(), + mapVehicleTypes(vehicleTypesFeed, pricingPlans, language) + ) + : null + ); + station.setVehicleTypeCapacity( stationInformation.getVehicleDocksCapacity() != null ? mapVehicleTypeCapacities( @@ -137,6 +149,15 @@ public Station mapStation( ) : null ); + station.setVehicleDocksCapacity( + stationInformation.getVehicleDocksCapacity() != null + ? mapVehicleDocksCapacityToVehicleTypeCapacity( + stationInformation.getVehicleDocksCapacity(), + mapVehicleTypes(vehicleTypesFeed, pricingPlans, language) + ) + : null + ); + station.setValetStation(stationInformation.getIsValetStation()); station.setChargingStation(stationInformation.getIsChargingStation()); station.setRentalUris( @@ -147,6 +168,11 @@ public Station mapStation( ? stationStatus.getNumVehiclesAvailable() : null ); + station.setNumVehiclesAvailable( + stationStatus.getNumVehiclesAvailable() != null + ? stationStatus.getNumVehiclesAvailable() + : null + ); station.setVehicleTypesAvailable( stationStatus.getVehicleTypesAvailable() != null ? mapVehicleTypesAvailable( @@ -162,6 +188,11 @@ public Station mapStation( ? stationStatus.getNumVehiclesDisabled() : null ); + station.setNumVehiclesDisabled( + stationStatus.getNumVehiclesDisabled() != null + ? stationStatus.getNumVehiclesDisabled() + : null + ); station.setNumDocksAvailable( stationStatus.getNumDocksAvailable() != null ? stationStatus.getNumDocksAvailable() @@ -282,10 +313,29 @@ private List mapVehicleCapacities( mapped.setVehicleType( vehicleTypes.get(vehicleCapacity.getVehicleTypeIds().getFirst()) ); + mapped.setCount(vehicleCapacity.getCount()); + return mapped; + } + + private List mapVehicleTypesCapacity( + List vehicleTypesCapacity, + Map vehicleTypes + ) { + return vehicleTypesCapacity + .stream() + .map(v -> mapVehicleTypeCapacity(v, vehicleTypes)) + .toList(); + } + + private VehicleTypesCapacity mapVehicleTypeCapacity( + GBFSVehicleTypesCapacity vehicleTypesCapacity, + Map vehicleTypes + ) { + var mapped = new VehicleTypesCapacity(); mapped.setVehicleTypes( - vehicleCapacity.getVehicleTypeIds().stream().map(vehicleTypes::get).toList() + vehicleTypesCapacity.getVehicleTypeIds().stream().map(vehicleTypes::get).toList() ); - mapped.setCount(vehicleCapacity.getCount()); + mapped.setCount(vehicleTypesCapacity.getCount()); return mapped; } @@ -295,11 +345,11 @@ private List mapVehicleTypeCapacities( ) { return vehicleCapacity .stream() - .map(entry -> mapVehicleDocksCapacity(entry, vehicleTypes)) + .map(entry -> mapVehicleDocksCapacityToVehicleTypeCapacity(entry, vehicleTypes)) .toList(); } - private VehicleTypeCapacity mapVehicleDocksCapacity( + private VehicleTypeCapacity mapVehicleDocksCapacityToVehicleTypeCapacity( GBFSVehicleDocksCapacity vehicleDocksCapacity, Map vehicleTypes ) { @@ -307,6 +357,25 @@ private VehicleTypeCapacity mapVehicleDocksCapacity( mapped.setVehicleType( vehicleTypes.get(vehicleDocksCapacity.getVehicleTypeIds().getFirst()) ); + mapped.setCount(vehicleDocksCapacity.getCount()); + return mapped; + } + + private List mapVehicleDocksCapacityToVehicleTypeCapacity( + List vehicleDocksCapacity, + Map vehicleTypes + ) { + return vehicleDocksCapacity + .stream() + .map(v -> mapVehicleDocksCapacity(v, vehicleTypes)) + .toList(); + } + + private VehicleDocksCapacity mapVehicleDocksCapacity( + GBFSVehicleDocksCapacity vehicleDocksCapacity, + Map vehicleTypes + ) { + var mapped = new VehicleDocksCapacity(); mapped.setVehicleTypes( vehicleDocksCapacity.getVehicleTypeIds().stream().map(vehicleTypes::get).toList() ); diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/SystemMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/SystemMapper.java index bfaff582..99ebe6ac 100644 --- a/src/main/java/org/entur/lamassu/mapper/entitymapper/SystemMapper.java +++ b/src/main/java/org/entur/lamassu/mapper/entitymapper/SystemMapper.java @@ -26,8 +26,10 @@ import org.entur.lamassu.model.entities.RentalApp; import org.entur.lamassu.model.entities.RentalApps; import org.entur.lamassu.model.entities.System; +import org.entur.lamassu.model.entities.TranslatedString; import org.entur.lamassu.model.provider.FeedProvider; import org.mobilitydata.gbfs.v3_0.system_information.GBFSAndroid; +import org.mobilitydata.gbfs.v3_0.system_information.GBFSAttributionOrganizationName; import org.mobilitydata.gbfs.v3_0.system_information.GBFSBrandAssets; import org.mobilitydata.gbfs.v3_0.system_information.GBFSData; import org.mobilitydata.gbfs.v3_0.system_information.GBFSIos; @@ -71,6 +73,7 @@ public System mapSystem(GBFSData systemInformation, FeedProvider feedProvider) { var system = new System(); system.setId(systemInformation.getSystemId()); system.setLanguage(feedProvider.getLanguage()); + system.setLanguages(systemInformation.getLanguages()); system.setName( translationMapper.mapTranslatedString( systemInformation @@ -94,6 +97,7 @@ public System mapSystem(GBFSData systemInformation, FeedProvider feedProvider) { .toList() ) ); + system.setOpeningHours(systemInformation.getOpeningHours()); system.setOperator(mapOperator(systemInformation.getOperator(), feedProvider)); system.setUrl(systemInformation.getUrl()); system.setPurchaseUrl(systemInformation.getPurchaseUrl()); @@ -130,7 +134,11 @@ public System mapSystem(GBFSData systemInformation, FeedProvider feedProvider) { .orElse(null) ); system.setPrivacyLastUpdated(systemInformation.getPrivacyLastUpdated()); + system.setAttributionOrganizationName( + mapAttributionOrganizationName(systemInformation.getAttributionOrganizationName()) + ); system.setRentalApps(mapRentalApps(systemInformation.getRentalApps())); + system.setTerminationDate(systemInformation.getTerminationDate()); return system; } @@ -149,6 +157,23 @@ private BrandAssets mapBrandAssets(GBFSBrandAssets brandAssets) { return mapped; } + private TranslatedString mapAttributionOrganizationName( + List attributionOrganizationName + ) { + if (attributionOrganizationName == null) { + return null; + } + + var mapped = new TranslatedString(); + mapped.setTranslation( + attributionOrganizationName + .stream() + .map(name -> translationMapper.mapTranslation(name.getLanguage(), name.getText())) + .toList() + ); + return mapped; + } + private RentalApps mapRentalApps(GBFSRentalApps sourceRentalApps) { if (sourceRentalApps == null) { return null; diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleTypeMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleTypeMapper.java index 924d56c9..9f1ae387 100644 --- a/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleTypeMapper.java +++ b/src/main/java/org/entur/lamassu/mapper/entitymapper/VehicleTypeMapper.java @@ -63,6 +63,7 @@ public VehicleType mapVehicleType( PropulsionType.valueOf(vehicleType.getPropulsionType().name()) ); mapped.setEcoLabel(mapEcoLabels(vehicleType.getEcoLabels())); + mapped.setEcoLabels(mapEcoLabels(vehicleType.getEcoLabels())); mapped.setMaxRangeMeters(vehicleType.getMaxRangeMeters()); mapped.setName( translationMapper.mapTranslatedString( @@ -76,6 +77,21 @@ public VehicleType mapVehicleType( .toList() ) ); + mapped.setDescription( + translationMapper.mapTranslatedString( + Optional + .ofNullable(vehicleType.getDescription()) + .orElse(Collections.emptyList()) + .stream() + .map(description -> + translationMapper.mapTranslation( + description.getLanguage(), + description.getText() + ) + ) + .toList() + ) + ); mapped.setVehicleAccessories( mapVehicleAccessories(vehicleType.getVehicleAccessories()) ); diff --git a/src/main/java/org/entur/lamassu/model/entities/GeofencingZones.java b/src/main/java/org/entur/lamassu/model/entities/GeofencingZones.java index a1f2efc9..49995306 100644 --- a/src/main/java/org/entur/lamassu/model/entities/GeofencingZones.java +++ b/src/main/java/org/entur/lamassu/model/entities/GeofencingZones.java @@ -148,6 +148,8 @@ public static class Rule implements Serializable { private List vehicleTypeIds; private Boolean rideAllowed; + private Boolean rideStartAllowed; + private Boolean rideEndAllowed; private Boolean rideThroughAllowed; private Integer maximumSpeedKph; private Boolean stationParking; @@ -168,6 +170,22 @@ public void setRideAllowed(Boolean rideAllowed) { this.rideAllowed = rideAllowed; } + public Boolean getRideStartAllowed() { + return rideStartAllowed; + } + + public void setRideStartAllowed(Boolean rideStartAllowed) { + this.rideStartAllowed = rideStartAllowed; + } + + public Boolean getRideEndAllowed() { + return rideEndAllowed; + } + + public void setRideEndAllowed(Boolean rideEndAllowed) { + this.rideEndAllowed = rideEndAllowed; + } + public Boolean getRideThroughAllowed() { return rideThroughAllowed; } diff --git a/src/main/java/org/entur/lamassu/model/entities/Station.java b/src/main/java/org/entur/lamassu/model/entities/Station.java index 6175df85..9d36dbe4 100644 --- a/src/main/java/org/entur/lamassu/model/entities/Station.java +++ b/src/main/java/org/entur/lamassu/model/entities/Station.java @@ -40,13 +40,17 @@ public class Station implements LocationEntity { private String contactPhone; private Integer capacity; private List vehicleCapacity; + private List vehicleDocksCapacity; private List vehicleTypeCapacity; + private List vehicleTypesCapacity; private Boolean isValetStation; private Boolean isChargingStation; private RentalUris rentalUris; private Integer numBikesAvailable; + private Integer numVehiclesAvailable; private List vehicleTypesAvailable; private Integer numBikesDisabled; + private Integer numVehiclesDisabled; private Integer numDocksAvailable; private List vehicleDocksAvailable; private Integer numDocksDisabled; @@ -196,6 +200,14 @@ public void setVehicleCapacity(List vehicleCapacity) { this.vehicleCapacity = vehicleCapacity; } + public List getVehicleDocksCapacity() { + return vehicleDocksCapacity; + } + + public void setVehicleDocksCapacity(List vehicleDocksCapacity) { + this.vehicleDocksCapacity = vehicleDocksCapacity; + } + public List getVehicleTypeCapacity() { return vehicleTypeCapacity; } @@ -204,6 +216,14 @@ public void setVehicleTypeCapacity(List vehicleTypeCapacity this.vehicleTypeCapacity = vehicleTypeCapacity; } + public List getVehicleTypesCapacity() { + return vehicleTypesCapacity; + } + + public void setVehicleTypesCapacity(List vehicleTypesCapacity) { + this.vehicleTypesCapacity = vehicleTypesCapacity; + } + public Boolean getValetStation() { return isValetStation; } @@ -236,6 +256,14 @@ public void setNumBikesAvailable(Integer numBikesAvailable) { this.numBikesAvailable = numBikesAvailable; } + public Integer getNumVehiclesAvailable() { + return numVehiclesAvailable; + } + + public void setNumVehiclesAvailable(Integer numVehiclesAvailable) { + this.numVehiclesAvailable = numVehiclesAvailable; + } + public List getVehicleTypesAvailable() { return vehicleTypesAvailable; } @@ -254,6 +282,14 @@ public void setNumBikesDisabled(Integer numBikesDisabled) { this.numBikesDisabled = numBikesDisabled; } + public Integer getNumVehiclesDisabled() { + return numVehiclesDisabled; + } + + public void setNumVehiclesDisabled(Integer numVehiclesDisabled) { + this.numVehiclesDisabled = numVehiclesDisabled; + } + public Integer getNumDocksAvailable() { return numDocksAvailable; } diff --git a/src/main/java/org/entur/lamassu/model/entities/System.java b/src/main/java/org/entur/lamassu/model/entities/System.java index f0708d79..6be75abf 100644 --- a/src/main/java/org/entur/lamassu/model/entities/System.java +++ b/src/main/java/org/entur/lamassu/model/entities/System.java @@ -1,26 +1,33 @@ package org.entur.lamassu.model.entities; +import java.util.List; + public class System implements Entity { - String id; - String language; - TranslatedString name; - TranslatedString shortName; - Operator operator; - String url; - String purchaseUrl; - String startDate; - String phoneNumber; - String email; - String feedContactEmail; - String timezone; - String licenseUrl; - BrandAssets brandAssets; - String termsUrl; - String termsLastUpdated; - String privacyUrl; - String privacyLastUpdated; - RentalApps rentalApps; + private String id; + private String language; + private List languages; + private TranslatedString name; + private TranslatedString shortName; + private String openingHours; + private Operator operator; + private String url; + private String purchaseUrl; + private String startDate; + private String phoneNumber; + private String email; + private String feedContactEmail; + private String timezone; + private String licenseUrl; + private BrandAssets brandAssets; + private String termsUrl; + private String termsLastUpdated; + private String privacyUrl; + private String privacyLastUpdated; + private TranslatedString attributionOrganizationName; + private String attributionUrl; + private RentalApps rentalApps; + private String terminationDate; @Override public String getId() { @@ -39,6 +46,14 @@ public void setLanguage(String language) { this.language = language; } + public List getLanguages() { + return languages; + } + + public void setLanguages(List languages) { + this.languages = languages; + } + public TranslatedString getName() { return name; } @@ -55,6 +70,14 @@ public void setShortName(TranslatedString shortName) { this.shortName = shortName; } + public String getOpeningHours() { + return openingHours; + } + + public void setOpeningHours(String openingHours) { + this.openingHours = openingHours; + } + public Operator getOperator() { return operator; } @@ -167,6 +190,24 @@ public void setPrivacyLastUpdated(String privacyLastUpdated) { this.privacyLastUpdated = privacyLastUpdated; } + public TranslatedString getAttributionOrganizationName() { + return attributionOrganizationName; + } + + public void setAttributionOrganizationName( + TranslatedString attributionOrganizationName + ) { + this.attributionOrganizationName = attributionOrganizationName; + } + + public String getAttributionUrl() { + return attributionUrl; + } + + public void setAttributionUrl(String attributionUrl) { + this.attributionUrl = attributionUrl; + } + public RentalApps getRentalApps() { return rentalApps; } @@ -175,6 +216,14 @@ public void setRentalApps(RentalApps rentalApps) { this.rentalApps = rentalApps; } + public String getTerminationDate() { + return terminationDate; + } + + public void setTerminationDate(String terminationDate) { + this.terminationDate = terminationDate; + } + @Override public String toString() { return ( diff --git a/src/main/java/org/entur/lamassu/model/entities/VehicleDocksCapacity.java b/src/main/java/org/entur/lamassu/model/entities/VehicleDocksCapacity.java new file mode 100644 index 00000000..cd78966c --- /dev/null +++ b/src/main/java/org/entur/lamassu/model/entities/VehicleDocksCapacity.java @@ -0,0 +1,44 @@ +/* + * + * + * * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by + * * the European Commission - subsequent versions of the EUPL (the "Licence"); + * * You may not use this work except in compliance with the Licence. + * * You may obtain a copy of the Licence at: + * * + * * https://joinup.ec.europa.eu/software/page/eupl + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the Licence is distributed on an "AS IS" basis, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the Licence for the specific language governing permissions and + * * limitations under the Licence. + * + */ + +package org.entur.lamassu.model.entities; + +import java.io.Serializable; +import java.util.List; + +public class VehicleDocksCapacity implements Serializable { + + private List vehicleTypes; + private Integer count; + + public List getVehicleTypes() { + return vehicleTypes; + } + + public void setVehicleTypes(List vehicleTypes) { + this.vehicleTypes = vehicleTypes; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } +} diff --git a/src/main/java/org/entur/lamassu/model/entities/VehicleType.java b/src/main/java/org/entur/lamassu/model/entities/VehicleType.java index b08a7a0b..1bbb2906 100644 --- a/src/main/java/org/entur/lamassu/model/entities/VehicleType.java +++ b/src/main/java/org/entur/lamassu/model/entities/VehicleType.java @@ -11,8 +11,10 @@ public class VehicleType implements Entity { private Integer cargoLoadCapacity; private PropulsionType propulsionType; private List ecoLabel; + private List ecoLabels; private Double maxRangeMeters; private TranslatedString name; + private TranslatedString description; private List vehicleAccessories; private Integer gCO2km; private String vehicleImage; @@ -85,6 +87,14 @@ public void setEcoLabel(List ecoLabel) { this.ecoLabel = ecoLabel; } + public List getEcoLabels() { + return ecoLabels; + } + + public void setEcoLabels(List ecoLabels) { + this.ecoLabels = ecoLabels; + } + public Double getMaxRangeMeters() { return maxRangeMeters; } @@ -101,6 +111,14 @@ public void setName(TranslatedString name) { this.name = name; } + public TranslatedString getDescription() { + return description; + } + + public void setDescription(TranslatedString description) { + this.description = description; + } + public List getVehicleAccessories() { return vehicleAccessories; } diff --git a/src/main/java/org/entur/lamassu/model/entities/VehicleTypeCapacity.java b/src/main/java/org/entur/lamassu/model/entities/VehicleTypeCapacity.java index 7783dc8a..8a310cc5 100644 --- a/src/main/java/org/entur/lamassu/model/entities/VehicleTypeCapacity.java +++ b/src/main/java/org/entur/lamassu/model/entities/VehicleTypeCapacity.java @@ -19,14 +19,11 @@ package org.entur.lamassu.model.entities; import java.io.Serializable; -import java.util.List; public class VehicleTypeCapacity implements Serializable { private VehicleType vehicleType; - private List vehicleTypes; - private Integer count; public VehicleType getVehicleType() { @@ -37,14 +34,6 @@ public void setVehicleType(VehicleType vehicleType) { this.vehicleType = vehicleType; } - public List getVehicleTypes() { - return vehicleTypes; - } - - public void setVehicleTypes(List vehicleTypes) { - this.vehicleTypes = vehicleTypes; - } - public Integer getCount() { return count; } diff --git a/src/main/java/org/entur/lamassu/model/entities/VehicleTypesCapacity.java b/src/main/java/org/entur/lamassu/model/entities/VehicleTypesCapacity.java new file mode 100644 index 00000000..081c4840 --- /dev/null +++ b/src/main/java/org/entur/lamassu/model/entities/VehicleTypesCapacity.java @@ -0,0 +1,44 @@ +/* + * + * + * * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by + * * the European Commission - subsequent versions of the EUPL (the "Licence"); + * * You may not use this work except in compliance with the Licence. + * * You may obtain a copy of the Licence at: + * * + * * https://joinup.ec.europa.eu/software/page/eupl + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the Licence is distributed on an "AS IS" basis, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the Licence for the specific language governing permissions and + * * limitations under the Licence. + * + */ + +package org.entur.lamassu.model.entities; + +import java.io.Serializable; +import java.util.List; + +public class VehicleTypesCapacity implements Serializable { + + private List vehicleTypes; + private Integer count; + + public List getVehicleTypes() { + return vehicleTypes; + } + + public void setVehicleTypes(List vehicleTypes) { + this.vehicleTypes = vehicleTypes; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } +} diff --git a/src/main/resources/graphql/schema.graphqls b/src/main/resources/graphql/schema.graphqls index 9838042b..f1fbbd06 100644 --- a/src/main/resources/graphql/schema.graphqls +++ b/src/main/resources/graphql/schema.graphqls @@ -113,9 +113,11 @@ type VehicleType { cargoVolumeCapacity: Int cargoLoadCapacity: Int propulsionType: PropulsionType! - ecoLabel: [EcoLabel] + ecoLabel: [EcoLabel] @deprecated(reason: "Use ecoLabels") + ecoLabels: [EcoLabel] maxRangeMeters: Float name: TranslatedString + description: TranslatedString vehicleAccessories: [VehicleAccessory] gCO2km: Int vehicleImage: String @@ -137,7 +139,7 @@ enum FormFactor { CARGO_BICYCLE CAR MOPED - SCOOTER + SCOOTER @deprecated(reason: "Use SCOOTER_STANDING") SCOOTER_STANDING SCOOTER_SEATED OTHER @@ -228,14 +230,18 @@ type Station { parkingHoop: Boolean contactPhone: String capacity: Int - vehicleCapacity: [VehicleTypeCapacity] - vehicleTypeCapacity: [VehicleTypeCapacity] + vehicleCapacity: [VehicleTypeCapacity] @deprecated(reason: "Use vehicleTypesCapacity") + vehicleTypesCapacity: [VehicleTypesCapacity] + vehicleTypeCapacity: [VehicleTypeCapacity] @deprecated(reason: "Use vehicleDocksCapacity") + vehicleDocksCapacity: [VehicleDocksCapacity] isValetStation: Boolean isChargingStation: Boolean rentalUris: RentalUris - numBikesAvailable: Int! + numBikesAvailable: Int! @deprecated(reason: "Use numVehiclesAvailable") + numVehiclesAvailable: Int! vehicleTypesAvailable: [VehicleTypeAvailability] - numBikesDisabled: Int + numBikesDisabled: Int @deprecated(reason: "Use numVehiclesDisabled") + numVehiclesDisabled: Int numDocksAvailable: Int vehicleDocksAvailable: [VehicleDocksAvailability] numDocksDisabled: Int @@ -257,9 +263,11 @@ enum ParkingType { type System { id: ID! - language: String! + language: String! @deprecated(reason: "Use languages") + languages: [String!]! name: TranslatedString! shortName: TranslatedString + openingHours: String operator: Operator! url: String purchaseUrl: String @@ -274,7 +282,10 @@ type System { termsLastUpdated: String privacyUrl: String privacyLastUpdated: String + attributionOrganizationName: TranslatedString + attributionUrl: String rentalApps: RentalApps + terminationDate: String } type RentalApps { @@ -321,7 +332,16 @@ type Operator { } type VehicleTypeCapacity { - vehicleType: VehicleType! @deprecated(reason: "Use vehicleTypes instead") + vehicleType: VehicleType! + count: Int! +} + +type VehicleDocksCapacity { + vehicleTypes: [VehicleType!]! + count: Int! +} + +type VehicleTypesCapacity { vehicleTypes: [VehicleType!]! count: Int! } @@ -369,7 +389,9 @@ type GeofencingZoneProperties { type GeofencingZoneRule { vehicleTypeIds: [String] - rideAllowed: Boolean! + rideAllowed: Boolean! @deprecated(reason: "Use rideStartAllowed and rideEndAllowed") + rideStartAllowed: Boolean! + rideEndAllowed: Boolean! rideThroughAllowed: Boolean! maximumSpeedKph: Int stationParking: Boolean diff --git a/src/test/java/org/entur/lamassu/integration/GraphQLIntegrationTest.java b/src/test/java/org/entur/lamassu/integration/GraphQLIntegrationTest.java index 6c98bc32..bbeb775a 100644 --- a/src/test/java/org/entur/lamassu/integration/GraphQLIntegrationTest.java +++ b/src/test/java/org/entur/lamassu/integration/GraphQLIntegrationTest.java @@ -61,6 +61,12 @@ public void testVehiclesByIdQuery() throws IOException, InterruptedException { response.get("$.data.vehicles[0].id") ); assertEquals("TST:Vehicle:1235", response.get("$.data.vehicles[1].id")); + assertEquals( + "Another company", + response.get( + "$.data.vehicles[0].system.attributionOrganizationName.translation[0].value" + ) + ); } @Test @@ -106,6 +112,8 @@ public void testStationByIdQuery() throws IOException { assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals("TST:Station:1", response.get("$.data.station.id")); assertEquals("2", response.get("$.data.station.vehicleDocksAvailable[0].count")); + assertEquals("1", response.get("$.data.station.numVehiclesAvailable")); + assertEquals("2", response.get("$.data.station.numVehiclesDisabled")); } @Test @@ -125,6 +133,18 @@ public void testGeofencingZones() throws IOException { ); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals("testatlantis", response.get("$.data.geofencingZones[0].systemId")); + assertEquals( + "true", + response.get( + "$.data.geofencingZones[0].geojson.features[0].properties.rules[0].rideStartAllowed" + ) + ); + assertEquals( + "true", + response.get( + "$.data.geofencingZones[0].geojson.features[0].properties.rules[0].rideEndAllowed" + ) + ); } @Test diff --git a/src/test/resources/geofencing_zones_query.graphql b/src/test/resources/geofencing_zones_query.graphql index 952b3145..054865a9 100644 --- a/src/test/resources/geofencing_zones_query.graphql +++ b/src/test/resources/geofencing_zones_query.graphql @@ -12,10 +12,12 @@ name rules { rideAllowed + rideStartAllowed + rideEndAllowed rideThroughAllowed } } } } } -} \ No newline at end of file +} diff --git a/src/test/resources/station_by_id_query.graphql b/src/test/resources/station_by_id_query.graphql index 986a3832..ae8cb1bf 100644 --- a/src/test/resources/station_by_id_query.graphql +++ b/src/test/resources/station_by_id_query.graphql @@ -14,6 +14,8 @@ address capacity numBikesAvailable + numVehiclesAvailable + numVehiclesDisabled vehicleTypesAvailable { vehicleType { formFactor diff --git a/src/test/resources/v2/station_status.json b/src/test/resources/v2/station_status.json index 29da2f9a..ee9d2e12 100644 --- a/src/test/resources/v2/station_status.json +++ b/src/test/resources/v2/station_status.json @@ -19,6 +19,7 @@ "count": 1 }], "num_bikes_available": 1, + "num_bikes_disabled": 2, "vehicle_types_available": [{ "vehicle_type_id": "TST:VehicleType:Scooter", "count": 1 @@ -51,4 +52,4 @@ } ] } -} \ No newline at end of file +} diff --git a/src/test/resources/v3/system_information.json b/src/test/resources/v3/system_information.json index 795497a4..be209cb3 100644 --- a/src/test/resources/v3/system_information.json +++ b/src/test/resources/v3/system_information.json @@ -46,6 +46,13 @@ } ], "privacy_last_updated": "2019-01-13", + "attribution_organization_name": [ + { + "text": "Another company", + "language": "en" + } + ], + "attribution_url": "https://another.com", "rental_apps": { "android": { "discovery_uri": "com.example.android://", @@ -65,4 +72,4 @@ } } -} \ No newline at end of file +} diff --git a/src/test/resources/vehicle_by_id_query.graphql b/src/test/resources/vehicle_by_id_query.graphql index 274e572f..f81af448 100644 --- a/src/test/resources/vehicle_by_id_query.graphql +++ b/src/test/resources/vehicle_by_id_query.graphql @@ -75,4 +75,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/test/resources/vehicles_by_id_query.graphql b/src/test/resources/vehicles_by_id_query.graphql index 29eef739..3e322f67 100644 --- a/src/test/resources/vehicles_by_id_query.graphql +++ b/src/test/resources/vehicles_by_id_query.graphql @@ -57,6 +57,13 @@ } } } + attributionOrganizationName { + translation { + language + value + } + } + attributionUrl rentalApps { android { storeUri @@ -75,4 +82,4 @@ } } } -} \ No newline at end of file +}