Skip to content

Commit

Permalink
Merge pull request #41 from andmos/feature/anm-GBFSVersion
Browse files Browse the repository at this point in the history
Feature/anm gbfs version
  • Loading branch information
andmos authored Dec 29, 2019
2 parents 66f6620 + 092f6ae commit 4f8b002
Show file tree
Hide file tree
Showing 22 changed files with 616 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ _TeamCity*
# Visual Studio code coverage results
*.coverage
*.coveragexml
*.opencover.xml

# NCrunch
_NCrunch_*
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ WORKDIR /app
COPY src/BikeshareClient .
RUN dotnet restore

RUN dotnet test TestBikeshareClient/TestBikeshareClient.csproj /p:CollectCoverage=true /p:Threshold=80 /p:ThresholdType=line /p:CoverletOutputFormat=opencover
RUN dotnet test TestBikeshareClient/TestBikeshareClient.csproj /p:CollectCoverage=true /p:Threshold=80 /p:ThresholdType=line /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=ExcludeFromCodeCoverageAttribute

RUN dotnet pack -c Release -o output $VERSION_SUFFIX
4 changes: 2 additions & 2 deletions src/BikeshareClient/BikeshareClient/BikeshareClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>3.1.0</ReleaseVersion>
<VersionPrefix>3.1.0</VersionPrefix>
<ReleaseVersion>3.2.0</ReleaseVersion>
<VersionPrefix>3.2.0</VersionPrefix>
<Title>BikeshareClient</Title>
<Authors>andmos</Authors>
<Description>Dotnet client for bike share systems implementing the General Bikeshare Feed Specification (GBFS).</Description>
Expand Down
20 changes: 14 additions & 6 deletions src/BikeshareClient/BikeshareClient/DTO/BikeStatusDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using BikeshareClient.Helpers;
using BikeshareClient.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand All @@ -9,18 +11,24 @@ namespace BikeshareClient.DTO
internal readonly struct BikeStatusDTO
{
[JsonConstructor]
public BikeStatusDTO([JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))]DateTime lastUpdate,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("data")] BikeStatusData bikeData)
public BikeStatusDTO(
[JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))]DateTime lastUpdate,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("version"), JsonConverter(typeof(StringToSemanticVersionConverter))] SemanticVersion version,
[JsonProperty("data")] BikeStatusData bikeData)
{
LastUpdated = lastUpdate;
TimeToLive = timeToLive;
BikeStatusData = bikeData;
Version = version ?? new SemanticVersion("1.0");
BikeStatusData = bikeData;

}

public DateTime LastUpdated { get; }
public DateTime LastUpdated { get; }

public int TimeToLive { get; }

public int TimeToLive { get; }
public SemanticVersion Version { get; }

public BikeStatusData BikeStatusData { get; }
}
Expand Down
11 changes: 8 additions & 3 deletions src/BikeshareClient/BikeshareClient/DTO/GbfsDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ namespace BikeshareClient.DTO
internal readonly struct GbfsDTO
{
[JsonConstructor]
public GbfsDTO([JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("data"), JsonConverter(typeof(FeedsConverter))] FeedsData[] feedsData)
public GbfsDTO(
[JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("version"), JsonConverter(typeof(StringToSemanticVersionConverter))] SemanticVersion version,
[JsonProperty("data"), JsonConverter(typeof(FeedsConverter))] FeedsData[] feedsData)
{
LastUpdated = lastUpdated;
TimeToLive = timeToLive;
Version = version ?? new SemanticVersion("1.0");
FeedsData = feedsData;
}
public DateTime LastUpdated { get; }

public int TimeToLive { get; }

public SemanticVersion Version { get; }

public FeedsData[] FeedsData { get; }

}
Expand Down
12 changes: 9 additions & 3 deletions src/BikeshareClient/BikeshareClient/DTO/StationDTO.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using BikeshareClient.Helpers;
using BikeshareClient.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand All @@ -9,19 +10,24 @@ namespace BikeshareClient.DTO
internal readonly struct StationDTO
{
[JsonConstructor]
public StationDTO([JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("data")] StationData stationsData)
public StationDTO(
[JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("version"), JsonConverter(typeof(StringToSemanticVersionConverter))] SemanticVersion version,
[JsonProperty("data")] StationData stationsData)
{
LastUpdated = lastUpdated;
TimeToLive = timeToLive;
Version = version ?? new SemanticVersion("1.0");
StationsData = stationsData;
}

public DateTime LastUpdated { get; }

public int TimeToLive { get; }

public SemanticVersion Version { get; }

public StationData StationsData { get; }
}

Expand Down
34 changes: 19 additions & 15 deletions src/BikeshareClient/BikeshareClient/DTO/StationStatusDTO.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
using System;
using System.Collections.Generic;
using BikeshareClient.Helpers;
using BikeshareClient.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace BikeshareClient.DTO
{
internal readonly struct StationStatusDTO
internal readonly struct StationStatusDTO
{
[JsonConstructor]
public StationStatusDTO([JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))]DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("data")]StationStatusData stationStatusData)
[JsonConstructor]
public StationStatusDTO(
[JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))]DateTime lastUpdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("version"), JsonConverter(typeof(StringToSemanticVersionConverter))] SemanticVersion version,
[JsonProperty("data")]StationStatusData stationStatusData)
{
LastUpdated = lastUpdated;
TimeToLive = timeToLive;
Version = version ?? new SemanticVersion("1.0");
StationsStatusData = stationStatusData;
}


public DateTime LastUpdated { get; }
public DateTime LastUpdated { get; }


public int TimeToLive { get; }


public SemanticVersion Version { get; }

public StationStatusData StationsStatusData { get; }

}
internal struct StationStatusData
internal struct StationStatusData
{
[JsonConstructor]
public StationStatusData(IEnumerable<StationStatus> stations)
{
StationsStatus = stations;
}
[JsonConstructor]
public StationStatusData(IEnumerable<StationStatus> stations)
{
StationsStatus = stations;
}

public IEnumerable<StationStatus> StationsStatus { get; }
public IEnumerable<StationStatus> StationsStatus { get; }
}
}
28 changes: 17 additions & 11 deletions src/BikeshareClient/BikeshareClient/DTO/SystemInformationDTO.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
using System;
using BikeshareClient.Helpers;
using BikeshareClient.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace BikeshareClient.DTO
{
internal readonly struct SystemInformationDTO
internal readonly struct SystemInformationDTO
{
public SystemInformationDTO([JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastupdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("data")] SystemInformation systemInformation)
public SystemInformationDTO(
[JsonProperty("last_updated"), JsonConverter(typeof(UnixDateTimeConverter))] DateTime lastupdated,
[JsonProperty("ttl")] int timeToLive,
[JsonProperty("version"), JsonConverter(typeof(StringToSemanticVersionConverter))] SemanticVersion version,
[JsonProperty("data")] SystemInformation systemInformation)
{
LastUpdated = lastupdated;
TimeToLive = timeToLive;
SystemInformation = systemInformation;
}
LastUpdated = lastupdated;
TimeToLive = timeToLive;
Version = version ?? new SemanticVersion("1.0");
SystemInformation = systemInformation;
}

public DateTime LastUpdated { get; }
public DateTime LastUpdated { get; }

public int TimeToLive { get; }
public int TimeToLive { get; }

public SystemInformation SystemInformation { get; }
public SemanticVersion Version { get; }

public SystemInformation SystemInformation { get; }

}
}
Loading

0 comments on commit 4f8b002

Please sign in to comment.