Created
June 13, 2018 17:55
-
-
Save efleming969/c9974d1cc5f9d46dcc48fe4bf4c3274f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ACME.Api.Domain; | |
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace ACME.Api.Infrastructure | |
{ | |
public class HttpRemoteBowlingService : IRemoteBowlingService | |
{ | |
public List<RemotePlayerData> Fetch(string code) | |
{ | |
var url = $"https://grn4aewhhg.execute-api.us-east-1.amazonaws.com/prod/games/{code}"; | |
var client = new HttpClient(); | |
var responseText = client.GetStringAsync(url).Result; | |
var remote_players = JsonConvert.DeserializeObject<RemoteBowlingServiceResponse>(responseText); | |
return remote_players.players; | |
} | |
} | |
class RemoteBowlingServiceResponse | |
{ | |
public string Date { get; set; } | |
public List<RemotePlayerData> players { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment