public static GithubStatus Retrieve(CloudBlockBlob githubStatusBlob) { var output = new GithubStatus(); // get the "Last Modified" date value from the config file stored in blob storage string json = ""; if (githubStatusBlob.Exists() == true) { json = githubStatusBlob.DownloadText(); } else { json = "{ events_last_modified: \"" + DateTime.UtcNow.AddDays(-3).ToString("ddd, dd MMM yyyy hh:mm:ss 'GMT'") + "\", followees_etag: null }"; } output.Raw = JsonConvert.DeserializeObject <dynamic>(json); output.EventsLastModified = DateTime.Parse(output.Raw.events_last_modified.Value); output.FolloweesEtag = output.Raw.followees_etag.Value; if (output.Raw.followees == null) { output.Followees = new List <GithubFollowee>(); } else { output.Followees = output.Raw.followees.ToObject <List <GithubFollowee> >(); } return(output); }
public GithubApi(CloudBlockBlob githubStatusBlob) { this.Configuration = GithubConfiguration.Retrieve(); this.Status = GithubStatus.Retrieve(githubStatusBlob); }