Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Mondo => Monzo #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Mondo/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using NUnit.Framework;
using Mondo.Extensions;
using Monzo.Extensions;

namespace Mondo.Tests.Extensions
namespace Monzo.Tests.Extensions
{
[TestFixture]
public sealed class DateTimeExtensionsTests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Mondo.Messages;
using Monzo.Messages;
using Newtonsoft.Json;
using NUnit.Framework;

namespace Mondo.Tests.Messages
namespace Monzo.Tests.Messages
{
[TestFixture]
public sealed class MerchantJsonConverterTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{25B2F959-FD51-4B9B-BEF1-FAD94E1FE74F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mondo.Tests</RootNamespace>
<AssemblyName>Mondo.Tests</AssemblyName>
<RootNamespace>Monzo.Tests</RootNamespace>
<AssemblyName>Monzo.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
Expand Down Expand Up @@ -61,18 +61,18 @@
<ItemGroup>
<Compile Include="Extensions\DateTimeExtensionsTests.cs" />
<Compile Include="Messages\MerchantJsonConverterTests.cs" />
<Compile Include="MondoAuthorizationClientTests.cs" />
<Compile Include="MondoClientTests.cs" />
<Compile Include="MonzoAuthorizationClientTests.cs" />
<Compile Include="MonzoClientTests.cs" />
<Compile Include="PaginationOptionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mondo\Mondo.csproj">
<ProjectReference Include="..\Monzo\Monzo.csproj">
<Project>{ce64e281-a9d8-43c8-bd1a-a2f095a99252}</Project>
<Name>Mondo</Name>
<Name>Monzo</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
using NUnit.Framework;
using Owin;

namespace Mondo.Tests
namespace Monzo.Tests
{
[TestFixture]
public sealed class MondoAuthorizationClientTests
public sealed class MonzoAuthorizationClientTests
{
[Test]
public void GetLoginPageUrl()
{
using (var client = new MondoAuthorizationClient("testClientId", "testClientSecret", "http://foo"))
using (var client = new MonzoAuthorizationClient("testClientId", "testClientSecret", "http://foo"))
{
var loginPageUrl = client.GetAuthorizeUrl("testState", "testRedirectUri");

Assert.AreEqual("https://auth.getmondo.co.uk/?response_type=code&client_id=testClientId&state=testState&redirect_uri=testRedirectUri", loginPageUrl);
Assert.AreEqual("https://auth.monzo.com/?response_type=code&client_id=testClientId&state=testState&redirect_uri=testRedirectUri", loginPageUrl);
}
}

Expand Down Expand Up @@ -48,7 +48,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
using (var client = new MonzoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
{
var accessToken = await client.GetAccessTokenAsync("testCode", "testRedirectUri");

Expand Down Expand Up @@ -90,7 +90,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
using (var client = new MonzoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
{
var accessToken = await client.AuthenticateAsync("testUsername", "testPassword");

Expand Down Expand Up @@ -131,7 +131,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
using (var client = new MonzoAuthorizationClient(server.HttpClient, "testClientId", "testClientSecret"))
{
var accessToken = await client.RefreshAccessTokenAsync("testAccessToken1");

Expand Down
30 changes: 15 additions & 15 deletions Mondo.Tests/MondoClientTests.cs → Monzo.Tests/MonzoClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
using NUnit.Framework;
using Owin;

namespace Mondo.Tests
namespace Monzo.Tests
{
[TestFixture]
public sealed class MondoApiClientTests
public sealed class MonzoApiClientTests
{
[Test]
public async void GetAccounts()
Expand All @@ -35,7 +35,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var accounts = await client.GetAccountsAsync();

Expand Down Expand Up @@ -68,7 +68,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var balance = await client.GetBalanceAsync("1");

Expand Down Expand Up @@ -128,7 +128,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var transactions = await client.GetTransactionsAsync("1");

Expand Down Expand Up @@ -198,7 +198,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var transactions = await client.GetTransactionsAsync("1", null, new PaginationOptions { SinceTime = new DateTime(2015, 4, 5, 18, 1, 32, DateTimeKind.Utc), Limit = 40, BeforeTime = new DateTime(2015, 12, 25, 18, 1, 32, DateTimeKind.Utc) });

Expand Down Expand Up @@ -251,7 +251,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var transaction = await client.GetTransactionAsync("1");

Expand Down Expand Up @@ -319,7 +319,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var transaction = await client.GetTransactionAsync("1", "merchant");

Expand Down Expand Up @@ -390,7 +390,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var transaction = await client.AnnotateTransactionAsync("1", new Dictionary<string, string> { { "key1", "value1" }, {"key2", "" } });

Expand Down Expand Up @@ -421,7 +421,7 @@ public async void CreateFeedItem()
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
await client.CreateFeedItemAsync("1", "basic", new Dictionary<string, string> { {"title", "My custom item" } }, "https://www.example.com/a_page_to_open_on_tap.html");
}
Expand Down Expand Up @@ -455,7 +455,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var webhook = await client.CreateWebhookAsync("1", "http://example.com");

Expand Down Expand Up @@ -491,7 +491,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var webhooks = await client.GetWebhooksAsync("1");

Expand Down Expand Up @@ -519,7 +519,7 @@ public async void DeleteWebhook()
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
await client.DeleteWebhookAsync("1");
}
Expand Down Expand Up @@ -558,7 +558,7 @@ await context.Response.WriteAsync(
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
var attachment = await client.CreateAttachmentAsync("tx_00008zIcpb1TB4yeIFXMzx", "https://s3-eu-west-1.amazonaws.com/mondo-image-uploads/user_00009237hliZellUicKuG1/LcCu4ogv1xW28OCcvOTL-foo.png", "image/png");

Expand Down Expand Up @@ -591,7 +591,7 @@ public async void DeleteAttachment()
});
}))
{
using (var client = new MondoClient(server.HttpClient, "testAccessToken"))
using (var client = new MonzoClient(server.HttpClient, "testAccessToken"))
{
await client.DeleteAttachmentAsync("attach_00009238aOAIvVqfb9LrZh");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using NUnit.Framework;

namespace Mondo.Tests
namespace Monzo.Tests
{
[TestFixture]
public sealed class PaginationOptionsTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mondo.Client.Tests")]
[assembly: AssemblyTitle("Monzo.Client.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mondo.Client.Tests")]
[assembly: AssemblyProduct("Monzo.Client.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Mondo.sln → Monzo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mondo.Tests", "Mondo.Tests\Mondo.Tests.csproj", "{25B2F959-FD51-4B9B-BEF1-FAD94E1FE74F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monzo.Tests", "Monzo.Tests\Monzo.Tests.csproj", "{25B2F959-FD51-4B9B-BEF1-FAD94E1FE74F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mondo", "Mondo\Mondo.csproj", "{CE64E281-A9D8-43C8-BD1A-A2F095A99252}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monzo", "Monzo\Monzo.csproj", "{CE64E281-A9D8-43C8-BD1A-A2F095A99252}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4D96586C-1BF7-4C81-9050-62CD68AF8C8D}"
ProjectSection(SolutionItems) = preProject
Expand Down
4 changes: 2 additions & 2 deletions Mondo/AccessToken.cs → Monzo/AccessToken.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Diagnostics;
using Newtonsoft.Json;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Mondo access token response.
/// Monzo access token response.
/// </summary>
[DebuggerDisplay("[{Value,nq}]")]
public sealed class AccessToken
Expand Down
2 changes: 1 addition & 1 deletion Mondo/Account.cs → Monzo/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Diagnostics;
using Newtonsoft.Json;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Accounts represent a store of funds, and have a list of transactions.
Expand Down
4 changes: 2 additions & 2 deletions Mondo/Attachment.cs → Monzo/Attachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Diagnostics;
using Newtonsoft.Json;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Images (eg. receipts) can be attached to transactions by uploading these via the attachment API. Once an attachment is registered against a transaction, the image will be shown in the transaction detail screen within the Mondo app.
/// Images (eg. receipts) can be attached to transactions by uploading these via the attachment API. Once an attachment is registered against a transaction, the image will be shown in the transaction detail screen within the Monzo app.
/// </summary>
[DebuggerDisplay("[{Id,nq}]")]
public sealed class Attachment
Expand Down
2 changes: 1 addition & 1 deletion Mondo/Balance.cs → Monzo/Balance.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics;
using Newtonsoft.Json;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Information about an account�s balance.
Expand Down
4 changes: 2 additions & 2 deletions Mondo/ErrorResponse.cs → Monzo/ErrorResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Diagnostics;
using Newtonsoft.Json;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Mondo API error response message.
/// Monzo API error response message.
/// </summary>
[DebuggerDisplay("[{Error}]")]
public sealed class ErrorResponse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Mondo.Extensions
namespace Monzo.Extensions
{
internal static class DateTimeExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using System.Threading;
using System.Threading.Tasks;

namespace Mondo
namespace Monzo
{
/// <summary>
/// Mondo API authorization client.
/// Monzo API authorization client.
/// </summary>
public interface IMondoAuthorizationClient : IDisposable
public interface IMonzoAuthorizationClient : IDisposable
{
/// <summary>
/// Your client ID.
Expand All @@ -20,7 +20,7 @@ public interface IMondoAuthorizationClient : IDisposable
string ClientSecret { get; }

/// <summary>
/// Generates a Mondo OAuth authorization URL based on state and redirect.
/// Generates a Monzo OAuth authorization URL based on state and redirect.
/// </summary>
/// <param name="state">State which will be passed back to you to prevent tampering.</param>
/// <param name="redirectUri">The URI we will redirect back to after an authorization by the resource owner.</param>
Expand All @@ -37,7 +37,7 @@ public interface IMondoAuthorizationClient : IDisposable
Task<AccessToken> GetAccessTokenAsync(string authorizationCode, string redirectUri, CancellationToken cancellationToken = new CancellationToken());

/// <summary>
/// Acquires an OAuth2.0 access token. An access token is tied to both your application (the client) and an individual Mondo user and is valid for several hours.
/// Acquires an OAuth2.0 access token. An access token is tied to both your application (the client) and an individual Monzo user and is valid for several hours.
/// </summary>
/// <param name="username">The user’s email address.</param>
/// <param name="password">The user’s password.</param>
Expand Down
8 changes: 4 additions & 4 deletions Mondo/IMondoClient.cs → Monzo/IMonzoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Threading;
using System.Threading.Tasks;

namespace Mondo
namespace Monzo
{
/// <summary>
/// An authenticated Mondo API client.
/// An authenticated Monzo API client.
/// </summary>
public interface IMondoClient : IDisposable
public interface IMonzoClient : IDisposable
{
/// <summary>
/// Your OAuth 2.0 access token.
Expand Down Expand Up @@ -93,7 +93,7 @@ public interface IMondoClient : IDisposable
Task<Attachment> UploadAttachmentAsync(string filename, string fileType, string externalId, Stream stream, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Once you have obtained a URL for an attachment, either by uploading to the upload_url obtained from the upload endpoint above or by hosting a remote image, this URL can then be registered against a transaction. Once an attachment is registered against a transaction this will be displayed on the detail page of a transaction within the Mondo app.
/// Once you have obtained a URL for an attachment, either by uploading to the upload_url obtained from the upload endpoint above or by hosting a remote image, this URL can then be registered against a transaction. Once an attachment is registered against a transaction this will be displayed on the detail page of a transaction within the Monzo app.
/// </summary>
/// <param name="externalId">The id of the transaction to associate the attachment with.</param>
/// <param name="fileUrl">The URL of the uploaded attachment.</param>
Expand Down
Loading