diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5b8b39a..37dfa50 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,7 +4,7 @@ Describe the big picture of your changes here to communicate to the maintainers ## Types of changes -What types of changes does your code introduce to IpData? +What types of changes does your code introduce to IPData? _Put an `x` in the boxes that apply_ - [ ] Bugfix (non-breaking change which fixes an issue) @@ -15,7 +15,7 @@ _Put an `x` in the boxes that apply_ _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ -- [ ] I have read the [CONTRIBUTING](https://github.com/alexkhil/IpData/blob/master/.github/CONTRIBUTING.md) doc +- [ ] I have read the [CONTRIBUTING](https://github.com/alexkhil/IPData/blob/master/.github/CONTRIBUTING.md) doc - [ ] Lint and unit tests pass locally with my changes - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if appropriate) diff --git a/.github/README.md b/.github/README.md index 91102a7..562dec7 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,6 +1,8 @@ -# ipdata -[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/alexkhil/IpData/blob/master/LICENSE) [![IpData](https://img.shields.io/nuget/v/IpData.svg)](https://www.nuget.org/packages/IpData/) [![Build Status](https://dev.azure.com/alexkhildev/IpData/_apis/build/status/outer-loop?branchName=master)](https://dev.azure.com/alexkhildev/IpData/_build/latest?definitionId=4?branchName=master) [![Coverage Status](https://img.shields.io/azure-devops/coverage/alexkhildev/ipdata/4/master)](https://img.shields.io/azure-devops/coverage/alexkhildev/ipdata/4/master) +# ipdata +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/alexkhil/IPData/blob/master/LICENSE) [![IPData](https://img.shields.io/nuget/v/IPData.svg)](https://www.nuget.org/packages/IPData/) + +> **v3.0.0 Breaking Changes** — All public types have been renamed to follow .NET naming conventions for two-letter acronyms. See the [Migration Guide](#migrating-from-v2-to-v3) for details. [ipdata.co](https://ipdata.co/) is a fast, reliable and clean service that allows you to look up the location of an IP Address and other data. @@ -17,6 +19,7 @@ - [Currency](#currency) - [Threat](#threat) - [EU Endpoint](#eu-endpoint) +- [Migrating from v2 to v3](#migrating-from-v2-to-v3) - [Contributing](#contributing) - [Versioning](#versioning) - [License](#license) @@ -26,13 +29,13 @@ NuGet package install using package manager: ```bash -Install-Package IpData -Version 2.0.1 +Install-Package IPData -Version 3.0.0 ``` NuGet package install using .NET CLI: ```bash -dotnet add package IpData --version 2.0.1 +dotnet add package IPData --version 3.0.0 ``` ## Lookup @@ -42,11 +45,11 @@ All usage examples you can find on `samples` folder. ### Basic ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); // Get IP data from my IP -var myIpInfo = await client.Lookup(); -Console.WriteLine($"Country name for {myIpInfo.Ip} is {myIpInfo.CountryName}"); +var myIp = await client.Lookup(); +Console.WriteLine($"Country name for {myIp.Ip} is {myIp.CountryName}"); // Get IP data from IP var ipInfo = await client.Lookup("8.8.8.8"); @@ -67,7 +70,7 @@ From ipdata.co docs: > Note that bulk lookups are only available to paid users and are currently limited to a 100 at a time. Reach out to support if you need to lookup larger batches. ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var ipInfoList = await client.Lookup(new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" }); foreach (var ipInfo in ipInfoList) @@ -79,7 +82,7 @@ foreach (var ipInfo in ipInfoList) ### Carrier ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var carrierInfo = await client.Carrier("69.78.70.144"); Console.WriteLine($"Carrier name: {carrierInfo.Name}"); @@ -88,7 +91,7 @@ Console.WriteLine($"Carrier name: {carrierInfo.Name}"); ### Company ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var companyInfo = await client.Company("69.78.70.144"); Console.WriteLine($"Company name: {companyInfo.Name}"); @@ -97,7 +100,7 @@ Console.WriteLine($"Company name: {companyInfo.Name}"); ### ASN ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var asnInfo = await client.Asn("69.78.70.144"); Console.WriteLine($"ASN name: {asnInfo.Name}"); @@ -106,7 +109,7 @@ Console.WriteLine($"ASN name: {asnInfo.Name}"); ### Timezone ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var timezoneInfo = await client.TimeZone("69.78.70.144"); Console.WriteLine($"TimeZone name: {timezoneInfo.Name}"); @@ -115,7 +118,7 @@ Console.WriteLine($"TimeZone name: {timezoneInfo.Name}"); ### Currency ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var currencyInfo = await client.Currency("69.78.70.144"); Console.WriteLine($"Currency name: {currencyInfo.Name}"); @@ -124,7 +127,7 @@ Console.WriteLine($"Currency name: {currencyInfo.Name}"); ### Threat ```csharp -var client = new IpDataClient("API_KEY"); +var client = new IPDataClient("API_KEY"); var threatInfo = await client.Threat("69.78.70.144"); Console.WriteLine($"Threat is Tor: {threatInfo.IsTor}"); @@ -135,11 +138,52 @@ Console.WriteLine($"Threat is Tor: {threatInfo.IsTor}"); To ensure your data stays in the EU, use the EU endpoint by passing a custom base URL: ```csharp -var client = new IpDataClient("API_KEY", new Uri("https://eu-api.ipdata.co")); +var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co")); var ipInfo = await client.Lookup("8.8.8.8"); ``` +## Migrating from v2 to v3 + +v3.0.0 renames all public types to follow [.NET naming conventions](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions) for two-letter acronyms. It also adds EU endpoint support and a `Company` lookup. + +### Renamed types + +| v2 | v3 | +|---|---| +| `IpDataClient` | `IPDataClient` | +| `IIpDataClient` | `IIPDataClient` | +| `IpInfo` | `IPLookupResult` | + +### Namespace change + +```diff +- using IpData; +- using IpData.Models; ++ using IPData; ++ using IPData.Models; +``` + +### NuGet package + +The package ID has changed from `IpData` to `IPData`: + +```bash +dotnet remove package IpData +dotnet add package IPData --version 3.0.0 +``` + +### New features in v3 + +- **EU endpoint** — Pass a custom base URL to route requests through EU servers: + ```csharp + var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co")); + ``` +- **Company lookup** — Fetch company info for an IP: + ```csharp + var companyInfo = await client.Company("8.8.8.8"); + ``` + ## Contributing Please read [CONTRIBUTING.md][CONTRIBUTING] for details on our code of conduct, and the process for submitting pull requests to us. @@ -153,8 +197,8 @@ We use [SemVer] for versioning. For the versions available, see the tags on this This project is licensed under the MIT License - see the [LICENSE.md][LICENSE] file for details -[AzureStatus]: https://dev.azure.com/alexkhildev/IpData/_apis/build/status/gated?branchName=master -[IpDataLogo]: https://image.ibb.co/iDQdUS/ipdatalogo.png +[AzureStatus]: https://dev.azure.com/alexkhildev/IPData/_apis/build/status/gated?branchName=master +[IPDataLogo]: https://image.ibb.co/iDQdUS/ipdatalogo.png [SemVer]: http://semver.org/ -[CONTRIBUTING]: https://github.com/alexkhil/IpData/blob/master/.github/CONTRIBUTING.md -[LICENSE]: https://github.com/alexkhil/IpData/blob/master/LICENSE +[CONTRIBUTING]: https://github.com/alexkhil/IPData/blob/master/.github/CONTRIBUTING.md +[LICENSE]: https://github.com/alexkhil/IPData/blob/master/LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b829fa5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d1e87b1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish to NuGet + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Pack + run: dotnet pack src/IPData/IPData.csproj --configuration Release --no-build --output ./nupkg + + - name: Publish to NuGet + run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/IpData.sln b/IPData.sln similarity index 56% rename from IpData.sln rename to IPData.sln index a4238f5..6c5dbed 100644 --- a/IpData.sln +++ b/IPData.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28902.138 @@ -9,43 +9,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E961 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{CFFA9471-EC37-451E-BA20-3DA090F0A683}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tasks", "Tasks", "{C0FF3B0D-BE20-4F54-ACD3-D8B45CAD5B57}" - ProjectSection(SolutionItems) = preProject - build\cake\Tasks\build.cake = build\cake\Tasks\build.cake - build\cake\Tasks\clean.cake = build\cake\Tasks\clean.cake - build\cake\Tasks\create-nuget-package.cake = build\cake\Tasks\create-nuget-package.cake - build\cake\Tasks\default.cake = build\cake\Tasks\default.cake - build\cake\Tasks\publish-nuget-package.cake = build\cake\Tasks\publish-nuget-package.cake - build\cake\Tasks\restore-nuget-packages.cake = build\cake\Tasks\restore-nuget-packages.cake - build\cake\Tasks\run-unit-tests.cake = build\cake\Tasks\run-unit-tests.cake - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cake", "cake", "{5CF04261-17B9-44F2-AD3F-C19C92796442}" - ProjectSection(SolutionItems) = preProject - build\cake\build.cake = build\cake\build.cake - build\cake\build.ps1 = build\cake\build.ps1 - build\cake\build.sh = build\cake\build.sh - build\cake\cake.config = build\cake\cake.config - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unit", "Unit", "{6F037AC1-A8B5-4D89-B33A-BCDDB78553A6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData", "src\IpData\IpData.csproj", "{7EE175C0-1309-4AA7-BC80-2F01A3855D9A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData.Tests", "test\Unit\IpData.Tests\IpData.Tests.csproj", "{65B7BCF3-82C8-480E-ADC3-B45DD67BD565}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{049BFCD0-AD71-4357-91CF-62CC03D8FB39}" - ProjectSection(SolutionItems) = preProject - build\cake\tools\packages.config = build\cake\tools\packages.config - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData", "src\IPData\IPData.csproj", "{7EE175C0-1309-4AA7-BC80-2F01A3855D9A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-devops", "azure-devops", "{3A111F6A-56C3-4952-B45F-5CDA714D059F}" - ProjectSection(SolutionItems) = preProject - build\azure-devops\gated.yaml = build\azure-devops\gated.yaml - build\azure-devops\outer-loop.yaml = build\azure-devops\outer-loop.yaml - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData.Tests", "test\Unit\IPData.Tests\IPData.Tests.csproj", "{65B7BCF3-82C8-480E-ADC3-B45DD67BD565}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{3B7FCB46-B3B6-41EF-9495-3FA4D027E3FC}" ProjectSection(SolutionItems) = preProject @@ -61,11 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM .github\ISSUE_TEMPLATE\Feature_request.md = .github\ISSUE_TEMPLATE\Feature_request.md EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{4C55C81D-E924-4BA9-9A6C-92B74EC4F7AE}" - ProjectSection(SolutionItems) = preProject - build\cake\Utils\paths.cake = build\cake\Utils\paths.cake - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{70F5FBDA-9DAA-4675-938E-EC6E450852CE}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -73,7 +36,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution LICENSE = LICENSE EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData.Lookup", "samples\IpData.Lookup\IpData.Lookup.csproj", "{3546F4B5-7D43-4332-914A-6A657D95CEB1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData.Lookup", "samples\IPData.Lookup\IPData.Lookup.csproj", "{3546F4B5-7D43-4332-914A-6A657D95CEB1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -98,15 +61,10 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C0FF3B0D-BE20-4F54-ACD3-D8B45CAD5B57} = {5CF04261-17B9-44F2-AD3F-C19C92796442} - {5CF04261-17B9-44F2-AD3F-C19C92796442} = {CFFA9471-EC37-451E-BA20-3DA090F0A683} - {6F037AC1-A8B5-4D89-B33A-BCDDB78553A6} = {0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18} {7EE175C0-1309-4AA7-BC80-2F01A3855D9A} = {6EF86008-5993-4F7A-8B4B-F30A85BC6EE8} {65B7BCF3-82C8-480E-ADC3-B45DD67BD565} = {6F037AC1-A8B5-4D89-B33A-BCDDB78553A6} - {049BFCD0-AD71-4357-91CF-62CC03D8FB39} = {5CF04261-17B9-44F2-AD3F-C19C92796442} - {3A111F6A-56C3-4952-B45F-5CDA714D059F} = {CFFA9471-EC37-451E-BA20-3DA090F0A683} + {6F037AC1-A8B5-4D89-B33A-BCDDB78553A6} = {0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18} {C92F6AF1-C354-4965-AD3C-938BC870F853} = {3B7FCB46-B3B6-41EF-9495-3FA4D027E3FC} - {4C55C81D-E924-4BA9-9A6C-92B74EC4F7AE} = {5CF04261-17B9-44F2-AD3F-C19C92796442} {3546F4B5-7D43-4332-914A-6A657D95CEB1} = {E961F502-9430-4E81-95AE-C202E0AE643F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/build/azure-devops/gated.yaml b/build/azure-devops/gated.yaml deleted file mode 100644 index f2036b0..0000000 --- a/build/azure-devops/gated.yaml +++ /dev/null @@ -1,14 +0,0 @@ -jobs: -- job: Linux - displayName: 'Build PR' - - pool: - vmImage: ubuntu-16.04 - - steps: - - bash: chmod +x ./build/cake/build.sh - displayName: Grant permissions - - bash: ./build/cake/build.sh - \-s build/cake/build.cake - \--target=Gated - displayName: 'Run Gated Build' \ No newline at end of file diff --git a/build/azure-devops/outer-loop.yaml b/build/azure-devops/outer-loop.yaml deleted file mode 100644 index 516f5f6..0000000 --- a/build/azure-devops/outer-loop.yaml +++ /dev/null @@ -1,28 +0,0 @@ -jobs: -- job: Windows - displayName: 'Build master' - - pool: - vmImage: vs2017-win2016 - - steps: - - powershell: ./build/cake/build.ps1 - -Script build/cake/build.cake - -Target Outer-Loop - displayName: 'Run Outer Loop' - - - task: PublishTestResults@2 - displayName: Publish Unit Tests Results - inputs: - testResultsFormat: VSTest - testResultsFiles: '**/*.trx' - mergeTestResults: true - testRunTitle: Linux - - - task: PublishCodeCoverageResults@1 - displayName: Publish Code Coverage Results - inputs: - codeCoverageTool: 'Cobertura' - summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/artifacts/coverage.cobertura.xml' - pathToSources: '$(System.DefaultWorkingDirectory)/src/IpData' - reportDirectory: '$(System.DefaultWorkingDirectory)/**/artifacts' \ No newline at end of file diff --git a/build/cake/Tasks/build.cake b/build/cake/Tasks/build.cake deleted file mode 100644 index b03aea4..0000000 --- a/build/cake/Tasks/build.cake +++ /dev/null @@ -1,10 +0,0 @@ -Task("Build") - .IsDependentOn("Restore-NuGet-Packages") - .Does(() => { - var dotNetCoreBuildSettings = new DotNetCoreBuildSettings { - Configuration = configuration, - NoRestore = true - }; - - DotNetCoreBuild(Paths.Solution.FullPath, dotNetCoreBuildSettings); - }); \ No newline at end of file diff --git a/build/cake/Tasks/clean.cake b/build/cake/Tasks/clean.cake deleted file mode 100644 index b3236bb..0000000 --- a/build/cake/Tasks/clean.cake +++ /dev/null @@ -1,23 +0,0 @@ -Task("Clean") - .Does(() => { - Information("Artifacts:"); - - CleanDirectories(Paths.Artifacts.FullPath); - Information(Paths.Artifacts.FullPath); - - Information("Source:"); - - CleanDirectories("../../src/**/bin"); - Information("../../src/**/bin"); - - CleanDirectories("../../src/**/obj"); - Information("../../src/**/obj"); - - Information("Test:"); - - CleanDirectories("../../test/**/bin"); - Information("../../test/**/bin"); - - CleanDirectories("../../test/**/obj"); - Information("../../test/**/obj"); - }); \ No newline at end of file diff --git a/build/cake/Tasks/create-nuget-package.cake b/build/cake/Tasks/create-nuget-package.cake deleted file mode 100644 index c6fa36c..0000000 --- a/build/cake/Tasks/create-nuget-package.cake +++ /dev/null @@ -1,16 +0,0 @@ -Task("Create-NuGet-Package") - .IsDependentOn("Run-Unit-Tests") - .Does(() => - { - var settings = new NuGetPackSettings - { - OutputDirectory = Paths.Artifacts, - IncludeReferencedProjects = true, - Properties = new Dictionary - { - { "Configuration", configuration } - } - }; - - NuGetPack(Paths.Project, settings); - }); \ No newline at end of file diff --git a/build/cake/Tasks/default.cake b/build/cake/Tasks/default.cake deleted file mode 100644 index abc6ddd..0000000 --- a/build/cake/Tasks/default.cake +++ /dev/null @@ -1,22 +0,0 @@ -Task("Default") - .IsDependentOn("Build"); - -Task("Gated") - .IsDependentOn("Clean") - .IsDependentOn("Restore-NuGet-Packages") - .IsDependentOn("Build") - .IsDependentOn("Run-Unit-Tests"); - -Task("Outer-Loop") - .IsDependentOn("Clean") - .IsDependentOn("Restore-NuGet-Packages") - .IsDependentOn("Build") - .IsDependentOn("Run-Unit-Tests"); - -Task("Release") - .IsDependentOn("Clean") - .IsDependentOn("Restore-NuGet-Packages") - .IsDependentOn("Build") - .IsDependentOn("Run-Unit-Tests") - .IsDependentOn("Create-NuGet-Package") - .IsDependentOn("Publish-NuGet-Package"); \ No newline at end of file diff --git a/build/cake/Tasks/publish-nuget-package.cake b/build/cake/Tasks/publish-nuget-package.cake deleted file mode 100644 index c9dbafb..0000000 --- a/build/cake/Tasks/publish-nuget-package.cake +++ /dev/null @@ -1,15 +0,0 @@ -Task("Publish-NuGet-Package") - .IsDependentOn("Create-NuGet-Package") - .Does(() => - { - var packages = GetFiles("../../artifacts/IpData.*.nupkg"); - - NuGetPush(packages, new NuGetPushSettings { - Source = "https://api.nuget.org/v3/index.json", - ApiKey = nugetApiKey - }); - }) - .OnError(ex => - { - Information(ex.Message); - }); \ No newline at end of file diff --git a/build/cake/Tasks/restore-nuget-packages.cake b/build/cake/Tasks/restore-nuget-packages.cake deleted file mode 100644 index be20d43..0000000 --- a/build/cake/Tasks/restore-nuget-packages.cake +++ /dev/null @@ -1,5 +0,0 @@ -Task("Restore-NuGet-Packages") - .IsDependentOn("Clean") - .Does(() => { - DotNetCoreRestore(Paths.Solution.FullPath); - }); \ No newline at end of file diff --git a/build/cake/Tasks/run-unit-tests.cake b/build/cake/Tasks/run-unit-tests.cake deleted file mode 100644 index e55bcfe..0000000 --- a/build/cake/Tasks/run-unit-tests.cake +++ /dev/null @@ -1,22 +0,0 @@ -Task("Run-Unit-Tests") - .IsDependentOn("Build") - .Does(() => - { - var dotNetCoreTestSettings = new DotNetCoreTestSettings - { - Configuration = configuration, - NoRestore = true, - NoBuild = true, - ResultsDirectory = Paths.Artifacts.FullPath, - ArgumentCustomization = args => - { - args.Append("--logger trx;LogFileName=UnitTests.trx"); - args.Append("/p:CollectCoverage=true /p:CoverletOutputFormat=opencover%2Ccobertura"); - args.Append($"/p:CoverletOutput=\"../{Paths.Artifacts.FullPath}/\""); - args.Append("/p:Include=\"[IpData]*\""); - return args; - } - }; - - DotNetCoreTest(Paths.UnitTestProject.FullPath, dotNetCoreTestSettings); - }); \ No newline at end of file diff --git a/build/cake/Utils/paths.cake b/build/cake/Utils/paths.cake deleted file mode 100644 index 99471d3..0000000 --- a/build/cake/Utils/paths.cake +++ /dev/null @@ -1,9 +0,0 @@ -public static class Paths -{ - public static FilePath Solution => "../../IpData.sln"; - public static FilePath Project => "../../src/IpData/IpData.csproj"; - public static FilePath MiniCover => "../../tools/IpData.Minicover/IpData.Minicover.csproj"; - public static FilePath UnitTestProject => "../../test/Unit/IpData.Tests/IpData.Tests.csproj"; - - public static DirectoryPath Artifacts => "../../artifacts"; -} \ No newline at end of file diff --git a/build/cake/build.cake b/build/cake/build.cake deleted file mode 100644 index 9129cc4..0000000 --- a/build/cake/build.cake +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// ADDINS -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// TOOLS -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// OTHER SCRIPTS -/////////////////////////////////////////////////////////////////////////////// -#load Utils/paths.cake - -/////////////////////////////////////////////////////////////////////////////// -// ARGUMENTS -/////////////////////////////////////////////////////////////////////////////// - -var target = Argument("Target", "Default"); -var configuration = Argument("Configuration", "Release"); -var packageOutputPath = Argument("PackageOutputPath", "packages"); -var nugetApiKey = Argument("NugetApiKey", "NUGET_API_KEY"); -var coverageFile = new FilePath($"../{Paths.Artifacts.FullPath}/coverage.opencover.xml"); - -/////////////////////////////////////////////////////////////////////////////// -// TASKS -/////////////////////////////////////////////////////////////////////////////// - -#load Tasks/clean.cake -#load Tasks/create-nuget-package.cake -#load Tasks/restore-nuget-packages.cake -#load Tasks/publish-nuget-package.cake -#load Tasks/build.cake -#load Tasks/run-unit-tests.cake -#load Tasks/default.cake - -/////////////////////////////////////////////////////////////////////////////// -// RUN -/////////////////////////////////////////////////////////////////////////////// - -RunTarget(target); \ No newline at end of file diff --git a/build/cake/build.ps1 b/build/cake/build.ps1 deleted file mode 100644 index 56df93b..0000000 --- a/build/cake/build.ps1 +++ /dev/null @@ -1,256 +0,0 @@ -########################################################################## -# This is the Cake bootstrapper script for PowerShell. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## - -<# - -.SYNOPSIS -This is a Powershell script to bootstrap a Cake build. - -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) -and execute your Cake build script with the parameters you provide. - -.PARAMETER Script -The build script to execute. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER ShowDescription -Shows description about tasks. -.PARAMETER DryRun -Performs a dry run. -.PARAMETER SkipToolPackageRestore -Skips restoring of packages. -.PARAMETER ScriptArgs -Remaining arguments are added here. - -.LINK -https://cakebuild.net - -#> - -[CmdletBinding()] -Param( - [string]$Script = "build.cake", - [string]$Target, - [string]$Configuration, - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity, - [switch]$ShowDescription, - [Alias("WhatIf", "Noop")] - [switch]$DryRun, - [switch]$SkipToolPackageRestore, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -# Attempt to set highest encryption available for SecurityProtocol. -# PowerShell will not set this by default (until maybe .NET 4.6.x). This -# will typically produce a message for PowerShell v2 (just an info -# message though) -try { - # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) - # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't - # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is - # installed (.NET 4.5 is an in-place upgrade). - # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that. - if (-not $IsCoreCLR) { - [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 - } - } catch { - Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' - } - -[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null -function MD5HashFile([string] $filePath) -{ - if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) - { - return $null - } - - [System.IO.Stream] $file = $null; - [System.Security.Cryptography.MD5] $md5 = $null; - try - { - $md5 = [System.Security.Cryptography.MD5]::Create() - $file = [System.IO.File]::OpenRead($filePath) - return [System.BitConverter]::ToString($md5.ComputeHash($file)) - } - finally - { - if ($file -ne $null) - { - $file.Dispose() - } - } -} - -function GetProxyEnabledWebClient -{ - $wc = New-Object System.Net.WebClient - $proxy = [System.Net.WebRequest]::GetSystemWebProxy() - $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials - $wc.Proxy = $proxy - return $wc -} - -Write-Host "Preparing to run build script..." - -if(!$PSScriptRoot){ - $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -} - -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" -$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" -$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" -$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" -$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" -$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" -$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" - -# Make sure tools folder exists -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type Directory | Out-Null -} - -# Make sure that packages.config exist. -if (!(Test-Path $PACKAGES_CONFIG)) { - Write-Verbose -Message "Downloading packages.config..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) - } catch { - Throw "Could not download packages.config." - } -} - -# Try find NuGet.exe in path if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } - $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 - if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { - Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." - $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName - } -} - -# Try download NuGet.exe if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Downloading NuGet.exe..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile($NUGET_URL, $NUGET_EXE) - } catch { - Throw "Could not download NuGet.exe." - } -} - -# Save nuget.exe path to environment to be available to child processed -$env:NUGET_EXE = $NUGET_EXE -$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { - "mono `"$NUGET_EXE`"" -} else { - "`"$NUGET_EXE`"" -} - -# Restore tools from NuGet? -if(-Not $SkipToolPackageRestore.IsPresent) { - Push-Location - Set-Location $TOOLS_DIR - - # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG - if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { - Write-Verbose -Message "Missing or changed package.config hash..." - Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | - Remove-Item -Recurse -Force - } - - Write-Verbose -Message "Restoring tools from NuGet..." - - $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet tools." - } - else - { - $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" - } - Write-Verbose -Message ($NuGetOutput | Out-String) - - Pop-Location -} - -# Restore addins from NuGet -if (Test-Path $ADDINS_PACKAGES_CONFIG) { - Push-Location - Set-Location $ADDINS_DIR - - Write-Verbose -Message "Restoring addins from NuGet..." - $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet addins." - } - - Write-Verbose -Message ($NuGetOutput | Out-String) - - Pop-Location -} - -# Restore modules from NuGet -if (Test-Path $MODULES_PACKAGES_CONFIG) { - Push-Location - Set-Location $MODULES_DIR - - Write-Verbose -Message "Restoring modules from NuGet..." - $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet modules." - } - - Write-Verbose -Message ($NuGetOutput | Out-String) - - Pop-Location -} - -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe at $CAKE_EXE" -} - -$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { - "mono `"$CAKE_EXE`"" -} else { - "`"$CAKE_EXE`"" -} - - # Build an array (not a string) of Cake arguments to be joined later -$cakeArguments = @() -if ($Script) { $cakeArguments += "`"$Script`"" } -if ($Target) { $cakeArguments += "-target=`"$Target`"" } -if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } -if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } -if ($ShowDescription) { $cakeArguments += "-showdescription" } -if ($DryRun) { $cakeArguments += "-dryrun" } -$cakeArguments += $ScriptArgs - -# Start Cake -Write-Host "Running build script..." -Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")" -exit $LASTEXITCODE \ No newline at end of file diff --git a/build/cake/build.sh b/build/cake/build.sh deleted file mode 100644 index 29123e1..0000000 --- a/build/cake/build.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - -########################################################################## -# This is the Cake bootstrapper script for Linux and OS X. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## - -# Define directories. -SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -TOOLS_DIR=$SCRIPT_DIR/tools -ADDINS_DIR=$TOOLS_DIR/Addins -MODULES_DIR=$TOOLS_DIR/Modules -NUGET_EXE=$TOOLS_DIR/nuget.exe -CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe -PACKAGES_CONFIG=$TOOLS_DIR/packages.config -PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum -ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config -MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config - -# Define md5sum or md5 depending on Linux/OSX -MD5_EXE= -if [[ "$(uname -s)" == "Darwin" ]]; then - MD5_EXE="md5 -r" -else - MD5_EXE="md5sum" -fi - -# Define default arguments. -SCRIPT="build.cake" -CAKE_ARGUMENTS=() - -# Parse arguments. -for i in "$@"; do - case $1 in - -s|--script) SCRIPT="$2"; shift ;; - --) shift; CAKE_ARGUMENTS+=("$@"); break ;; - *) CAKE_ARGUMENTS+=("$1") ;; - esac - shift -done - -# Make sure the tools folder exist. -if [ ! -d "$TOOLS_DIR" ]; then - mkdir "$TOOLS_DIR" -fi - -# Make sure that packages.config exist. -if [ ! -f "$TOOLS_DIR/packages.config" ]; then - echo "Downloading packages.config..." - curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages - if [ $? -ne 0 ]; then - echo "An error occurred while downloading packages.config." - exit 1 - fi -fi - -# Download NuGet if it does not exist. -if [ ! -f "$NUGET_EXE" ]; then - echo "Downloading NuGet..." - curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - if [ $? -ne 0 ]; then - echo "An error occurred while downloading nuget.exe." - exit 1 - fi -fi - -# Restore tools from NuGet. -pushd "$TOOLS_DIR" >/dev/null -if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then - find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf -fi - -mono "$NUGET_EXE" install -ExcludeVersion -if [ $? -ne 0 ]; then - echo "Could not restore NuGet tools." - exit 1 -fi - -$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" - -popd >/dev/null - -# Restore addins from NuGet. -if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then - pushd "$ADDINS_DIR" >/dev/null - - mono "$NUGET_EXE" install -ExcludeVersion - if [ $? -ne 0 ]; then - echo "Could not restore NuGet addins." - exit 1 - fi - - popd >/dev/null -fi - -# Restore modules from NuGet. -if [ -f "$MODULES_PACKAGES_CONFIG" ]; then - pushd "$MODULES_DIR" >/dev/null - - mono "$NUGET_EXE" install -ExcludeVersion - if [ $? -ne 0 ]; then - echo "Could not restore NuGet modules." - exit 1 - fi - - popd >/dev/null -fi - -# Make sure that Cake has been installed. -if [ ! -f "$CAKE_EXE" ]; then - echo "Could not find Cake.exe at '$CAKE_EXE'." - exit 1 -fi - -# Start Cake -exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" \ No newline at end of file diff --git a/build/cake/cake.config b/build/cake/cake.config deleted file mode 100644 index c6a84fa..0000000 --- a/build/cake/cake.config +++ /dev/null @@ -1,12 +0,0 @@ -[Nuget] -Source=https://api.nuget.org/v3/index.json -UseInProcessClient=true -LoadDependencies=false - -[Paths] -Tools=./tools -Addins=./tools/Addins -Modules=./tools/Modules - -[Settings] -SkipVerification=false \ No newline at end of file diff --git a/build/cake/tools/packages.config b/build/cake/tools/packages.config deleted file mode 100644 index cedcc6a..0000000 --- a/build/cake/tools/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/samples/IpData.Lookup/IpData.Lookup.csproj b/samples/IPData.Lookup/IPData.Lookup.csproj similarity index 81% rename from samples/IpData.Lookup/IpData.Lookup.csproj rename to samples/IPData.Lookup/IPData.Lookup.csproj index 58514bc..810e792 100644 --- a/samples/IpData.Lookup/IpData.Lookup.csproj +++ b/samples/IPData.Lookup/IPData.Lookup.csproj @@ -9,7 +9,7 @@ - + diff --git a/samples/IpData.Lookup/Program.cs b/samples/IPData.Lookup/Program.cs similarity index 87% rename from samples/IpData.Lookup/Program.cs rename to samples/IPData.Lookup/Program.cs index 61f3e3d..e2696e7 100644 --- a/samples/IpData.Lookup/Program.cs +++ b/samples/IPData.Lookup/Program.cs @@ -2,17 +2,17 @@ using System.Globalization; using System.Threading.Tasks; -namespace IpData.Lookup +namespace IPData.Lookup { public static class Program { public static async Task Main() { - var client = new IpDataClient("API_KEY"); + var client = new IPDataClient("API_KEY"); // Get IP data from my IP - var myIpInfo = await client.Lookup(); - Console.WriteLine($"Country name for {myIpInfo.Ip} is {myIpInfo.CountryName}"); + var myIPLookupResult = await client.Lookup(); + Console.WriteLine($"Country name for {myIPLookupResult.Ip} is {myIPLookupResult.CountryName}"); // Get IP data from IP var ipInfo = await client.Lookup("8.8.8.8"); diff --git a/src/IpData/Exceptions/ApiException.cs b/src/IPData/Exceptions/ApiException.cs similarity index 94% rename from src/IpData/Exceptions/ApiException.cs rename to src/IPData/Exceptions/ApiException.cs index 6f174db..e4424b5 100644 --- a/src/IpData/Exceptions/ApiException.cs +++ b/src/IPData/Exceptions/ApiException.cs @@ -2,10 +2,10 @@ using System.Diagnostics.CodeAnalysis; using System.Net; using System.Runtime.Serialization; -using IpData.Http.Serializer; -using IpData.Models; +using IPData.Http.Serializer; +using IPData.Models; -namespace IpData.Exceptions +namespace IPData.Exceptions { [Serializable] public class ApiException : Exception diff --git a/src/IpData/Exceptions/BadRequestException.cs b/src/IPData/Exceptions/BadRequestException.cs similarity index 96% rename from src/IpData/Exceptions/BadRequestException.cs rename to src/IPData/Exceptions/BadRequestException.cs index 2686a3d..d00c112 100644 --- a/src/IpData/Exceptions/BadRequestException.cs +++ b/src/IPData/Exceptions/BadRequestException.cs @@ -3,7 +3,7 @@ using System.Net; using System.Runtime.Serialization; -namespace IpData.Exceptions +namespace IPData.Exceptions { [Serializable] public class BadRequestException : ApiException diff --git a/src/IpData/Exceptions/Factory/ApiExceptionFactory.cs b/src/IPData/Exceptions/Factory/ApiExceptionFactory.cs similarity index 94% rename from src/IpData/Exceptions/Factory/ApiExceptionFactory.cs rename to src/IPData/Exceptions/Factory/ApiExceptionFactory.cs index 2d4089d..7c07840 100644 --- a/src/IpData/Exceptions/Factory/ApiExceptionFactory.cs +++ b/src/IPData/Exceptions/Factory/ApiExceptionFactory.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Net; -namespace IpData.Exceptions.Factory +namespace IPData.Exceptions.Factory { internal class ApiExceptionFactory : IApiExceptionFactory { diff --git a/src/IpData/Exceptions/Factory/IApiExceptionFactory.cs b/src/IPData/Exceptions/Factory/IApiExceptionFactory.cs similarity index 82% rename from src/IpData/Exceptions/Factory/IApiExceptionFactory.cs rename to src/IPData/Exceptions/Factory/IApiExceptionFactory.cs index 7b518ac..f32a7bf 100644 --- a/src/IpData/Exceptions/Factory/IApiExceptionFactory.cs +++ b/src/IPData/Exceptions/Factory/IApiExceptionFactory.cs @@ -1,7 +1,7 @@ using System; using System.Net; -namespace IpData.Exceptions.Factory +namespace IPData.Exceptions.Factory { internal interface IApiExceptionFactory { diff --git a/src/IpData/Exceptions/ForbiddenException.cs b/src/IPData/Exceptions/ForbiddenException.cs similarity index 96% rename from src/IpData/Exceptions/ForbiddenException.cs rename to src/IPData/Exceptions/ForbiddenException.cs index 226bed1..f95db08 100644 --- a/src/IpData/Exceptions/ForbiddenException.cs +++ b/src/IPData/Exceptions/ForbiddenException.cs @@ -3,7 +3,7 @@ using System.Net; using System.Runtime.Serialization; -namespace IpData.Exceptions +namespace IPData.Exceptions { [Serializable] public class ForbiddenException : ApiException diff --git a/src/IpData/Exceptions/UnauthorizedException.cs b/src/IPData/Exceptions/UnauthorizedException.cs similarity index 96% rename from src/IpData/Exceptions/UnauthorizedException.cs rename to src/IPData/Exceptions/UnauthorizedException.cs index 42cb913..ede2412 100644 --- a/src/IpData/Exceptions/UnauthorizedException.cs +++ b/src/IPData/Exceptions/UnauthorizedException.cs @@ -3,7 +3,7 @@ using System.Net; using System.Runtime.Serialization; -namespace IpData.Exceptions +namespace IPData.Exceptions { [Serializable] public class UnauthorizedException : ApiException diff --git a/src/IpData/Helpers/ApiUrls.cs b/src/IPData/Helpers/ApiUrls.cs similarity index 84% rename from src/IpData/Helpers/ApiUrls.cs rename to src/IPData/Helpers/ApiUrls.cs index 7e4304c..155ed8e 100644 --- a/src/IpData/Helpers/ApiUrls.cs +++ b/src/IPData/Helpers/ApiUrls.cs @@ -2,10 +2,10 @@ using System.Globalization; using System.Linq; using System.Linq.Expressions; -using IpData.Helpers.Extensions; -using IpData.Models; +using IPData.Helpers.Extensions; +using IPData.Models; -namespace IpData.Helpers +namespace IPData.Helpers { internal class ApiUrls { @@ -27,15 +27,15 @@ public Uri Get(string apiKey, string ip, CultureInfo culture) return ApplyApiKey(new Uri(_base, relative), apiKey); } - public Uri Get(string apiKey, string ip, Expression> expression) + public Uri Get(string apiKey, string ip, Expression> expression) { - var field = IpInfo.FieldName(expression); + var field = IPLookupResult.FieldName(expression); return ApplyApiKey(new Uri(_base, $"{ip}/{field}"), apiKey); } - public Uri Get(string apiKey, string ip, params Expression>[] expressions) + public Uri Get(string apiKey, string ip, params Expression>[] expressions) { - var fields = string.Join(",", expressions.Select(IpInfo.FieldName)); + var fields = string.Join(",", expressions.Select(IPLookupResult.FieldName)); return ApplyApiKey(new Uri(_base, $"{ip}").AddParameter(nameof(fields), fields), apiKey); } diff --git a/src/IpData/Helpers/Extensions/ExpressionExtensions.cs b/src/IPData/Helpers/Extensions/ExpressionExtensions.cs similarity index 86% rename from src/IpData/Helpers/Extensions/ExpressionExtensions.cs rename to src/IPData/Helpers/Extensions/ExpressionExtensions.cs index 0bb23c9..c4394b4 100644 --- a/src/IpData/Helpers/Extensions/ExpressionExtensions.cs +++ b/src/IPData/Helpers/Extensions/ExpressionExtensions.cs @@ -1,12 +1,12 @@ using System; using System.Linq.Expressions; -using IpData.Models; +using IPData.Models; -namespace IpData.Helpers.Extensions +namespace IPData.Helpers.Extensions { internal static class ExpressionExtensions { - public static string PropertyName(this Expression> expression) + public static string PropertyName(this Expression> expression) { switch (expression.Body) { diff --git a/src/IpData/Helpers/Extensions/UriExtenstions.cs b/src/IPData/Helpers/Extensions/UriExtenstions.cs similarity index 89% rename from src/IpData/Helpers/Extensions/UriExtenstions.cs rename to src/IPData/Helpers/Extensions/UriExtenstions.cs index 0ec72db..c071cd2 100644 --- a/src/IpData/Helpers/Extensions/UriExtenstions.cs +++ b/src/IPData/Helpers/Extensions/UriExtenstions.cs @@ -1,7 +1,7 @@ using System; using System.Web; -namespace IpData.Helpers.Extensions +namespace IPData.Helpers.Extensions { internal static class UriExtenstions { diff --git a/src/IpData/Http/HttpClientAdapter.cs b/src/IPData/Http/HttpClientAdapter.cs similarity index 93% rename from src/IpData/Http/HttpClientAdapter.cs rename to src/IPData/Http/HttpClientAdapter.cs index 1dfb244..e2e9242 100644 --- a/src/IpData/Http/HttpClientAdapter.cs +++ b/src/IPData/Http/HttpClientAdapter.cs @@ -2,7 +2,7 @@ using System.Net.Http; using System.Threading.Tasks; -namespace IpData +namespace IPData { internal class HttpClientAdapter : IHttpClient { diff --git a/src/IpData/Http/IHttpClient.cs b/src/IPData/Http/IHttpClient.cs similarity index 91% rename from src/IpData/Http/IHttpClient.cs rename to src/IPData/Http/IHttpClient.cs index fa4902a..ea6680b 100644 --- a/src/IpData/Http/IHttpClient.cs +++ b/src/IPData/Http/IHttpClient.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Threading.Tasks; -namespace IpData +namespace IPData { public interface IHttpClient { diff --git a/src/IpData/Http/Serializer/IJsonSerializer.cs b/src/IPData/Http/Serializer/IJsonSerializer.cs similarity index 79% rename from src/IpData/Http/Serializer/IJsonSerializer.cs rename to src/IPData/Http/Serializer/IJsonSerializer.cs index faa4882..d5e0203 100644 --- a/src/IpData/Http/Serializer/IJsonSerializer.cs +++ b/src/IPData/Http/Serializer/IJsonSerializer.cs @@ -1,4 +1,4 @@ -namespace IpData.Http.Serializer +namespace IPData.Http.Serializer { public interface ISerializer { diff --git a/src/IpData/Http/Serializer/JsonSerializer.cs b/src/IPData/Http/Serializer/JsonSerializer.cs similarity index 96% rename from src/IpData/Http/Serializer/JsonSerializer.cs rename to src/IPData/Http/Serializer/JsonSerializer.cs index b13f1ca..85e8227 100644 --- a/src/IpData/Http/Serializer/JsonSerializer.cs +++ b/src/IPData/Http/Serializer/JsonSerializer.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace IpData.Http.Serializer +namespace IPData.Http.Serializer { internal class JsonSerializer : ISerializer { diff --git a/src/IpData/IIpDataClient.cs b/src/IPData/IIPDataClient.cs similarity index 89% rename from src/IpData/IIpDataClient.cs rename to src/IPData/IIPDataClient.cs index 6ea9c81..2f603e8 100644 --- a/src/IpData/IIpDataClient.cs +++ b/src/IPData/IIPDataClient.cs @@ -3,14 +3,14 @@ using System.Globalization; using System.Linq.Expressions; using System.Threading.Tasks; -using IpData.Models; +using IPData.Models; -namespace IpData +namespace IPData { - /// Interface of IpDataClient. - public interface IIpDataClient + /// Interface of IPDataClient. + public interface IIPDataClient { - /// The IpData ApiKey. + /// The IPData ApiKey. string ApiKey { get; } /// Fetch company for IP. @@ -116,7 +116,7 @@ public interface IIpDataClient Task Threat(string ip); /// Fetch IP info for your IP. - /// The IP info . + /// The IP info . /// /// Thrown when IP address is private or invalid. /// @@ -129,11 +129,11 @@ public interface IIpDataClient /// /// Thrown when unexpected case occurred. /// - Task Lookup(); + Task Lookup(); /// Fetch localized IP info for your IP. /// The culture info. - /// Localized IP info + /// Localized IP info /// /// Thrown when IP address is private or invalid. /// @@ -151,11 +151,11 @@ public interface IIpDataClient /// Lookup(CultureInfo.GetCultureInfo("zh-CN")); /// /// - Task Lookup(CultureInfo culture); + Task Lookup(CultureInfo culture); /// Fetch IP info for few IPs. /// The list of IPv4 addresses. - /// The list of IP info . + /// The list of IP info . /// /// Thrown when IP address is private or invalid. /// @@ -168,7 +168,7 @@ public interface IIpDataClient /// /// Thrown when unexpected case occurred. /// - Task> Lookup(IReadOnlyCollection ips); + Task> Lookup(IReadOnlyCollection ips); /// Fetch IP info for IPv4 address. /// The IPv4 Address. @@ -185,12 +185,12 @@ public interface IIpDataClient /// /// Thrown when unexpected case occurred. /// - Task Lookup(string ip); + Task Lookup(string ip); /// Fetch localized IP info for IPv4 address. /// The IPv4 address. /// The culture info. - /// Localized IP info . + /// Localized IP info . /// /// Thrown when IP address is private or invalid. /// @@ -208,7 +208,7 @@ public interface IIpDataClient /// Lookup("8.8.8.8", CultureInfo.GetCultureInfo("zh-CN")); /// /// - Task Lookup(string ip, CultureInfo culture); + Task Lookup(string ip, CultureInfo culture); /// Fetch single IP info fields from IPv4 address. /// The IPv4 address. @@ -231,7 +231,7 @@ public interface IIpDataClient /// Lookup("8.8.8.8", x => x.CountryName); /// /// - Task Lookup(string ip, Expression> fieldSelector); + Task Lookup(string ip, Expression> fieldSelector); /// Fetch multiple IP info fields from IPv4 address. /// The IPv4 address. @@ -254,6 +254,6 @@ public interface IIpDataClient /// Lookup("8.8.8.8", x => x.CountryName, x => x.City); /// /// - Task Lookup(string ip, params Expression>[] fieldSelectors); + Task Lookup(string ip, params Expression>[] fieldSelectors); } } \ No newline at end of file diff --git a/src/IpData/IpData.csproj b/src/IPData/IPData.csproj similarity index 76% rename from src/IpData/IpData.csproj rename to src/IPData/IPData.csproj index be4f1ba..47a23b4 100644 --- a/src/IpData/IpData.csproj +++ b/src/IPData/IPData.csproj @@ -5,23 +5,23 @@ latest ip ipdata C# library to gather information for an IP using ipdata.co - IpData Community + IPData Community true - https://github.com/alexkhil/IpData - https://github.com/alexkhil/IpData + https://github.com/alexkhil/IPData + https://github.com/alexkhil/IPData git false MIT https://image.ibb.co/iDQdUS/ipdatalogo.png ipdata.ico - IpData Community + IPData Community - Release notes are at https://github.com/alexkhil/IpData/releases + Release notes are at https://github.com/alexkhil/IPData/releases false false $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 2.0.1 - 2.0.1.0 + 3.0.0 + 3.0.0.0 diff --git a/src/IpData/IpData.nuspec b/src/IPData/IPData.nuspec similarity index 68% rename from src/IpData/IpData.nuspec rename to src/IPData/IPData.nuspec index 6cd635a..c971b7c 100644 --- a/src/IpData/IpData.nuspec +++ b/src/IPData/IPData.nuspec @@ -1,19 +1,19 @@  - IpData - 2.0.1 - IpData Contributors - IpData Contributors + IPData + 3.0.0 + IPData Contributors + IPData Contributors false https://licenses.nuget.org/MIT - https://github.com/alexkhil/IpData + https://github.com/alexkhil/IPData https://image.ibb.co/iDQdUS/ipdatalogo.png C# library to gather information for an IP using ipdata.co - Release notes are at https://github.com/alexkhil/IpData/releases - IpData Community + Release notes are at https://github.com/alexkhil/IPData/releases + IPData Community ip ipdata csharp - + diff --git a/src/IpData/IpDataClient.cs b/src/IPData/IPDataClient.cs similarity index 80% rename from src/IpData/IpDataClient.cs rename to src/IPData/IPDataClient.cs index cc25429..b2f05b9 100644 --- a/src/IpData/IpDataClient.cs +++ b/src/IPData/IPDataClient.cs @@ -6,17 +6,17 @@ using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; -using IpData.Exceptions.Factory; -using IpData.Helpers; -using IpData.Http.Serializer; -using IpData.Models; +using IPData.Exceptions.Factory; +using IPData.Helpers; +using IPData.Http.Serializer; +using IPData.Models; -[assembly: InternalsVisibleTo("IpData.Tests")] +[assembly: InternalsVisibleTo("IPData.Tests")] -namespace IpData +namespace IPData { - /// Implementation of . - public class IpDataClient : IIpDataClient + /// Implementation of . + public class IPDataClient : IIPDataClient { /// The serializer private static readonly ISerializer _serializer = new JsonSerializer(); @@ -32,44 +32,44 @@ public class IpDataClient : IIpDataClient /// public string ApiKey { get; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The API key. - public IpDataClient(string apiKey) + public IPDataClient(string apiKey) : this(apiKey, new HttpClientAdapter(), null) { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The API key. /// The HTTP client. - public IpDataClient(string apiKey, HttpClient httpClient) + public IPDataClient(string apiKey, HttpClient httpClient) : this(apiKey, new HttpClientAdapter(httpClient), null) { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The API key. /// The HTTP client. - public IpDataClient(string apiKey, IHttpClient httpClient) + public IPDataClient(string apiKey, IHttpClient httpClient) : this(apiKey, httpClient, null) { } - /// Initializes a new instance of the class with a custom base URL. + /// Initializes a new instance of the class with a custom base URL. /// The API key. /// The base URL (e.g. https://eu-api.ipdata.co for the EU endpoint). - public IpDataClient(string apiKey, Uri baseUrl) + public IPDataClient(string apiKey, Uri baseUrl) : this(apiKey, new HttpClientAdapter(), baseUrl) { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The API key. /// The HTTP client. /// The base URL. Defaults to https://api.ipdata.co when null. /// The {nameof(apiKey)} {apiKey} - apiKey /// httpClient - The {nameof(httpClient)} - public IpDataClient(string apiKey, IHttpClient httpClient, Uri baseUrl) + public IPDataClient(string apiKey, IHttpClient httpClient, Uri baseUrl) { if (string.IsNullOrWhiteSpace(apiKey)) { @@ -87,33 +87,33 @@ public IpDataClient(string apiKey, IHttpClient httpClient, Uri baseUrl) } /// - public Task Lookup() => + public Task Lookup() => Lookup(CultureInfo.InvariantCulture); /// - public async Task Lookup(CultureInfo culture) + public async Task Lookup(CultureInfo culture) { var url = _apiUrls.Get(ApiKey, culture); var request = new HttpRequestMessage(HttpMethod.Get, url); var json = await SendRequestAsync(_httpClient, request).ConfigureAwait(false); - return _serializer.Deserialize(json); + return _serializer.Deserialize(json); } /// - public Task Lookup(string ip) => + public Task Lookup(string ip) => Lookup(ip, CultureInfo.InvariantCulture); /// - public async Task Lookup(string ip, CultureInfo culture) + public async Task Lookup(string ip, CultureInfo culture) { var url = _apiUrls.Get(ApiKey, ip, culture); var request = new HttpRequestMessage(HttpMethod.Get, url); var json = await SendRequestAsync(_httpClient, request).ConfigureAwait(false); - return _serializer.Deserialize(json); + return _serializer.Deserialize(json); } /// - public Task Lookup(string ip, Expression> fieldSelector) + public Task Lookup(string ip, Expression> fieldSelector) { var url = _apiUrls.Get(ApiKey, ip, fieldSelector); var request = new HttpRequestMessage(HttpMethod.Get, url); @@ -121,16 +121,16 @@ public Task Lookup(string ip, Expression> fieldSele } /// - public async Task Lookup(string ip, params Expression>[] fieldSelectors) + public async Task Lookup(string ip, params Expression>[] fieldSelectors) { var url = _apiUrls.Get(ApiKey, ip, fieldSelectors); var request = new HttpRequestMessage(HttpMethod.Get, url); var json = await SendRequestAsync(_httpClient, request).ConfigureAwait(false); - return _serializer.Deserialize(json); + return _serializer.Deserialize(json); } /// - public async Task> Lookup(IReadOnlyCollection ips) + public async Task> Lookup(IReadOnlyCollection ips) { var url = _apiUrls.Bulk(ApiKey); var request = new HttpRequestMessage(HttpMethod.Post, url) @@ -139,7 +139,7 @@ public async Task> Lookup(IReadOnlyCollection ips) }; var json = await SendRequestAsync(_httpClient, request).ConfigureAwait(false); - return _serializer.Deserialize>(json); + return _serializer.Deserialize>(json); } /// diff --git a/src/IpData/Models/ApiError.cs b/src/IPData/Models/ApiError.cs similarity index 92% rename from src/IpData/Models/ApiError.cs rename to src/IPData/Models/ApiError.cs index c609230..9c295b7 100644 --- a/src/IpData/Models/ApiError.cs +++ b/src/IPData/Models/ApiError.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public sealed class ApiError { diff --git a/src/IpData/Models/AsnInfo.cs b/src/IPData/Models/AsnInfo.cs similarity index 96% rename from src/IpData/Models/AsnInfo.cs rename to src/IPData/Models/AsnInfo.cs index 540dcaf..e37d353 100644 --- a/src/IpData/Models/AsnInfo.cs +++ b/src/IPData/Models/AsnInfo.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class AsnInfo { diff --git a/src/IpData/Models/BlocklistInfo.cs b/src/IPData/Models/BlocklistInfo.cs similarity index 94% rename from src/IpData/Models/BlocklistInfo.cs rename to src/IPData/Models/BlocklistInfo.cs index 4ea9c65..574109a 100644 --- a/src/IpData/Models/BlocklistInfo.cs +++ b/src/IPData/Models/BlocklistInfo.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class BlocklistInfo { diff --git a/src/IpData/Models/CarrierInfo.cs b/src/IPData/Models/CarrierInfo.cs similarity index 94% rename from src/IpData/Models/CarrierInfo.cs rename to src/IPData/Models/CarrierInfo.cs index 282e995..69fa4b2 100644 --- a/src/IpData/Models/CarrierInfo.cs +++ b/src/IPData/Models/CarrierInfo.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class CarrierInfo { diff --git a/src/IpData/Models/CompanyInfo.cs b/src/IPData/Models/CompanyInfo.cs similarity index 95% rename from src/IpData/Models/CompanyInfo.cs rename to src/IPData/Models/CompanyInfo.cs index b47f344..d7d5768 100644 --- a/src/IpData/Models/CompanyInfo.cs +++ b/src/IPData/Models/CompanyInfo.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class CompanyInfo { diff --git a/src/IpData/Models/Currency.cs b/src/IPData/Models/Currency.cs similarity index 96% rename from src/IpData/Models/Currency.cs rename to src/IPData/Models/Currency.cs index 6efdbe9..f0d0a6f 100644 --- a/src/IpData/Models/Currency.cs +++ b/src/IPData/Models/Currency.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class Currency { diff --git a/src/IpData/Models/IpInfo.cs b/src/IPData/Models/IPLookupResult.cs similarity index 91% rename from src/IpData/Models/IpInfo.cs rename to src/IPData/Models/IPLookupResult.cs index 4c193e1..b956b3c 100644 --- a/src/IpData/Models/IpInfo.cs +++ b/src/IPData/Models/IPLookupResult.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; -using IpData.Helpers.Extensions; +using IPData.Helpers.Extensions; using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { - public class IpInfo + public class IPLookupResult { [JsonProperty("ip", NullValueHandling = NullValueHandling.Ignore)] public string Ip { get; set; } @@ -90,10 +90,10 @@ public class IpInfo [JsonProperty("count")] public int Count { get; set; } - internal static string FieldName(Expression> expression) + internal static string FieldName(Expression> expression) { var propName = expression.PropertyName(); - var attribute = typeof(IpInfo) + var attribute = typeof(IPLookupResult) .GetProperty(propName) ?.GetCustomAttributes(typeof(JsonPropertyAttribute), false) .Single() as JsonPropertyAttribute; diff --git a/src/IpData/Models/Language.cs b/src/IPData/Models/Language.cs similarity index 94% rename from src/IpData/Models/Language.cs rename to src/IPData/Models/Language.cs index 355a31f..5c07261 100644 --- a/src/IpData/Models/Language.cs +++ b/src/IPData/Models/Language.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class Language { diff --git a/src/IpData/Models/Threat.cs b/src/IPData/Models/Threat.cs similarity index 98% rename from src/IpData/Models/Threat.cs rename to src/IPData/Models/Threat.cs index 828ef25..6b5649d 100644 --- a/src/IpData/Models/Threat.cs +++ b/src/IPData/Models/Threat.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class Threat { diff --git a/src/IpData/Models/TimeZone.cs b/src/IPData/Models/TimeZone.cs similarity index 96% rename from src/IpData/Models/TimeZone.cs rename to src/IPData/Models/TimeZone.cs index 966d124..9341c7e 100644 --- a/src/IpData/Models/TimeZone.cs +++ b/src/IPData/Models/TimeZone.cs @@ -1,7 +1,7 @@ using System; using Newtonsoft.Json; -namespace IpData.Models +namespace IPData.Models { public class TimeZone { diff --git a/src/IpData/ipdata.ico b/src/IPData/ipdata.ico similarity index 100% rename from src/IpData/ipdata.ico rename to src/IPData/ipdata.ico diff --git a/test/Unit/AutoMoqDataAttribute.cs b/test/Unit/AutoMoqDataAttribute.cs index e9246e8..2eeaee4 100644 --- a/test/Unit/AutoMoqDataAttribute.cs +++ b/test/Unit/AutoMoqDataAttribute.cs @@ -4,7 +4,7 @@ using AutoFixture.AutoMoq; using AutoFixture.Xunit2; -namespace IpData.Tests +namespace IPData.Tests { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class AutoMoqDataAttribute : AutoDataAttribute diff --git a/test/Unit/IpData.Tests/DataSources/TestDataSource.cs b/test/Unit/IPData.Tests/DataSources/TestDataSource.cs similarity index 94% rename from test/Unit/IpData.Tests/DataSources/TestDataSource.cs rename to test/Unit/IPData.Tests/DataSources/TestDataSource.cs index bc684b9..2ff97e2 100644 --- a/test/Unit/IpData.Tests/DataSources/TestDataSource.cs +++ b/test/Unit/IPData.Tests/DataSources/TestDataSource.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace IpData.Tests.DataSources +namespace IPData.Tests.DataSources { public static class TestDataSource { @@ -11,7 +11,7 @@ public static IEnumerable EmptyOrWhitespaceString() yield return new object[] { null }; } - public static IEnumerable IpInfoData() + public static IEnumerable IPLookupResultData() { yield return new object[] { "{\"ip\":\"91.225.201.108\",\"is_eu\":false,\"city\":\"Lviv\",\"region\":\"L'vivs'ka Oblast'\",\"region_code\":\"46\",\"region_type\":\"oblast\",\"country_name\":\"Ukraine\",\"country_code\":\"UA\",\"continent_name\":\"Europe\",\"continent_code\":\"EU\",\"latitude\":49.8486,\"longitude\":24.0323,\"postal\":\"79000\",\"calling_code\":\"380\",\"flag\":\"https:\\/\\/ipdata.co\\/flags\\/ua.png\",\"emoji_flag\":\"\uD83C\uDDFA\uD83C\uDDE6\",\"emoji_unicode\":\"U+1F1FA U+1F1E6\",\"asn\":{\"asn\":\"AS49824\",\"name\":\"PC \\\"Astra-net\\\"\",\"domain\":\"astra.in.ua\",\"route\":\"91.225.200.0\\/22\",\"type\":\"isp\"},\"company\":{\"name\":\"Astra-net\",\"domain\":\"astra.in.ua\",\"network\":\"91.225.200.0\\/22\",\"type\":\"isp\"},\"carrier\":{\"name\":\"Kyivstar\",\"mcc\":\"255\",\"mnc\":\"03\"},\"languages\":[{\"name\":\"Ukrainian\",\"native\":\"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\",\"code\":\"uk\"}],\"currency\":{\"name\":\"Ukrainian Hryvnia\",\"code\":\"UAH\",\"symbol\":\"\u20B4\",\"native\":\"\u20B4\",\"plural\":\"Ukrainian hryvnias\"},\"time_zone\":{\"name\":\"Europe\\/Kiev\",\"abbr\":\"EET\",\"offset\":\"+0200\",\"is_dst\":false,\"current_time\":\"2020-01-30T23:16:19.129316+02:00\"},\"threat\":{\"is_tor\":false,\"is_icloud_relay\":false,\"is_proxy\":false,\"is_datacenter\":false,\"is_anonymous\":false,\"is_known_attacker\":false,\"is_known_abuser\":false,\"is_threat\":false,\"is_bogon\":false,\"blocklists\":[]},\"status\":200}" }; } diff --git a/test/Unit/IpData.Tests/Exceptions/ApiExceptionTests.cs b/test/Unit/IPData.Tests/Exceptions/ApiExceptionTests.cs similarity index 97% rename from test/Unit/IpData.Tests/Exceptions/ApiExceptionTests.cs rename to test/Unit/IPData.Tests/Exceptions/ApiExceptionTests.cs index a7a9879..2a742a4 100644 --- a/test/Unit/IpData.Tests/Exceptions/ApiExceptionTests.cs +++ b/test/Unit/IPData.Tests/Exceptions/ApiExceptionTests.cs @@ -1,9 +1,9 @@ using System.Globalization; using FluentAssertions; -using IpData.Exceptions; +using IPData.Exceptions; using Xunit; -namespace IpData.Tests.Exceptions +namespace IPData.Tests.Exceptions { public class ApiExceptionTests { diff --git a/test/Unit/IpData.Tests/Exceptions/BadRequestExceptionTests.cs b/test/Unit/IPData.Tests/Exceptions/BadRequestExceptionTests.cs similarity index 95% rename from test/Unit/IpData.Tests/Exceptions/BadRequestExceptionTests.cs rename to test/Unit/IPData.Tests/Exceptions/BadRequestExceptionTests.cs index a2e74b6..8254fec 100644 --- a/test/Unit/IpData.Tests/Exceptions/BadRequestExceptionTests.cs +++ b/test/Unit/IPData.Tests/Exceptions/BadRequestExceptionTests.cs @@ -1,9 +1,9 @@ using System.Net; using FluentAssertions; -using IpData.Exceptions; +using IPData.Exceptions; using Xunit; -namespace IpData.Tests.Exceptions +namespace IPData.Tests.Exceptions { public class BadRequestExceptionTests { diff --git a/test/Unit/IpData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs b/test/Unit/IPData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs similarity index 94% rename from test/Unit/IpData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs rename to test/Unit/IPData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs index 2d807cb..257ed6c 100644 --- a/test/Unit/IpData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs +++ b/test/Unit/IPData.Tests/Exceptions/Factory/ApiExceptionFactoryTests.cs @@ -1,10 +1,10 @@ using System.Net; using FluentAssertions; -using IpData.Exceptions; -using IpData.Exceptions.Factory; +using IPData.Exceptions; +using IPData.Exceptions.Factory; using Xunit; -namespace IpData.Tests.Exceptions.Factory +namespace IPData.Tests.Exceptions.Factory { public class ApiExceptionFactoryTests { diff --git a/test/Unit/IpData.Tests/Exceptions/ForbiddenExceptionTests.cs b/test/Unit/IPData.Tests/Exceptions/ForbiddenExceptionTests.cs similarity index 95% rename from test/Unit/IpData.Tests/Exceptions/ForbiddenExceptionTests.cs rename to test/Unit/IPData.Tests/Exceptions/ForbiddenExceptionTests.cs index 1cbd7b2..dd7fb99 100644 --- a/test/Unit/IpData.Tests/Exceptions/ForbiddenExceptionTests.cs +++ b/test/Unit/IPData.Tests/Exceptions/ForbiddenExceptionTests.cs @@ -1,9 +1,9 @@ using System.Net; using FluentAssertions; -using IpData.Exceptions; +using IPData.Exceptions; using Xunit; -namespace IpData.Tests.Exceptions +namespace IPData.Tests.Exceptions { public class ForbiddenExceptionTests { diff --git a/test/Unit/IpData.Tests/Exceptions/UnauthorizedExceptionTests.cs b/test/Unit/IPData.Tests/Exceptions/UnauthorizedExceptionTests.cs similarity index 95% rename from test/Unit/IpData.Tests/Exceptions/UnauthorizedExceptionTests.cs rename to test/Unit/IPData.Tests/Exceptions/UnauthorizedExceptionTests.cs index 4971005..7749fdd 100644 --- a/test/Unit/IpData.Tests/Exceptions/UnauthorizedExceptionTests.cs +++ b/test/Unit/IPData.Tests/Exceptions/UnauthorizedExceptionTests.cs @@ -1,9 +1,9 @@ using System.Net; using FluentAssertions; -using IpData.Exceptions; +using IPData.Exceptions; using Xunit; -namespace IpData.Tests.Exceptions +namespace IPData.Tests.Exceptions { public class UnauthorizedExceptionTests { diff --git a/test/Unit/IpData.Tests/GlobalSuppressions.cs b/test/Unit/IPData.Tests/GlobalSuppressions.cs similarity index 100% rename from test/Unit/IpData.Tests/GlobalSuppressions.cs rename to test/Unit/IPData.Tests/GlobalSuppressions.cs diff --git a/test/Unit/IpData.Tests/Helpers/ApiUrlsTests.cs b/test/Unit/IPData.Tests/Helpers/ApiUrlsTests.cs similarity index 96% rename from test/Unit/IpData.Tests/Helpers/ApiUrlsTests.cs rename to test/Unit/IPData.Tests/Helpers/ApiUrlsTests.cs index e01258e..21c33f4 100644 --- a/test/Unit/IpData.Tests/Helpers/ApiUrlsTests.cs +++ b/test/Unit/IPData.Tests/Helpers/ApiUrlsTests.cs @@ -1,11 +1,11 @@ using FluentAssertions; -using IpData.Helpers; +using IPData.Helpers; using System; using System.Collections.Generic; using System.Globalization; using Xunit; -namespace IpData.Tests.Helpers +namespace IPData.Tests.Helpers { public class ApiUrlsTests { diff --git a/test/Unit/IpData.Tests/Http/HttpClientAdapterTests.cs b/test/Unit/IPData.Tests/Http/HttpClientAdapterTests.cs similarity index 97% rename from test/Unit/IpData.Tests/Http/HttpClientAdapterTests.cs rename to test/Unit/IPData.Tests/Http/HttpClientAdapterTests.cs index 14ff7d6..29e8840 100644 --- a/test/Unit/IpData.Tests/Http/HttpClientAdapterTests.cs +++ b/test/Unit/IPData.Tests/Http/HttpClientAdapterTests.cs @@ -3,7 +3,7 @@ using System.Net.Http; using Xunit; -namespace IpData.Tests.Http +namespace IPData.Tests.Http { public class HttpClientAdapterTests { diff --git a/test/Unit/IpData.Tests/Http/Serializer/JsonSerializerTests.cs b/test/Unit/IPData.Tests/Http/Serializer/JsonSerializerTests.cs similarity index 76% rename from test/Unit/IpData.Tests/Http/Serializer/JsonSerializerTests.cs rename to test/Unit/IPData.Tests/Http/Serializer/JsonSerializerTests.cs index 2232fbe..5920b41 100644 --- a/test/Unit/IpData.Tests/Http/Serializer/JsonSerializerTests.cs +++ b/test/Unit/IPData.Tests/Http/Serializer/JsonSerializerTests.cs @@ -1,28 +1,28 @@ using FluentAssertions; -using IpData.Http.Serializer; -using IpData.Models; -using IpData.Tests.DataSources; +using IPData.Http.Serializer; +using IPData.Models; +using IPData.Tests.DataSources; using Xunit; -namespace IpData.Tests.Http.Serializer +namespace IPData.Tests.Http.Serializer { public class JsonSerializerTests { private readonly JsonSerializer _sut = new JsonSerializer(); [Theory] - [MemberData(nameof(TestDataSource.IpInfoData), MemberType = typeof(TestDataSource))] - public void Deserialize_WhenCalled_ReturnedIpInfo(string json) + [MemberData(nameof(TestDataSource.IPLookupResultData), MemberType = typeof(TestDataSource))] + public void Deserialize_WhenCalled_ReturnedIPLookupResult(string json) { // Act - var actual = _sut.Deserialize(json); + var actual = _sut.Deserialize(json); // Assert actual.Should().NotBeNull(); } [Theory, AutoMoqData] - public void SerializeIpInfo_WhenCalled_ReturnedString(IpInfo ipInfo) + public void SerializeIPLookupResult_WhenCalled_ReturnedString(IPLookupResult ipInfo) { // Act var actual = _sut.Serialize(ipInfo); diff --git a/test/Unit/IpData.Tests/IpData.Tests.csproj b/test/Unit/IPData.Tests/IPData.Tests.csproj similarity index 95% rename from test/Unit/IpData.Tests/IpData.Tests.csproj rename to test/Unit/IPData.Tests/IPData.Tests.csproj index 8f7c90f..0ccea55 100644 --- a/test/Unit/IpData.Tests/IpData.Tests.csproj +++ b/test/Unit/IPData.Tests/IPData.Tests.csproj @@ -29,7 +29,7 @@ - + diff --git a/test/Unit/IpData.Tests/IpDataClientTests.cs b/test/Unit/IPData.Tests/IPDataClientTests.cs similarity index 87% rename from test/Unit/IpData.Tests/IpDataClientTests.cs rename to test/Unit/IPData.Tests/IPDataClientTests.cs index 2ea543e..3c61333 100644 --- a/test/Unit/IpData.Tests/IpDataClientTests.cs +++ b/test/Unit/IPData.Tests/IPDataClientTests.cs @@ -4,22 +4,22 @@ using System.Threading.Tasks; using AutoFixture.Xunit2; using FluentAssertions; -using IpData.Exceptions; -using IpData.Tests.DataSources; +using IPData.Exceptions; +using IPData.Tests.DataSources; using Moq; using Xunit; -namespace IpData.Tests +namespace IPData.Tests { - public class IpDataClientTests + public class IPDataClientTests { [Theory] [MemberData(nameof(TestDataSource.EmptyOrWhitespaceString), MemberType = typeof(TestDataSource))] - public void IpDataClient_WhenCreatedWithInvalidApiKey_ThrowArgumentException( + public void IPDataClient_WhenCreatedWithInvalidApiKey_ThrowArgumentException( string apiKey) { // Arrange - Action act = () => new IpDataClient(apiKey); + Action act = () => new IPDataClient(apiKey); // Act/Assert act.Should() @@ -29,22 +29,22 @@ public void IpDataClient_WhenCreatedWithInvalidApiKey_ThrowArgumentException( } [Theory, AutoMoqData] - public void IpDataClient_WhenCreatedWithValidApiKey_ShouldCreateClient( + public void IPDataClient_WhenCreatedWithValidApiKey_ShouldCreateClient( string apiKey) { // Act - var sut = new IpDataClient(apiKey); + var sut = new IPDataClient(apiKey); // Assert sut.ApiKey.Should().Be(apiKey); } [Theory, AutoMoqData] - public void IpDataClient_WhenCreatedWithInvalidIHttpClient_ThrowArgumentNullException( + public void IPDataClient_WhenCreatedWithInvalidIHttpClient_ThrowArgumentNullException( string apiKey) { // Arrange - Action act = () => new IpDataClient(apiKey, (IHttpClient)null); + Action act = () => new IPDataClient(apiKey, (IHttpClient)null); // Act/Assert act.Should() @@ -54,12 +54,12 @@ public void IpDataClient_WhenCreatedWithInvalidIHttpClient_ThrowArgumentNullExce } [Theory, AutoMoqData] - public void IpDataClient_WhenCreatedWithValidApiKeyAndHttpClient_ShouldCreateClient( + public void IPDataClient_WhenCreatedWithValidApiKeyAndHttpClient_ShouldCreateClient( IHttpClient httpClient, string apiKey) { // Arrange - Action act = () => new IpDataClient(apiKey, httpClient); + Action act = () => new IPDataClient(apiKey, httpClient); // Act/Assert act.Should().NotThrow(); @@ -75,7 +75,7 @@ public async Task Lookup_WhenStatusCode400_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup().ConfigureAwait(false); }; // Act/Assert @@ -94,7 +94,7 @@ public async Task Lookup_WhenStatusCode403_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup().ConfigureAwait(false); }; // Act/Assert @@ -113,7 +113,7 @@ public async Task Lookup_WhenStatusCode401_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup().ConfigureAwait(false); }; // Act/Assert @@ -132,7 +132,7 @@ public async Task Lookup_WhenUnknownStatusCode_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup().ConfigureAwait(false); }; // Act/Assert @@ -151,7 +151,7 @@ public async Task Lookup_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("69.78.70.144").ConfigureAwait(false); }; // Act/Assert @@ -170,7 +170,7 @@ public async Task Lookup_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("69.78.70.144").ConfigureAwait(false); }; // Act/Assert @@ -189,7 +189,7 @@ public async Task Lookup_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("69.78.70.144").ConfigureAwait(false); }; // Act/Assert @@ -208,7 +208,7 @@ public async Task Lookup_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("69.78.70.144").ConfigureAwait(false); }; // Act/Assert @@ -227,7 +227,7 @@ public async Task Lookup_WhenCalledWithIpList_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); var ipList = new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" }; Func act = async () => { await sut.Lookup(ipList).ConfigureAwait(false); }; @@ -247,7 +247,7 @@ public async Task Lookup_WhenCalledWithIpList_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); var ipList = new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" }; Func act = async () => { await sut.Lookup(ipList).ConfigureAwait(false); }; @@ -267,7 +267,7 @@ public async Task Lookup_WhenCalledWithIpList_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); var ipList = new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" }; Func act = async () => { await sut.Lookup(ipList).ConfigureAwait(false); }; @@ -287,7 +287,7 @@ public async Task Lookup_WhenCalledWithIpList_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); var ipList = new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" }; Func act = async () => { await sut.Lookup(ipList).ConfigureAwait(false); }; @@ -307,7 +307,7 @@ public async Task Lookup_WhenCalledWithSelector_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.CountryName).ConfigureAwait(false); }; // Act/Assert @@ -326,7 +326,7 @@ public async Task Lookup_WhenCalledWithSelector_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.CountryName).ConfigureAwait(false); }; // Act/Assert @@ -345,7 +345,7 @@ public async Task Lookup_WhenCalledWithSelector_ShouldThrowUnauthorizedException .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.CountryName).ConfigureAwait(false); }; // Act/Assert @@ -364,7 +364,7 @@ public async Task Lookup_WhenCalledWithSelector_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.CountryName).ConfigureAwait(false); }; // Act/Assert @@ -383,7 +383,7 @@ public async Task Lookup_WhenCalledWithSelectors_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.Asn, x => x.City).ConfigureAwait(false); }; // Act/Assert @@ -402,7 +402,7 @@ public async Task Lookup_WhenCalledWithSelectors_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.Asn, x => x.City).ConfigureAwait(false); }; // Act/Assert @@ -421,7 +421,7 @@ public async Task Lookup_WhenCalledWithSelectors_ShouldThrowUnauthorizedExceptio .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.Asn, x => x.City).ConfigureAwait(false); }; // Act/Assert @@ -440,7 +440,7 @@ public async Task Lookup_WhenCalledWithSelectors_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Lookup("1.1.1.1", x => x.Asn, x => x.City).ConfigureAwait(false); }; // Act/Assert @@ -459,7 +459,7 @@ public async Task Company_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Company("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -478,7 +478,7 @@ public async Task Company_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Company("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -497,7 +497,7 @@ public async Task Company_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Company("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -516,7 +516,7 @@ public async Task Company_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Company("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -535,7 +535,7 @@ public async Task Carrier_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Carrier("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -554,7 +554,7 @@ public async Task Carrier_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Carrier("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -573,7 +573,7 @@ public async Task Carrier_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Carrier("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -592,7 +592,7 @@ public async Task Carrier_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Carrier("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -611,7 +611,7 @@ public async Task Asn_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Asn("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -630,7 +630,7 @@ public async Task Asn_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Asn("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -649,7 +649,7 @@ public async Task Asn_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Asn("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -668,7 +668,7 @@ public async Task Asn_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Asn("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -687,7 +687,7 @@ public async Task TimeZone_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.TimeZone("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -706,7 +706,7 @@ public async Task TimeZone_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.TimeZone("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -725,7 +725,7 @@ public async Task TimeZone_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.TimeZone("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -744,7 +744,7 @@ public async Task TimeZone_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.TimeZone("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -763,7 +763,7 @@ public async Task Currency_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Currency("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -782,7 +782,7 @@ public async Task Currency_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Currency("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -801,7 +801,7 @@ public async Task Currency_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Currency("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -820,7 +820,7 @@ public async Task Currency_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Currency("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -839,7 +839,7 @@ public async Task Threat_WhenCalledWithIp_ShouldThrowBadRequestException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Threat("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -858,7 +858,7 @@ public async Task Threat_WhenCalledWithIp_ShouldThrowForbiddenException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Forbidden)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Threat("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -877,7 +877,7 @@ public async Task Threat_WhenCalledWithIp_ShouldThrowUnauthorizedException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Unauthorized)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Threat("1.1.1.1").ConfigureAwait(false); }; // Act/Assert @@ -896,7 +896,7 @@ public async Task Threat_WhenCalledWithIp_ShouldThrowApiException( .Setup(x => x.SendAsync(It.IsAny())) .ReturnsAsync(new HttpResponseMessage(0)); - var sut = new IpDataClient(apiKey, httpClient.Object); + var sut = new IPDataClient(apiKey, httpClient.Object); Func act = async () => { await sut.Threat("1.1.1.1").ConfigureAwait(false); }; // Act/Assert