/// <summary> /// Sets the URL strategy. /// </summary> /// <param name="strategy">The strategy.</param> /// <exception cref="System.ArgumentException">Cannot set Null strategy</exception> public void setUrlStrategy(UrlStrategy strategy) { if (strategy == null) { throw new ArgumentException("Cannot set Null strategy"); } this.strategy = strategy; }
/// <summary> /// Gets the access token from HubSpot. /// </summary> /// <param name="operation">The parameter object for getting an access token from HubSpot.</param> /// <returns>The access token.</returns> public string Execute(GetHubSpotAccessTokenOp operation) { lock (this.lockState) { if (!string.IsNullOrEmpty(this.state.access_token)) { return(this.state.access_token); } } // Generate the URI using the URI protocol. // Pass in the strategy object that generates the correct URI. var uri = UrlStrategy.BuildAccessTokenUri(); var resp = uri.Get <TokenResponse>(); this.state = resp; return(this.state.access_token); }
/// <summary> /// Initializes a new instance of the <see cref="UrlMaker"/> class. /// </summary> /// <param name="strategy">The strategy.</param> private UrlMaker(UrlStrategy strategy) { this.strategy = strategy; }