From 026f26f952392b4e8d87efd7e93a2645b763fb12 Mon Sep 17 00:00:00 2001 From: Arnoud Buzing Date: Tue, 17 Sep 2019 15:11:12 -0500 Subject: [PATCH] updates --- Prototypes/PacletInfo.m | 7 ++++--- Prototypes/Prototypes.wl | 4 ++-- Prototypes/Source/Service/IPStack.wl | 9 +++++++++ Prototypes/Usage.wl | 2 ++ build-with-documentation.wls | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 Prototypes/Source/Service/IPStack.wl diff --git a/Prototypes/PacletInfo.m b/Prototypes/PacletInfo.m index bc4bc7e..6b705a8 100644 --- a/Prototypes/PacletInfo.m +++ b/Prototypes/PacletInfo.m @@ -3,8 +3,8 @@ Description -> "A paclet for prototype functions", Creator -> "Arnoud Buzing", Publisher -> "Wolfram Research", - Version -> "0.5.4", - MathematicaVersion -> "11.2+", + Version -> "0.5.5", + MathematicaVersion -> "11.3+", Loading -> Automatic, Thumbnail -> "icons/icon.png", Extensions -> { @@ -60,7 +60,8 @@ "Prototypes`CacheClear", "Prototypes`SatelliteImage","Prototypes`PlaceholderImage","Prototypes`ResourceFunctionSearch", "Prototypes`Redder","Prototypes`Bluer", "Prototypes`Greener", "Prototypes`Yellower", "Prototypes`Oranger", "Prototypes`Pinker", "Prototypes`Purpler", "Prototypes`Blacker", "Prototypes`Grayer", "Prototypes`Whiter", - "Prototypes`AddCodeCompletion", "Prototypes`RasterizeLargeCells", "Prototypes`RandomDate", "Prototypes`MessageBlock"} + "Prototypes`AddCodeCompletion", "Prototypes`RasterizeLargeCells", "Prototypes`RandomDate", "Prototypes`MessageBlock", + "Prototypes`IPStack"} } } ] diff --git a/Prototypes/Prototypes.wl b/Prototypes/Prototypes.wl index e6d2557..892d073 100644 --- a/Prototypes/Prototypes.wl +++ b/Prototypes/Prototypes.wl @@ -20,8 +20,8 @@ Module[ {files}, "Image.wl", "Language.wl", "Paclet.wl", "Formats.wl", "Resources.wl", "Search.wl", "String.wl", "System.wl", "Color.wl", "Styles.wl", "Entities.wl", "WolframAlpha.wl", "Translation.wl","GeoGraphics.wl", "Words.wl", "Packages.wl", "Random.wl", - "Cryptography.wl", "External.wl", "Service/What3Words.wl", "Service/OpenSky.wl", "Service/Satellite.wl", "Primes/Primes.wl", - "Java/Runtime.wl", "Compiler/Build.wl"}; + "Cryptography.wl", "External.wl", "Service/What3Words.wl", "Service/OpenSky.wl", "Service/Satellite.wl", "Service/IPStack.wl", + "Primes/Primes.wl", "Java/Runtime.wl", "Compiler/Build.wl"}; Map[ Function[ {file}, AppendTo[ timings, file<>"-Before" -> N@SessionTime[] ]; diff --git a/Prototypes/Source/Service/IPStack.wl b/Prototypes/Source/Service/IPStack.wl new file mode 100644 index 0000000..4b0757e --- /dev/null +++ b/Prototypes/Source/Service/IPStack.wl @@ -0,0 +1,9 @@ +IPStack[ip_String, key_String] := Module[{response}, + response = URLRead["http://api.ipstack.com/" <> ip <> "?access_key=" <> key]; + ImportByteArray[response["BodyByteArray"], "RawJSON"] +]; + +IPStack[ip_IPAddress, key_String] := IPStack[First[ip], key] + +IPStack[ips_List, key_String] := Dataset[ Map[ IPStack[#,key]&, ips] ]; + diff --git a/Prototypes/Usage.wl b/Prototypes/Usage.wl index c2e1e07..950410b 100644 --- a/Prototypes/Usage.wl +++ b/Prototypes/Usage.wl @@ -186,3 +186,5 @@ RasterizeLargeCells::usage = "RasterizeLargeCells[nb,style] uses the 'BitmapCond RandomDate::usage = "RandomDate[] generates a random date between 1/1/1900 and today. RandomDate[date1,date2] generates a random date between 'date1' and date2'."; MessageBlock::usage = "MessageBlock[expr,failure] suppresses all message output during the evaluation of 'expr'. If 'expr' generates messages, then 'failure' is evaluated without suppressing message output."; + +IPStack::usage = "IPStack[ip,key] gives geographical information for IP address 'ip' using API access 'key' from https://ipstack.com (not included)"; \ No newline at end of file diff --git a/build-with-documentation.wls b/build-with-documentation.wls index b86b6fe..91dd7a8 100644 --- a/build-with-documentation.wls +++ b/build-with-documentation.wls @@ -22,7 +22,7 @@ Print["\n======================================================================= Print["Building Documentation"]; Print["================================================================================\n"]; -PrependTo[$Path,"D:\\git\\pubs"]; +PrependTo[$Path,"D:\\git"]; Quiet[ Get["DocumentationBuild`"], {RunProcess::pnfd, StringReplace::strse}];