Skip to content

Commit

Permalink
Merge pull request #1050 from stripe/brandur-singular-exchange-rate
Browse files Browse the repository at this point in the history
Make "exchange rate" singular
  • Loading branch information
brandur-stripe authored Oct 31, 2017
2 parents befe0e9 + 4fdc5ce commit f0c540c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace Stripe.Tests.XUnit
{
public class when_getting_exchange_rates
public class when_getting_an_exchange_rate
{
StripeExchangeRates result;
StripeExchangeRate result;

public when_getting_exchange_rates()
public when_getting_an_exchange_rate()
{
result = new StripeExchangeRatesService(Cache.ApiKey).Get("usd");
result = new StripeExchangeRateService(Cache.ApiKey).Get("usd");
}

[Fact]
Expand All @@ -24,7 +24,7 @@ public void it_should_have_rates()
}

[Fact]
public void it_should_have_rates_for_eur()
public void it_should_have_rate_for_eur()
{
result.Rates["eur"].Should().BeGreaterThan(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ namespace Stripe.Tests.XUnit
{
public class when_listing_exchange_rates
{
StripeList<StripeExchangeRates> result;
StripeList<StripeExchangeRate> result;

public when_listing_exchange_rates()
{
result = new StripeExchangeRatesService(Cache.ApiKey).List(new StripeListOptions { Limit = 3 });
result = new StripeExchangeRateService(Cache.ApiKey).List(new StripeListOptions { Limit = 3 });
}

[Fact]
public void list_is_iterable()
{
var count = 0;
IEnumerable<StripeExchangeRates> enumerable = result as IEnumerable<StripeExchangeRates>;
IEnumerable<StripeExchangeRate> enumerable = result as IEnumerable<StripeExchangeRate>;
foreach (var obj in enumerable)
{
count += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Stripe
{
public class StripeExchangeRates : StripeEntityWithId
public class StripeExchangeRate : StripeEntityWithId
{
[JsonProperty("object")]
public string Object { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@

namespace Stripe
{
public class StripeExchangeRatesService : StripeService
public class StripeExchangeRateService : StripeService
{
public StripeExchangeRatesService(string apiKey = null) : base(apiKey) { }
public StripeExchangeRateService(string apiKey = null) : base(apiKey) { }



//Sync
public virtual StripeExchangeRates Get(string currency, StripeRequestOptions requestOptions = null)
public virtual StripeExchangeRate Get(string currency, StripeRequestOptions requestOptions = null)
{
return Mapper<StripeExchangeRates>.MapFromJson(
return Mapper<StripeExchangeRate>.MapFromJson(
Requestor.GetString(
this.ApplyAllParameters(null, $"{Urls.ExchangeRates}/{currency}"),
SetupRequestOptions(requestOptions)
)
);
}

public virtual StripeList<StripeExchangeRates> List(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null)
public virtual StripeList<StripeExchangeRate> List(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null)
{
return Mapper<StripeList<StripeExchangeRates>>.MapFromJson(
return Mapper<StripeList<StripeExchangeRate>>.MapFromJson(
Requestor.GetString(
this.ApplyAllParameters(listOptions, $"{Urls.ExchangeRates}", true),
SetupRequestOptions(requestOptions)
Expand All @@ -35,9 +35,9 @@ public virtual StripeList<StripeExchangeRates> List(StripeListOptions listOption


//Async
public virtual async Task<StripeExchangeRates> GetAsync(string currency, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
public virtual async Task<StripeExchangeRate> GetAsync(string currency, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
{
return Mapper<StripeExchangeRates>.MapFromJson(
return Mapper<StripeExchangeRate>.MapFromJson(
await Requestor.GetStringAsync(
this.ApplyAllParameters(null, $"{Urls.ExchangeRates}/{currency}"),
SetupRequestOptions(requestOptions),
Expand All @@ -46,9 +46,9 @@ await Requestor.GetStringAsync(
);
}

public virtual async Task<StripeList<StripeExchangeRates>> ListAsync(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
public virtual async Task<StripeList<StripeExchangeRate>> ListAsync(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
{
return Mapper<StripeList<StripeExchangeRates>>.MapFromJson(
return Mapper<StripeList<StripeExchangeRate>>.MapFromJson(
await Requestor.GetStringAsync(
this.ApplyAllParameters(listOptions, $"{Urls.ExchangeRates}", true),
SetupRequestOptions(requestOptions),
Expand Down

0 comments on commit f0c540c

Please sign in to comment.