Created
February 19, 2015 22:24
-
-
Save ryanvalentin/ecf8378cffeb8399ad05 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 System; | |
using System.Text; | |
namespace Disqus.Core.Api.Models | |
{ | |
public sealed class DsqWordpressIdentifier | |
{ | |
public DsqWordpressIdentifier(long wordpressId, Uri siteUrl) | |
{ | |
this.WordpressId = wordpressId; | |
this.SiteUrl = siteUrl; | |
} | |
public long WordpressId { get; private set; } | |
public Uri SiteUrl { get; private set; } | |
internal string ToDisqusIdentifier() | |
{ | |
return BuildDisqusIdentifier(this); | |
} | |
internal static string BuildDisqusIdentifier(DsqWordpressIdentifier identifier) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
sb.Append(identifier.WordpressId); | |
sb.Append(" "); | |
sb.Append(identifier.SiteUrl.Scheme); | |
sb.Append("://"); | |
sb.Append(identifier.SiteUrl.Host); | |
sb.Append(identifier.SiteUrl.IsDefaultPort ? "" : ":" + identifier.SiteUrl.Port); | |
sb.Append("/?p="); | |
sb.Append(identifier.WordpressId); | |
return sb.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment