Sign inSign up

wicken/universalweatherpowershell

By wicken

•Updated over 5 years ago

Powershell package to return current weather in a wished city or/and in a wished country

Image
0

433

wicken/universalweatherpowershell repository overview

⁠UniversalWeatherPowershell

Powershell package to return current weather in a wished city or/and in a wished country identified by its country code.

⁠Contents

  1. What is this project ?⁠

  2. How is it structured ?⁠

  3. How use it ?⁠

  4. What is used in this project ?⁠

  5. Conclusion⁠

⁠What is this project ?

This project consists of the development of an API as a package which catch and manage the chosen city weather. This API is written in Powershell and can be used or included in any powershell code, software or project.

To access the GitHub repository, click here⁠.
To access the Powershell Gallery repository, click here⁠.

⁠How is it structured ?

This project is structured in several elements:

  • The main module UniversalWeatherPowershell.psm1⁠ which contains the Universal Weather Powershell class allowing to initialize, manipulate and manage the weather in a given city;
  • The usedModules⁠ directory containing all the classes used in the main class and allowing to initialize, manipulate and manage a particular characteristic (temperature, atmospheric pressure ...) in one module each;
  • The samples⁠ directory which contains examples of uses this module and package;

The usedModules⁠ contains 11 files corresponding each one to a class:

  • coordinates.psm1: defining the coordinates Powershell class to encapsulate coordinates datas (latitude and longitude);
  • dateandtime.psm1: defining the dateAndTime Powershell class to manage dates and times together;
  • geographicLocation.psm1: defining the geographicLocation Powershell class to encapsulate country and city names;
  • humidity.psm1: defining the humidity Powershell class to encapsulate all datas relatives to humidity;
  • language.psm1: defining the language Powershell class to manage current language datas;
  • pressure.psm1: defining the pressure Powershell class to manage pressure datas;
  • temperature.psm1: defining the temperature Powershell class to encapsulate and manage temperature datas;
  • ultraviolet.psm1: defining the ultraviolet Powershell class to encapsulate uv datas;
  • weatherDescription.psm1: defining the weatherDescription Powershell class to encapsulate and manage weather datas;
  • weatherError.psm1: defining the weatherError Powershell class to manage possible occured HTTP/HTTPS errors;
  • wind.psm1: defining the wind Powershell class to encapsulate and manage wind parameters.

The samples⁠ contains 2 other directories:

  • The integratedSamples⁠ which contains the samples, to run inside this folder because it calls the Powershell module in relative path from this directory.
  • The simpleSamples⁠ which contains the samples, to run with the current Powershell module installed on the Windows system.

Further explanations will be provided by browsing the GitHub repository.

⁠How use it ?

There are 2 ways to use this module: by cloning the current GitHub repository⁠ or by installing the package from Powershell Gallery⁠.

⁠Prerequisites

To make this project work or integrate it into yours, whether as a module to import from Powershell Gallery⁠ or a clone of the GitHub repository⁠, you must have a machine running Windows 10 or higher (home, professional or educational version) or Windows Server 2016 or higher.

⁠From the GitHub repository

To use this PowerShell package from its GitHub repository, you must first install the Git utility on Windows. You have a plethora of Git clients that you can use on Windows (GitKraken⁠, GitHub Desktop⁠ ...), then install the one that suits you best. The best choice is to install the client Git for Windows⁠. Download the exe file from the official website, then run it.

⁠Manually install the cloned module on your system

You can install this Powershell module on your windows system, so that you will just need to import this module with the command bellow when opening Powershell :

Import-Module UniversalWeatherPowershell

Let's see how to do this.

Firstable, you must execute this following command in Powershell :

$ENV:PSModulePath

It will display you all install paths for Powershell modules.

Secondly, you must move the Powershell module to one of the directory displayed by the previous command. About the first step command there will be 2 main paths in results :

  • C:\Users<User Name>\Documents\WindowsPowerShell\modules
  • C:\program files\WindowsPowerShell\Modules<Module Folder><Module Files>

If you want the module to be available for a specific user, move the Powershell module to the directory indicated by the first path. Or if you want the module to be available for all users, move the Powershell module to the directory indicated by the second path.

That's all. Now is the time for you to have some fun...

⁠What is used in this project ?

Nothing very specific is used in this project. All classes used were developed by the author of this API. The only element used from the .Net framework, System.Windows.Forms⁠ and PresentationFramework⁠ is used to develop and then use forms and MessagesBoxes respectively.

⁠Conclusion

It has been an exciting project, easily usable by anyone in any other project written in PowerShell regardless of its size (large or small) and which has broadened my knowledge in PowerShell language development as potentially every other beginner or confirmed developer.

Tag summary

Content type

Image

Digest

Size

125.1 MB

Last updated

over 5 years ago

docker pull wicken/universalweatherpowershell