Skip to content

Commit

Permalink
React to change in the way the RepositoryTraffic API communicates time (
Browse files Browse the repository at this point in the history
#1560)

* React to change in the way the API communicates time

Fixes #1558.
The API used to send times as number of seconds from Unix epoch time.
This has changed and is now ISO 8601.

* remove openssl linking in TravisCI when on macOS

# Conflicts:
#	.travis.yml

* change appveyor config - public projects can no longer use account feeds (plus we dont actually need it anyway)
  • Loading branch information
mderriey authored and ryangribble committed Mar 5, 2017
1 parent 3c81893 commit 16f7d86
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ matrix:
mono: 4.2.3
dotnet: 1.0.0-preview2-003121

before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi

install:
- nuget restore Octokit-Mono.sln

Expand Down
15 changes: 3 additions & 12 deletions Octokit/Models/Response/RepositoryTrafficClone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Octokit.Helpers;
using Octokit.Internal;

namespace Octokit
{
Expand Down Expand Up @@ -40,21 +38,14 @@ public class RepositoryTrafficClone
public RepositoryTrafficClone() { }

[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "It's a property from the api.")]
public RepositoryTrafficClone(long timestamp, int count, int uniques)
public RepositoryTrafficClone(DateTimeOffset timestamp, int count, int uniques)
{
TimestampAsUtcEpochSeconds = timestamp;
Timestamp = timestamp;
Count = count;
Uniques = uniques;
}

[Parameter(Key = "ignoreThisField")]
public DateTimeOffset Timestamp
{
get { return TimestampAsUtcEpochSeconds.FromUnixTime(); }
}

[Parameter(Key = "timestamp")]
public long TimestampAsUtcEpochSeconds { get; protected set; }
public DateTimeOffset Timestamp { get; protected set; }

public int Count { get; protected set; }

Expand Down
13 changes: 3 additions & 10 deletions Octokit/Models/Response/RepositoryTrafficView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,14 @@ public class RepositoryTrafficView
public RepositoryTrafficView() { }

[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "It's a property from the api.")]
public RepositoryTrafficView(long timestamp, int count, int uniques)
public RepositoryTrafficView(DateTimeOffset timestamp, int count, int uniques)
{
TimestampAsUtcEpochSeconds = timestamp;
Timestamp = timestamp;
Count = count;
Uniques = uniques;
}

[Parameter(Key = "ignoreThisField")]
public DateTimeOffset Timestamp
{
get { return TimestampAsUtcEpochSeconds.FromUnixTime(); }
}

[Parameter(Key = "timestamp")]
public long TimestampAsUtcEpochSeconds { get; protected set; }
public DateTimeOffset Timestamp { get; protected set; }

public int Count { get; protected set; }

Expand Down
3 changes: 0 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ build_script:
- cmd: build.cmd CreatePackages
- cmd: build.cmd UnitTestsDotNetCore
test: off
nuget:
account_feed: true
project_feed: true
artifacts:
- path: 'packaging\octokit*.nupkg'
name: OctokitPackages

2 comments on commit 16f7d86

@LazarusX
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, do you have any ETA of the NuGet release containing this change? Issue #1558 has brought us trouble.

@ryangribble
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah fair point, since this is throwing an exception we should get this out the door. I might quickly fix #1559 this weekend and cut a release 👍

Please sign in to comment.